NickStrupat/EntityFramework.Triggers

Updated field is not getting saved to the Database

Closed this issue · 1 comments

I have a core project set up just like the sample.

The trigger fires and sets the Updated field with the current date/time.

But it doesn't get persisted to the database.

Triggers<TrackableEntity>.Updating += entry =>
{
	entry.Entity.Updated = DateTime.Now;
};

I don't see what I am doing wrong.

Well, I got this working by removing the private set.

public DateTimeOffset Updated { get; set; }

In the example it shows:

public DateTimeOffset Updated { get; private set; }

You might want to update the docs.

Oddly, it did not give an error, it just failed to save it.