Answered by:
edmx designer properties does not set StoreGeneratedPattern="Computed" in SSDL

Question
-
In VS2010 when I set StoreGeneratedPattern="Computed" for a field in the properties window, it only adds an annotation tag in the CSDL and does not add anything in the SSDL. This means that the field is not treated as readOnly and can be modified from code behind. This means that if you have a dateAdded field in a table that is set with a default value on creation in the db, this can be over written in codebehind unless you manually set SGP=Computed in the xml of the CSDL.
In addition, there has been a bug since VS2008 that updating an edmx in designer from the db blows away all SSDL SGP tags! This means that the only safe way to update the edmx with db schema changes is as follows.
1) Make changes to the db
2) Update edmx from database and save but don’t check in changes
3) Diff against SCC repository and leave diff window open
4) Get latest and overwrite edmx to restore it to the state before the update
5) Open edmx in xml editor
6) Manually go through diff file and copy all valid changes to the edmx
This is tedious but doesn’t take long if there are not a lot of changes.
What a hassle!Thursday, June 3, 2010 5:52 PM
Answers
-
Hello,
Welcome to EF forum!
I can understand this annoying situation. However, it seems to be a product issue which cannot be fixed in VS2010 RTM. This connect ticket has confirmed it, https://connect.microsoft.com/VisualStudio/feedback/details/505178/storegeneratedpattern-property-in-ado-net-entity-model-designer-sets-cdsl-annotation-but-not-ssdl-attribute?wa=wsignin1.0.
“We have a work item to make the feature work the way you desire, but cannot fit it into Visual Studio 2010 - it will have to wait for a future release. For now, the feature's intent is only to support generation of databases from the model.”
Thank you for your understanding! I believe the product team is doing the best to make it work in the next release of EF.
Hope you have a nice weekend!
Best Regards,
Lingzhi SunMSDN Subscriber Support in Forum
If you have any feedback on our support, please contact msdnmg@microsoft.com
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.- Proposed as answer by Michael Sun [MSFT]Microsoft employee Monday, June 7, 2010 1:24 AM
- Marked as answer by Michael Sun [MSFT]Microsoft employee Thursday, June 10, 2010 2:12 AM
Friday, June 4, 2010 6:57 AM
All replies
-
Hello,
Welcome to EF forum!
I can understand this annoying situation. However, it seems to be a product issue which cannot be fixed in VS2010 RTM. This connect ticket has confirmed it, https://connect.microsoft.com/VisualStudio/feedback/details/505178/storegeneratedpattern-property-in-ado-net-entity-model-designer-sets-cdsl-annotation-but-not-ssdl-attribute?wa=wsignin1.0.
“We have a work item to make the feature work the way you desire, but cannot fit it into Visual Studio 2010 - it will have to wait for a future release. For now, the feature's intent is only to support generation of databases from the model.”
Thank you for your understanding! I believe the product team is doing the best to make it work in the next release of EF.
Hope you have a nice weekend!
Best Regards,
Lingzhi SunMSDN Subscriber Support in Forum
If you have any feedback on our support, please contact msdnmg@microsoft.com
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.- Proposed as answer by Michael Sun [MSFT]Microsoft employee Monday, June 7, 2010 1:24 AM
- Marked as answer by Michael Sun [MSFT]Microsoft employee Thursday, June 10, 2010 2:12 AM
Friday, June 4, 2010 6:57 AM -
Here's a "third party" workaround: I have an add-in for VS2010 that adds a "model comparer" for EFv4 models. It plugs right into VS2010 and shows differences between the SSDL and CSDL, and between the SSDL and database broken down into individual items. It also allows you to sync a selected set of those differences (or all) with a simple click.
That makes it a breeze to detect if StoreGeneratedPattern, field length/precision/scale, nullability, or something else is out-of-sync between the SSDL and CSDL, and to re-sync the SSDL and CSDL without having to hand-edit the XML.
More details (screencast showing how it works etc) over at:
http://huagati.blogspot.com/2010/08/using-model-comparer-to-generate.htmlhttp://huagati.blogspot.com/2010/07/introducing-model-comparer-for-entity.html
http://huagati.blogspot.com/2010/08/whats-new-in-model-comparer-for-entity.html
Kristofer - Huagati Systems Co., Ltd.
Cool tools for Linq-to-SQL and Entity Framework:
huagati.com/dbmltools - add-in with new useful features for the L2S and EF designers in VS2008 and VS2010
huagati.com/L2SProfiler - Query profiler for Linq-to-SQL, Entity Framework v4, and LLBLGen ProWednesday, August 25, 2010 3:29 AM -
I have installed VS2010 SP1 and the problem is still there !!!!
I just can't believe it. What's wrong with you MS guys ????
Thursday, March 17, 2011 1:12 PM -
Hi,
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/KB2561001Thank you,
Sarah McDevitt
Program Manager, Microsoft
Sarah McDevitt Program Manager SQL Server Data Tools- Proposed as answer by sarahmcd Wednesday, September 28, 2011 11:04 PM
Wednesday, September 28, 2011 11:04 PM -
Hi,
we are starting a new MVC 4 project using VS2012, EF 5 and ODP.NET for Oracle 11
and we are experiencing exactly the same problem.Everytime we "generate database from model", the ssdl part on edmx file loses the "storedGeneratedPatter=Identity" attribute.
Are you planning an hotfix for VS2012 and EF 5 supporting Oracle too?
Thanks,
FabioTuesday, December 11, 2012 9:05 AM