Beispiel #1
0
 /// <summary>
 /// Loads the old values.
 /// </summary>
 private void loadOldValues()
 {
     if (isInLoad)
     {
         return;
     }
     isInLoad = true;
     try
     {
         OldValues.Clear();
         var session   = ((ISessionProvider)TargetObject).Session;
         var classInfo = session.GetClassInfo(TargetObject);
         foreach (var member in classInfo.Members)
         {
             if (!(member is ServiceField) && !member.IsCollection &&
                 !TrackedObjectBag.SessionData.Collector.IsNotForProtocol(classInfo.ClassType) &&
                 !TrackedObjectBag.SessionData.Collector.IsNotForProtocol(classInfo.ClassType, member.Name) &&
                 !member.Owner.ClassType.IsAssignableFrom(typeof(XPBaseObject)))
             {
                 OldValues.Add(member.Name, member.GetValue(TargetObject));
             }
         }
     }
     finally
     {
         isInLoad = false;
     }
 }
Beispiel #2
0
 public void SaveCurrentState()
 {
     if (IsSaveCurrentState)
     {
         return;
     }
     else
     {
         OldValues.Clear();
         IsSaveCurrentState = true;
     }
     foreach (var item in Items)
     {
         if (item is IResettable r && !ResetExeclusions.Contains(r))
         {
             r.SaveCurrentState();
         }
     }
     foreach (var item in InternalDictionary)
     {
         if (!PropertyResetExeclusions.Contains(item.Key) && item.Value.Value is IResettable ro && !ResetExeclusions.Contains(ro))
         {
             ro.SaveCurrentState();
         }
     }
     IsSaveCurrentState = false;
 }
Beispiel #3
0
 public void Reset()
 {
     if (IsReset)
     {
         return;
     }
     else
     {
         foreach (var item in OldValues)
         {
             if (item.Key == nameof(Count))
             {
                 continue;
             }
             SetPropertyValue(item.Value, item.Key);
         }
         OldValues.Clear();
         IsReset = true;
     }
     foreach (var item in Items)
     {
         if (item is IResettable r && !ResetExeclusions.Contains(r))
         {
             r.Reset();
         }
     }
     foreach (var item in InternalDictionary)
     {
         if (!PropertyResetExeclusions.Contains(item.Key) && item.Value.Value is IResettable ro && !ResetExeclusions.Contains(ro))
         {
             ro.Reset();
         }
     }
     IsReset = false;
 }
Beispiel #4
0
 /// <summary>
 /// Closes this instance.
 /// </summary>
 public void Close()
 {
     unSubscribeFromCollectionChanges();
     OldValues.Clear();
 }