예제 #1
0
 /// <summary>
 /// 当前对象(包括继承)的属性触发通知事件
 /// </summary>
 /// <param name="sender">触发事件源</param>
 /// <param name="eventArgs"></param>
 protected virtual void Notify(object sender, CacheItemEventArgs eventArgs)
 {
     if (!_isDisableEvent)
     {
         _hasChanged = true;
         if (ItemEvent != null)
         {
             ItemEvent.Notify(sender, eventArgs);
         }
     }
 }
예제 #2
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)
     {
         _hasChanged = true;
         if (ItemEvent != null)
         {
             ItemEvent.Notify(sender, eventArgs);
         }
     }
 }
예제 #3
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);
         }
     }
 }
예제 #4
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);
         }
     }
 }