Its properly because I do not understand completely, but I have had these issues a few days now.
I have a datetime field and using entity framework.
Scenarios:
When I set the field to be computed (databasegenerated option) I cant update the field like this:
db.ComputeUnites.Find(this._ComputeGuid).HeartBeat = DateTime.UtcNow; db.SaveChanges();When I don't set it to computed, and set it to required. I get an error when I try to add a new element that do not have the field set. (this makes sense, but I have set the default value on the server to set it to (
getutcdate())- so I hoped it would kick in when not set.I tried to set it to optional and with a default value again, then I can add new objects, but the default value is not used, instead 0:0:0 00:000 (don't remember the syntax correctly) times are inserted.
What I would like is: When I do not set the field on a newly added object, the default value should be used. And if I provide or update the field, it should use the value coming from my c# class.
What am I missing?