/// <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); } } }
/// <summary> /// 当前对象中的属性包含的子类触发通知事件 /// </summary> /// <param name="sender">触发事件源</param> /// <param name="eventArgs"></param> protected virtual void NotifyByChildren(object sender, CacheItemEventArgs eventArgs) { if (!_isDisableEvent) { _hasChanged = true; if (ItemEvent != null) { if (string.IsNullOrEmpty(eventArgs.PropertyName)) { eventArgs.PropertyName = PropertyName; } ItemEvent.Notify(sender, eventArgs); } } }
/// <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(); } }
/// <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); } } }
/// <summary> /// 解除变更事件通知 /// </summary> /// <param name="sender"></param> /// <param name="eventArgs"></param> internal abstract void UnChangeNotify(object sender, CacheItemEventArgs eventArgs);