Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

StoreGeneratedPattern in Entity framework

If the storage model has the StoreGeneratedPattern=identity attribute set, why should not the conceptual model reflect this in some way? Either in and attribute or in a readonly nature of a property? If i need to pass a value to the reference field.

like image 687
renjucool Avatar asked Jul 04 '26 13:07

renjucool


2 Answers

We have released a hotfix for the StoreGeneratedPattern issue. Try it out!

MSConnect: http://connect.microsoft.com/VisualStudio/Downloads/DownloadDetails.aspx?DownloadID=37957

Code Gallery: http://archive.msdn.microsoft.com/KB2561001

like image 92
Sarah McDevitt Avatar answered Jul 06 '26 04:07

Sarah McDevitt


It should. And it does when it is working correctly. What you are probably seeing is a result of a bug in the designer.

When you set that property in the designer in VS2010 RTM, it only adds an annotation tag in the CSDL and does not add anything in the SSDL, so it doesn't treat it as read-only. Amazingly the same or very similar bug existed in EF 1.0!

If you edit the SSDL section by hand, it will work as advertised in the documentation. You just have to re-do, or merge your changes when you regenerate your model.

like image 39
DanO Avatar answered Jul 06 '26 04:07

DanO



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!