My code:

Models.Resource r = new Models.Resource();
r.Name = txtName.Text;
r.ResourceType = resTypes.Find(rt =&gt; rt.Name == "Content");

r.ResourceContents.Add(_resourceContent.Find(rc =&gt; rc.ID == _resourceContentID));

ctx.Resource.Add(r);
ctx.SaveChanges();


ctx.SaveChanges() causes the error:
Cannot insert explicit value for identity column in table 'Resources' when IDENTITY_INSERT is set to OFF.

Looking at what's being sent to SQL:
    ADO.NET:Execute NonQuery "INSERT [dbo].[Resources]([ID], [Name], [Description], [IsOnFile],
         [ContentOwnerAlias], [ContentOwnerGroup], [ResourceTypes_ID])
    VALUES (@0, @1, @2, @3, @4, @5, NULL)"

My POCO Resource has ID as a Key:

public partial class Resource
{
  public Resource()
  {
  }

  [Key]
  public int ID { get; set; }


And my Map code:

public class ResourceMap : EntityTypeConfiguration&lt;Resource&gt;
{
  public ResourceMap()
  {
    // Primary Key
    this.HasKey(t =&gt; t.ID);


How do I tell Entity to not send the Key ID field to the database?


Question: Why is this type of hesitation considered unethical?
Answer: Bridge players derive pleasure from using their brains, be it a technical play, or some nice logic to read the cards perfectly, which includes inferences from opponents hesitations.

Allowing coffee-housing like invalid hesitations just destroys that pleasure, as now there is garbage thrown into the pool of inferences available. That said, beginning players usually hesitate for no valid bridge reason, and many better players indeed try to take that into account.

Note that is very different from deceptive plays in bridge, where you deceive the opponents purely using the card you play (and not in the manner you play it), are completely ethical and quite a useful weapon.