Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Default Constraints in Entity Framework

Very simple question that NO ONE has directly answered. Is there no way to insert an entity using EF4 that uses the database default constraint and yet allows that field to be updated later? There doesn't seem to be. When I have a date property for instance and want it to use the database default, I seem to have two options:

1) Set the "StoreGeneratedPattern" to "Computed" or "Identity" which prevents me from updating it later.

2) Ignore the database default entirely and set the default value myself.

Neither one of these options will work for me, and this seems to be a huge weakness with the framework. Any ideas? Is this bug resolved in EF5.

like image 671
Jordan Avatar asked Jun 12 '26 17:06

Jordan


1 Answers

No.

Relevant UserVoice suggestion.

like image 158
tne Avatar answered Jun 17 '26 04:06

tne



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!