Exemplo n.º 1
0
 public override void Restore()
 {
     if (Target != null)
     {
         Type         targetType = Target.GetType();
         PropertyInfo pI         = targetType.GetProperty(PropertyName);
         if (pI != null)
         {
             if (pI.CanWrite)
             {
                 pI.SetValue(Target, PropertyValue, null);
             }
             else if (Target is IDeletable && PropertyName == "IsDeleted")
             {
                 IDeletable deletable = (IDeletable)Target;
                 if ((bool)PropertyValue == true)
                 {
                     deletable.Delete();
                 }
                 else
                 {
                     deletable.Undelete();
                 }
             }
         }
     }
 }