Пример #1
0
        ///// <summary>
        ///// 缓存计数
        ///// </summary>
        ///// <param name="sqlTool">SQL操作工具</param>
        ///// <param name="getKey">缓存关键字获取器</param>
        ///// <param name="group">数据分组</param>
        //protected memberCounterBase(fastCSharp.emit.sqlTable.sqlTool<valueType, modelType> sqlTool, int group, Expression<Func<modelType, keyType>> getKey
        //    , Func<keyType, targetType> getValue, Expression<Func<targetType, keyValue<valueType, int>>> member)
        //    : this(sqlTool, group, getKey == null ? null : getKey.Compile(), getValue, member)
        //{
        //    sqlTool.SetSelectMember(getKey);
        //}
        /// <summary>
        /// 缓存计数
        /// </summary>
        /// <param name="sqlTool">SQL操作工具</param>
        /// <param name="getKey">缓存关键字获取器</param>
        /// <param name="group">数据分组</param>
        protected memberCounter(whole.events.cache <valueType, modelType, memberCacheType> cache, int group, Func <modelType, keyType> getKey
                                , Func <keyType, targetType> getByKey, Func <valueType, targetType> getValue, Expression <Func <targetType, keyValue <valueType, int> > > member)
            : base(cache.SqlTool, group)
        {
            if (getKey == null || getByKey == null || getValue == null || member == null)
            {
                log.Error.Throw(log.exceptionType.Null);
            }
            memberExpression <targetType, keyValue <valueType, int> > expression = new memberExpression <targetType, keyValue <valueType, int> >(member);

            if (expression.Field == null)
            {
                log.Error.Throw(log.exceptionType.ErrorOperation);
            }
            GetKey        = getKey;
            GetByKey      = getByKey;
            this.GetValue = getValue;
            GetMember     = expression.GetMember;
            setMember     = expression.SetMember;

            cache.SqlTool.OnUpdatedLock += onUpdated;
            //cache.OnUpdated += onUpdated;
            cache.OnDeleted += onDeleted;
        }
Пример #2
0
 /// <summary>
 /// 自增id标识缓存计数器
 /// </summary>
 /// <param name="sqlTool">SQL操作工具</param>
 /// <param name="group">数据分组</param>
 public memberPrimaryKeyCounter(whole.events.cache <valueType, modelType, memberCacheType> cache
                                , Func <modelType, keyType> getKey, Func <keyType, targetType> getByKey, Func <valueType, targetType> getValue
                                , Expression <Func <targetType, keyValue <valueType, int> > > member, int group = 1)
     : base(cache, group, getKey, getByKey, getValue, member)
 {
 }
Пример #3
0
 /// <summary>
 /// 自增id标识缓存计数器
 /// </summary>
 /// <param name="sqlTool">SQL操作工具</param>
 /// <param name="group">数据分组</param>
 public memberIdentityCounter32(whole.events.cache <valueType, modelType, memberCacheType> cache
                                , Func <int, targetType> getByKey, Func <valueType, targetType> getValue, Expression <Func <targetType, keyValue <valueType, int> > > member, int group = 1)
     : base(cache, group, fastCSharp.emit.sqlModel <modelType> .GetIdentity32, getByKey, getValue, member)
 {
 }