Exemple #1
0
            /// <summary>
            ///
            /// </summary>
            /// <param name="cacheKey"></param>
            /// <param name="inputFields"></param>
            /// <param name="outputFields"></param>
            /// <param name="batchSize"></param>
            /// <param name="dbSetting"></param>
            /// <returns></returns>
            internal static Action <DbCommand, IList <TEntity> > Get(string cacheKey,
                                                                     IEnumerable <DbField> inputFields,
                                                                     IEnumerable <DbField> outputFields,
                                                                     int batchSize,
                                                                     IDbSetting dbSetting = null)
            {
                var key = GetKey(cacheKey, inputFields, outputFields, batchSize);

                if (cache.TryGetValue(key, out var func) == false)
                {
                    if (typeof(TEntity).IsDictionaryStringObject())
                    {
                        func = FunctionFactory.CompileDictionaryStringObjectListDbParameterSetter <TEntity>(inputFields, batchSize, dbSetting);
                    }
                    else
                    {
                        func = FunctionFactory.CompileDataEntityListDbParameterSetter <TEntity>(inputFields, outputFields, batchSize, dbSetting);
                    }
                    cache.TryAdd(key, func);
                }
                return(func);
            }