Create Method in Entity Framework
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)
精彩评论