For example, most of my entities have DateCreated and DateModified fields. The defaults to these are set to GetUtcDate() in SQL Server.
If I try and create an entity and don't set these values, I get an exception saying it can't run the SQL insert because the date value is out of range. Makes sense because C# default dates are 1/1/0001 while SQL Server's minimum date is 1/1/1753.
So is there a way I can tell EF to either use the SQL Server default values, or to NOT try and insert columns which have not been set?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…