Cadmium wrote:
Otis wrote:
Money columns should be set to 0.0 when they're null. I'll look into it.
The values columns with a NULL value get is stored in the TypeDefaultValue.cs/vb class (helperclasses folder). For a money column this is a System.Decimal type, datetime columns will receive DateTime.MinValue.
(you can test for NULL values for a field by using entityobject.TestOriginalFieldValueForNull method btw)
That datetime thing makes sense, I can test for DateTime.MinValue. The only problem I can see with that technique is that sql server doesn't like dates earlier than 1/1/1753, so a datetime.minval in .net will crash it (not that you should let that go unchecked). It's easy enough to check for though.
A datetime.minvalue will never end up in the database, because only fields which have been changed will be updated, the datetime.minvalue is a value the field gets when it is read from the database, that doesn't count for a change. So when you read an entity from the database and it contains a null in a datetime column and you change another field's value and you call Save() only the field you changed is updated.
When you have a new entity, it will be prefilled with the default values. When you want a column to have a given value, for example NULL, you have to set it to that value explicitly.
I could reproduce your problem here. I'll check out how to fix it.