I am having som problems while saving POCO objects using DateTime property. When the DateTime property is DateTime.MinValue, SaveChanges () fails due to the difference between SqlDateTime.MinValue and DateTime.MinValue.
So what to do?
1) Should I check DateTime.MinValue before saving the object?
2) Should I use the POCO property in datetime, something like this?
private SqlDateTime _created; public virtual DateTime Created { get { return _created.Value; } set { _created = value == DateTime.MinValue ? SqlDateTime.MinValue : value; } }
/ Pw
entity entity-framework datetime2 poco
Peter Wikstrรถm
source share