How to assign default values and define unique keys in Entity Framework 4 Designer
- by csharpnoob
Hello,
I've had a look at the Entity Framework 4. While generating code for the SQL Server 2008 I came to the point where I want to define some default values for some fields.
how to define in the designer for a Created DateTime Field the DateTime.Now default value?
- Error 54: Default value (DateTime.Now) is not valid for DateTime. The value must be in the form 'yyyy-MM-dd HH:mm:ss.fffZ'
how to make for code generation a string Field unique. Like E-Mail or Username can exists only once in the table.
I've search alot in the internet and also checked my books Pro Entity Framework 4.0 and Programming Entity Framework. But none of them seems to come up with the default value issue, or using sql commands as default values for database generation.
Another thing is, how to prevent on database generation always from droping tables?
Instead i want to append non existing fields and keep the data.
Thanks for any suggestions.