Пример #1
0
        public void OnPostInsert(PostInsertEvent evt)
        {
            String entityName = evt.Persister.EntityName;

            if (verCfg.EntCfg.IsVersioned(entityName)) {
                AuditSync verSync = verCfg.AuditSyncManager.get(evt.Session);

                IAuditWorkUnit workUnit = new AddWorkUnit(evt.Session, evt.Persister.EntityName, verCfg,
                        evt.Id, evt.Persister, evt.State);
                verSync.AddWorkUnit(workUnit);

                if (workUnit.ContainsWork()) {
                    GenerateBidirectionalCollectionChangeWorkUnits(verSync, evt.Persister, entityName, evt.State,
                            null, evt.Session);
                }

                //Simon - TODO - Correct/clarify this:
                // it appears that the AuditSyncManager's transaction.RegisterSynchronization(verSync);
                // does not lead to calling the verSync's synchronization methods (Before and AfterCompletion
                // so I will call this manually. The problem that I found is that AdoTransaction's Commit method
                // is not called at all. Could this be because of Spring.NET?
                // When corrected, change also in AuditSync the Flush in BeforeCompletion.
                //verSync.BeforeCompletion();
            }
        }
Пример #2
0
        public virtual void OnPostInsert(PostInsertEvent evt)
        {
            var entityName = evt.Persister.EntityName;
            if (!VerCfg.EntCfg.IsVersioned(entityName)) return;

            var auditProcess = VerCfg.AuditProcessManager.Get(evt.Session);
            var workUnit = new AddWorkUnit(evt.Session, evt.Persister.EntityName, VerCfg,
                                                                        evt.Id, evt.Persister, evt.State);
            auditProcess.AddWorkUnit(workUnit);
            if (workUnit.ContainsWork())
            {
                GenerateBidirectionalCollectionChangeWorkUnits(auditProcess, evt.Persister, entityName, evt.State,
                                                                        null, evt.Session);
            }
        }
Пример #3
0
 public override IAuditWorkUnit Merge(AddWorkUnit second)
 {
     return(Toolz.ArraysEqual(second.State, state)
                         ? null
                         : new ModWorkUnit(SessionImplementor, EntityName, VerCfg, EntityId, entityPersister, second.State, state));
 }
Пример #4
0
 public override IAuditWorkUnit Merge(AddWorkUnit second)
 {
     return(this);
 }
 public abstract IAuditWorkUnit Merge(AddWorkUnit second);
 public override IAuditWorkUnit Merge(AddWorkUnit second)
 {
     return null;
 }
 public abstract IAuditWorkUnit Merge(AddWorkUnit second);
Пример #8
0
 public override IAuditWorkUnit Merge(AddWorkUnit second)
 {
     return(Merge(this, NestedWorkUnit, second));
 }
 public override IAuditWorkUnit Merge(AddWorkUnit second)
 {
     return Merge(this, NestedWorkUnit, second);
 }
Пример #10
0
 public override IAuditWorkUnit Merge(AddWorkUnit second)
 {
     //needed to get onetoone pk work. What should happen with "normal" entities?
     return new ModWorkUnit(SessionImplementor, EntityName, VerCfg, EntityId, entityPersister, second.State, state);
 }