Beispiel #1
0
            /// <summary>
            ///
            /// </summary>
            /// <param name="reader"></param>
            /// <param name="dbFields">The list of the <see cref="DbField"/> objects to be used.</param>
            /// <param name="dbSetting">The instance of <see cref="IDbSetting"/> object to be used.</param>
            /// <returns></returns>
            internal static Func <DbDataReader, TResult> Get(DbDataReader reader,
                                                             IEnumerable <DbField> dbFields = null,
                                                             IDbSetting dbSetting           = null)
            {
                var key = GetKey(reader);

                if (cache.TryGetValue(key, out var result) == false)
                {
                    result = FunctionFactory.CompileDataReaderToType <TResult>(reader, dbFields, dbSetting);
                    cache.TryAdd(key, result);
                }
                return(result);
            }