Пример #1
0
 public override void UpdateProperty(object sender, string propname, object oldvalue, object value, Type proptype, Type reftype, bool isVirtual)
 {
     base.UpdateProperty(sender, propname, oldvalue, value, proptype, reftype, isVirtual);
     if (sender is MObj && IsLockUpdates)
     {
         if (reftype != null && MainDic.ContainsKey(reftype))
         {
             MainDic.AddFutureRef(reftype, value);
         }
     }
     else if (!isVirtual)
     {
         if (Updates.LastAdapter != null && Updates.LastAdapter.Obj == sender)
         {
             if (!Updates.LastAdapter.PropNames.Contains(propname))
             {
                 Updates.LastAdapter.PropNames.Add(propname);
             }
         }
         else if (sender is MEDMObj)
         {
             MUpdateAdapter ua = new MUpdateAdapter(MUpdateOperation.Update, (sender as MEDMObj));
             ua.PropNames.Add(propname);
             Updates.Add(ua);
         }
         if (sender is MObj)
         {
             (sender as MObj).Invalidate();
         }
     }
 }
Пример #2
0
        public override void DeleteObject(MEDMObj obj)
        {
            MUpdateAdapter ua = new MUpdateAdapter(MUpdateOperation.Delete, obj);

            Updates.Add(ua);
            obj.Invalidate();
        }
Пример #3
0
        public override MEDMObj CreateObject(Type t)
        {
            /*
             * if (!IsLockUpdates)
             * {
             *  MUpdateAdapter ua = new MUpdateAdapter(MUpdateOperation.Create, obj);
             *  Updates.Add(ua);
             * }
             */

            MEDMObj obj = null;

            obj = MainDic.CreateObj(t);

            MUpdateAdapter ua = new MUpdateAdapter(MUpdateOperation.Create, obj);

            Updates.Add(ua);
            //Save(null);

            LockUpdates++;
            try
            {
                //obj.SetId(GetNewId(t));
                MainDic.AddObj(obj);
            }
            finally
            {
                LockUpdates--;
            }

            return(obj);
        }