private void SetReadOnlyEntity(IEventSource session, object entity) { if (session.FetchProfile != "merge") { EntityEntry entry = session.PersistenceContext.GetEntry(entity); entry.BackSetStatus(Status.ReadOnly); } }
public void OnDelete(DeleteEvent @event, ISet transientEntities) { var session = @event.Session; EntityEntry entry = session.PersistenceContext.GetEntry(@event.Entity); if (entry != null && entry.RowId is EntityTracer) { entry.BackSetStatus(Status.Loaded); } }
private void ResetReadOnlyEntity(IEventSource session, object entity) { EntityEntry entry = session.PersistenceContext.GetEntry(entity); if (entry != null && entry.Persister.IsMutable && entry.Status == Status.ReadOnly) { entry.BackSetStatus(Status.Loaded); CascadeOnUpdate(session, entry.Persister, entity); } }
public void OnDelete(DeleteEvent @event, ISet transientEntities) { var session = @event.Session; EntityEntry entry = session.PersistenceContext.GetEntry(@event.Entity); if (entry != null && entry.Persister.IsMutable && entry.Status == Status.ReadOnly) { entry.BackSetStatus(Status.Loaded); } }
public void OnPostLoad(PostLoadEvent @event) { var trackableEntity = @event.Entity as INotifyPropertyChanged; if (trackableEntity != null) { EntityEntry entry = @event.Session.PersistenceContext.GetEntry(@event.Entity); entry.BackSetStatus(Status.ReadOnly); entry.BackSetTracer(new EntityTracer(entry, trackableEntity)); } }
public override void Cascade(IEventSource session, object child, string entityName, object anything, bool isCascadeDeleteEnabled) { if (NHibernateUtil.IsInitialized(child)) { object instance = session.PersistenceContext.Unproxy(child); EntityEntry entry = session.PersistenceContext.GetEntry(instance); if (entry != null && entry.Persister.IsMutable && entry.Status == Status.ReadOnly) { entry.BackSetStatus(Status.Loaded); } } }
public void OnPostLoad(PostLoadEvent @event) { EntityEntry entry = @event.Session.PersistenceContext.GetEntry(@event.Entity); entry.BackSetStatus(Status.ReadOnly); }
public EntityTracer(EntityEntry entry, INotifyPropertyChanged trackableEntity) { trackableEntity.PropertyChanged += (sender, e) => entry.BackSetStatus(Status.Loaded); }