I'm overriding my DbContext SaveChanges method and capturing the ChangeTracker entries.
public override int SaveChanges()
{
var entries = ChangeTracker.Entries();
return base.SaveChanges();
}
I have an entity called "Range" that has a navigation property to another entity called "Feature"
public class Range
{
//other code
public virtual ICollection<Feature> Features { get; set; }
}
I'm removing a feature from the range and then saving the changes
var featureToRemove = range.Features.First(f => f.ID == featureId);
range.Features.Remove(featureToRemove);
centralProducts.SaveChanges();
After calling this code the feature is successfully removed but the entries in the ChangeTracker all have an EntityStatus of Unchanged (not just the range entity in question).
Something is changing or the database would not be updated.
Is there any way to capture this change in the SaveChanges method? Is Unchanged really the status I would expect to see when removing something from a navigation property?
I am aware that the table that actually gets changed is called Range_Features, and is neither the Range nor the Feature itself.