Пример #1
0
        public member(ILoadCache <valueType, modelType> cache, Func <modelType, keyType> getKey, Func <keyType, targetType> getValue, Expression <Func <targetType, cacheType> > member)
#endif
        {
            if (cache == null || getKey == null || getValue == null || member == null)
            {
                log.Error.Throw(log.exceptionType.Null);
            }
            sql.memberExpression <targetType, cacheType> expression = new sql.memberExpression <targetType, cacheType>(member);
            if (expression.Field == null)
            {
                log.Error.Throw(log.exceptionType.ErrorOperation);
            }
            this.cache    = cache;
            this.getKey   = getKey;
            this.getValue = getValue;
            getMember     = expression.GetMember;
            setMember     = expression.SetMember;
        }
Пример #2
0
        public memberDictionary(ILoadCache <valueType, modelType> cache, Func <modelType, keyType> getKey, Func <keyType, targetType> getValue, Expression <Func <targetType, Dictionary <valueKeyType, valueType> > > member, Func <modelType, valueKeyType> getValueKey, bool isReset = true)
#endif
            : base(cache, getKey, getValue, member)
        {
            if (getValueKey == null)
            {
                log.Error.Throw(log.exceptionType.Null);
            }
            this.getValueKey = getValueKey;

            if (isReset)
            {
                cache.OnInserted += onInserted;
                cache.OnUpdated  += onUpdated;
                cache.OnDeleted  += onDeleted;
                reset();
            }
        }
Пример #3
0
        /// <summary>
        /// 分组列表缓存
        /// </summary>
        /// <param name="cache">整表缓存</param>
        /// <param name="getKey">分组字典关键字获取器</param>
        /// <param name="getValue">获取目标对象委托</param>
        /// <param name="member">缓存字段表达式</param>
#if NOJIT
        public member(ILoadCache cache, Func <modelType, keyType> getKey, Func <keyType, targetType> getValue, Expression <Func <targetType, cacheType> > member)
Пример #4
0
        /// <summary>
        /// 分组字典缓存
        /// </summary>
        /// <param name="cache">整表缓存</param>
        /// <param name="getKey">分组字典关键字获取器</param>
        /// <param name="getValue">获取目标对象委托</param>
        /// <param name="member">缓存字段表达式</param>
        /// <param name="getValueKey">获取数据关键字委托</param>
        /// <param name="isReset">是否绑定事件并重置数据</param>
#if NOJIT
        public memberDictionary(ILoadCache cache, Func <modelType, keyType> getKey, Func <keyType, targetType> getValue, Expression <Func <targetType, Dictionary <valueKeyType, valueType> > > member, Func <modelType, valueKeyType> getValueKey, bool isReset = true)