예제 #1
0
        /// <summary>
        /// 设置变更的属性
        /// </summary>
        /// <param name="propertyName"></param>
        public void SetChangeProperty(string propertyName)
        {
            IItemChangeEvent val = null;

            try
            {
                val = GetAccessor()[propertyName] as IItemChangeEvent;
            }
            catch (Exception ex)
            {
                try
                {
                    val = this[propertyName] as IItemChangeEvent;
                }
                catch
                {
                    throw new Exception("Get property:" + _schema.EntityName + "." + propertyName, ex);
                }
            }
            if (val != null)
            {
                val.PropertyName = propertyName;
                if (IsReadOnly)
                {
                    val.DisableChildNotify();
                }
                AddChildrenListener(val);
            }
            Notify(this, CacheItemChangeType.Modify, propertyName);
            if (val != null)
            {
                val.IsInCache = true;
            }
        }
예제 #2
0
        /// <summary>
        /// 绑定事件且通知
        /// </summary>
        /// <param name="obj"></param>
        protected void BindAndNotify(object obj)
        {
            IItemChangeEvent val = obj as IItemChangeEvent;

            if (val != null)
            {
                val.PropertyName = PropertyName;
                AddChildrenListener(val);
            }
            Notify(this, CacheItemChangeType.Modify, PropertyName);
            if (val != null)
            {
                val.IsInCache = true;
            }
        }
예제 #3
0
        /// <summary>
        /// 绑定事件且通知
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="propertyName"></param>
        protected void BindAndChangeProperty(object obj, string propertyName)
        {
            IItemChangeEvent val = obj as IItemChangeEvent;

            if (val != null)
            {
                val.PropertyName = propertyName;
                if (IsReadOnly)
                {
                    val.DisableChildNotify();
                }
                AddChildrenListener(val);
            }
            Notify(this, CacheItemChangeType.Modify, propertyName);
            if (val != null)
            {
                val.IsInCache = true;
            }
        }