예제 #1
0
 internal void PrepareToSave(Abstract1CEntity owner, List <Abstract1CEntity> entitiesToSave)
 {
     if (observedValues != null)
     {
         foreach (var item in observedValues)
         {
             if (Changed != null && Changed.ContainsKey(item.Key))
             {
                 continue;
             }
             var value  = item.Value;
             var entity = value.value as Abstract1CEntity;
             if (entity != null)
             {
                 entity.Controller.PrepareToSave(entity, entitiesToSave);
                 continue;
             }
             var list = value.value as IList;
             if (list != null)
             {
                 foreach (Abstract1CEntity e in list)
                 {
                     e.Controller.PrepareToSave(e, entitiesToSave);
                 }
                 var syncList = SyncList.Compare(value.originalList, list);
                 if (syncList.Commands.Count > 0)
                 {
                     MarkAsChanged(item.Key, syncList);
                 }
             }
         }
         observedValues = null;
     }
     if (!EntityHelpers.IsTableSection(owner.GetType()) && IsDirty)
     {
         entitiesToSave.Add(owner);
     }
 }