Changetracker.entries old value equal new value

A specific question about ChangeTracker in Entity Framework Core!

changetracker.entries returns a collection of ChangeEntry objects, which represent the changes made to an entity. Each ChangeEntry has properties like Entry (the entity being changed), OriginalValue (the original value of the property), and CurrentValue (the new value of the property).

To check if the old value is equal to the new value, you can use the following LINQ query:

var equalEntries = changetracker.entries
   .Where(e => e.OriginalValue == e.CurrentValue)
   .ToList();

This will give you a list of ChangeEntry objects where the old value is equal to the new value.

If you want to check if there are any entries where the old value is equal to the new value, you can use the Any method:

bool areEqual = changetracker.entries.Any(e => e.OriginalValue == e.CurrentValue);

This will return a boolean value indicating whether there are any entries where the old value is equal to the new value.