I have a very simple web api method that looks like this:
public void Put(Vehicle vehicle)
{
db.Entry(vehicle).State = EntityState.Modified;
db.SaveChanges();
}
All it does is updating the direct properties of the vehicle entity. This works fine like this. But I would now like to know which properties have actually changed? Is there a way to do this?
I probably could get the vehicle from the database first and then compare it to the modified vehicle. But maybe there is an easier way.
Thanks
context.ChangeTracker.Entries<ITrackedEntity>().Where(entry => entry.State == EntityState.Added)