c# - Is there an easy way to make EntityFramework use SQL default values? -


for example, of entities have datecreated , datemodified fields. defaults these set getutcdate() in sql server.

if try , create entity , don't set these values, exception saying can't run sql insert because date value out of range. makes sense because c# default dates 1/1/0001 while sql server's minimum date 1/1/1753.

so there way can tell ef either use sql server default values, or not try , insert columns have not been set?

you must set storegeneratedpattern properties identity datecreated , computed datamodified. available in designer. once cannot modify values in application - database can set properties. wrote some article because feature had bug before vs2010 sp1 there reports still doesn't work sometimes.


Comments

Popular posts from this blog

Cursor error with postgresql, pgpool and php -

delphi - ESC/P programming! -

c++ - error: use of deleted function -