public override IAuditWorkUnit Merge(CollectionChangeWorkUnit second) { return(this); }
private void GenerateFakeBidirecationalRelationWorkUnits(AuditProcess auditProcess, IPersistentCollection newColl, object oldColl, string collectionEntityName, string referencingPropertyName, AbstractCollectionEvent evt, RelationDescription rd) { // First computing the relation changes var collectionChanges = VerCfg.EntCfg[collectionEntityName].PropertyMapper .MapCollectionChanges(referencingPropertyName, newColl, oldColl, evt.AffectedOwnerIdOrNull); // Getting the id mapper for the related entity, as the work units generated will corrspond to the related // entities. var relatedEntityName = rd.ToEntityName; var relatedIdMapper = VerCfg.EntCfg[relatedEntityName].IdMapper; // For each collection change, generating the bidirectional work unit. foreach (var changeData in collectionChanges) { var relatedObj = changeData.GetChangedElement(); var relatedId = relatedIdMapper.MapToIdFromEntity(relatedObj); var revType = (RevisionType)changeData.Data[VerCfg.AuditEntCfg.RevisionTypePropName]; // This can be different from relatedEntityName, in case of inheritance (the real entity may be a subclass // of relatedEntityName). var realRelatedEntityName = evt.Session.BestGuessEntityName(relatedObj); // By default, the nested work unit is a collection change work unit. var nestedWorkUnit = new CollectionChangeWorkUnit(evt.Session, realRelatedEntityName, VerCfg, relatedId, relatedObj); auditProcess.AddWorkUnit(new FakeBidirectionalRelationWorkUnit(evt.Session, realRelatedEntityName, VerCfg, relatedId, referencingPropertyName, evt.AffectedOwnerOrNull, rd, revType, changeData.GetChangedElementIndex(), nestedWorkUnit)); } // We also have to generate a collection change work unit for the owning entity. auditProcess.AddWorkUnit(new CollectionChangeWorkUnit(evt.Session, collectionEntityName, VerCfg, evt.AffectedOwnerIdOrNull, evt.AffectedOwnerOrNull)); }
public abstract IAuditWorkUnit Merge(CollectionChangeWorkUnit second);
public override IAuditWorkUnit Merge(CollectionChangeWorkUnit second) { return null; }
public override IAuditWorkUnit Merge(CollectionChangeWorkUnit second) { second.MergeCollectionModifiedData(data); return(this); }