Пример #1
0
 /// <summary>
 /// 当前对象中的属性包含的子类触发通知事件
 /// </summary>
 /// <param name="sender">触发事件源</param>
 /// <param name="eventArgs"></param>
 protected virtual void NotifyByChildren(object sender, CacheItemEventArgs eventArgs)
 {
     if (!_isDisableEvent && (IsInCache || !(this is AbstractEntity)))
     {
         _hasChanged = true;
         if (ItemEvent != null)
         {
             if (string.IsNullOrEmpty(eventArgs.PropertyName))
             {
                 eventArgs.PropertyName = PropertyName;
             }
             ItemEvent.Notify(sender, eventArgs);
         }
     }
 }
Пример #2
0
 /// <summary>
 /// 触发UnChange事件通知
 /// </summary>
 internal override void UnChangeNotify(object sender, CacheItemEventArgs eventArgs)
 {
     if (ChildrenEvent != null)
     {
         ChildrenEvent.NotifyAll(sender, eventArgs);
     }
     if (!eventArgs.HasChanged)
     {
         _hasChanged = false;
     }
     if (eventArgs.ChangeType == CacheItemChangeType.DisableEvent)
     {
         SetDisableEvent();
     }
 }
Пример #3
0
 /// <summary>
 /// 当前对象(包括继承)的属性触发通知事件
 /// </summary>
 /// <param name="sender">触发事件源</param>
 /// <param name="eventArgs"></param>
 protected virtual void Notify(object sender, CacheItemEventArgs eventArgs)
 {
     //modify reason:调用ExclusiveModify方法多个属性被修改时,修改状态延后通知,减少频繁同步数据
     if (!_isDisableEvent && !IsModifying && (IsInCache || !(this is AbstractEntity)))
     {
         IItemChangeEvent val;
         if ((val = sender as IItemChangeEvent) != null && !val.IsInCache)
         {
             val.IsInCache = true;
         }
         _hasChanged = true;
         if (ItemEvent != null)
         {
             ItemEvent.Notify(sender, eventArgs);
         }
     }
 }
Пример #4
0
 /// <summary>
 /// 解除变更事件通知
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="eventArgs"></param>
 internal abstract void UnChangeNotify(object sender, CacheItemEventArgs eventArgs);