none
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

All replies