ADO.NET Entity Framework and identity columns

前端 未结 10 1534
甜味超标
甜味超标 2020-12-29 18:06

Is the Entity Framework aware of identity columns?

I am using SQL Server 2005 Express Edition and have several tables where the primary key is an identity column. w

10条回答
  •  别那么骄傲
    2020-12-29 18:24

    This is the best answer I've seen. You have to manually edit the storage layer xml to set StoreGeneratedPattern="Identity" on each primary key of type UniqueIdentifier that has the default value set to NewID().

    http://web.archive.org/web/20130728225149/http://leedumond.com/blog/using-a-guid-as-an-entitykey-in-entity-framework-4/

提交回复
热议问题