I would like to have a field which is updated on every change(insertion, modification), basically, it’s a “ModificationDate”.
I saw there is a “Computed” StoreGeneratedPattern in EF. But since this will not set the date but only take the value generated by the database, I need to know what should I do on the database to have this default value set at the equivalent of GetDate() on every modification/insertion?
You need to create either
INSTEAD OFupdate trigger where you get data and perform update yourselves orAFTER UPDATEtrigger where you execute one more update to set the date.It would be easier to override
SaveChangesand set the date in your application prior to saving to database.