public virtual void PropertyChanging(InternalEntityEntry entry, IPropertyBase propertyBase) { if (!entry.EntityType.UseEagerSnapshots()) { entry.EnsureOriginalValues(); if (propertyBase.GetRelationshipIndex() != -1) { entry.EnsureRelationshipSnapshot(); } } }
public virtual InternalEntityEntry SnapshotAndSubscribe(InternalEntityEntry entry) { var entityType = entry.EntityType; if (entityType.UseEagerSnapshots()) { entry.EnsureOriginalValues(); entry.EnsureRelationshipSnapshot(); } else if (entityType.GetNavigations().Any(n => n.IsNonNotifyingCollection(entry))) { entry.EnsureRelationshipSnapshot(); } var changing = entry.Entity as INotifyPropertyChanging; if (changing != null) { changing.PropertyChanging += (s, e) => { var property = TryGetPropertyBase(entityType, e.PropertyName); if (property != null) { _notifier.PropertyChanging(entry, property); } }; } var changed = entry.Entity as INotifyPropertyChanged; if (changed != null) { changed.PropertyChanged += (s, e) => { var property = TryGetPropertyBase(entityType, e.PropertyName); if (property != null) { _notifier.PropertyChanged(entry, property); } }; } return(entry); }