I have created an EDMX in visual studio 2010 SP1. It has been built from an existing database.
There are a number of database generated columns (ie, non nullable with GETDATE() as the default value).
The EDMX though does not seem to detect these columns and isn’t setting “StoreGeneratedPattern” to “Computed”. I am going to have to set these manually for the thing to work!
The database is very large so this is not ideal.
Is this a bug with the EDMX generation or am I likely to be doing something wrong?
Many thanks
Carl
It is not bug. It simply works this way because default constraint setting column to current date is not computed column. Computed column change its value every time you save a record – example is timestamp. Moreover properties using
StoreGeneratedPatternset toIdentityorComputedcannot be set from your application. Your column accepts other value so EF cannot make it store generated by default – it is up to you to make the decision.If you want to use default value from database for all records set the
StoreGeneratedPatterntoIdentity. It will ensure that the value is set and queried during insert. Setting the pattern toComputedwill create unnecessary query after each update.