/// <summary> /// Saves changes to a strong collection. /// </summary> /// <param name="list"></param> private void SaveChangesToStrongCollection(IList list) { if (list == null) { throw new ArgumentNullException("list"); } if (!(list is IEntityType)) { throw new InvalidOperationException("List does not support IEntityType."); } EntityType entityType = ((IEntityType)list).EntityType; if (entityType == null) { throw new ArgumentNullException("entityType"); } // persistence... IEntityPersistence persistence = entityType.Persistence; if (persistence == null) { throw new ArgumentNullException("persistence"); } // get all work... WorkUnitCollection units = new WorkUnitCollection(); foreach (object entity in list) { units.AddRange(persistence.GetWorkUnits(entity)); } // anything to do? if (units.Count == 0) { return; } // process that lot... IWorkUnitProcessor processor = new WorkUnitProcessor(); if (processor == null) { throw new InvalidOperationException("processor is null."); } processor.Process(units); // reconcile... persistence.ReconcileWorkUnitProcessorResults(units); }
private void SaveChangesInternal(object entity, bool outsideTransaction, ITimingBucket timings) { if (entity == null) { throw new ArgumentNullException("entity"); } if (timings == null) { timings = NullTimingBucket.Instance; } // check... if (EntityType == null) { throw new ArgumentNullException("EntityType"); } this.EntityType.AssertIsOfType(entity); // gets the work units... WorkUnitCollection units = null; using (timings.GetTimer("GetWorkUnits")) { units = this.GetWorkUnits(entity); if (units == null) { throw new ArgumentNullException("units"); } if (units.Count == 0) { return; } } // execute... WorkUnitProcessor processor = new WorkUnitProcessor(); using (var child = timings.GetChildBucket("Process")) processor.Process(units); //// mbr - 26-01-2006 - invoke the change register... //using (timings.GetTimer("Signal")) //{ // foreach (WorkUnit unit in units) // ChangeRegister.Current.ChangesCommitted(this.EntityType, entity, unit); //} }