开发者

Create Method in Entity Framework

开发者 https://www.devze.com 2023-02-21 17:32 出处:网络
Why does entity framework generate Create method for entities that takes parameter for the column that is defined as an identity in d开发者_JAVA百科atabase? It makes Create method totally useless as i

Why does entity framework generate Create method for entities that takes parameter for the column that is defined as an identity in d开发者_JAVA百科atabase? It makes Create method totally useless as it cannot be used to create entity or am I missing something?


You should set StoreGeneratedPattern as Identity on the property tab of your entity primary key property.

Source : http://msdn.microsoft.com/en-us/library/dd283139.aspx (chapter Entity Keys and Added Objects)

0

精彩评论

暂无评论...
验证码 换一张
取 消