Beispiel #1
0
 public Func <object, SqlParameterCollection> GetToSqlParametersFunc(Type sourceType, bool ignoreCase)
 {
     if (ignoreCase)
     {
         return(CacheUtil <TypeWrapper <RequestContext, IgnoreCaseType>, Type, Func <object, SqlParameterCollection> >
                .GetOrAdd(sourceType, _ => RequestConvertCacheType.GetConvert(_, ignoreCase)));
     }
     return(CacheUtil <RequestContext, Type, Func <object, SqlParameterCollection> >
            .GetOrAdd(sourceType, _ => RequestConvertCacheType.GetConvert(_, ignoreCase)));;
 }
Beispiel #2
0
        public Func <object, SqlParameterCollection> GetToSqlParametersFunc(Type sourceType, bool ignoreNameCase)
        {
            string key = GenerateCacheKey(sourceType, ignoreNameCase);

            if (!_cachedConvert.ContainsKey(key))
            {
                lock (this)
                {
                    if (!_cachedConvert.ContainsKey(key))
                    {
                        var impl = RequestConvertCacheType.GetConvert(sourceType, ignoreNameCase);
                        _cachedConvert.Add(key, impl);
                    }
                }
            }
            return(_cachedConvert[key]);
        }