I want to detect if changes where made to a specific set of entity before saving.
I am currently using this method but it returns true if there are any Entity modified in the context.
const EntityState ModifiedID = EntityState.Modified
| EntityState.Added
| EntityState.Deleted;
var objectStateEntries = Database.LabelTAB
.Context.ObjectStateManager
.GetObjectStateEntries(ModifiedID);
return objectStateEntries.Any();
Is there any way to detect if there are some unsaved entries in the LabelTAB entity only, and not in the entire Context?
Thank you.
Try this: