вторник, 11 января 2011 г.

Guid as PrimaryKey on Entity FrameWork


Hi, I am doing a little test with EF4, and I've tried to set up one entity which the primary key is one Guid,
Till this point, every thing is ok!, but whene try to insert into database, the visual studio throw one error saying that the object can't be saved because the Id (that´s my primary key) is null, otherwise the EF don't genarate one Guid for Id!
What can I do to solve my problem?
Is the GUID primary key column auto-generated at the database side?   Please set the StoreGeneratedPatterns to Identity on the GUID PK property.  For detail, please see http://blogs.msdn.com/alexj/archive/2009/05/20/tip-19-how-to-use-optimistic-concurrency-in-the-entity-framework.aspx &http://msdn.microsoft.com/en-us/library/dd283139.aspx

Комментариев нет: