コード例 #1
0
        public T InquiryDataWithMethod <T>(ArrayList info, FetchMethod <T> method)
            where T : class, new()
        {
            if (!this.Available)
            {
                return(null);
            }

            if (this.CacheEnabled)
            {
                object cachedValue = Cache.GetCachedObject(method, info);
                if (cachedValue != null && cachedValue is T)
                {
                    return(cachedValue as T);
                }
            }

            object result = method(DataSource, info);

            if (this.CacheEnabled)
            {
                Cache.CacheObject(method, info, result);
            }

            return(result as T);
        }
コード例 #2
0
        public T InquiryData <T>(ArrayList info)
            where T : class, new()
        {
            if (!FetchMethods.ContainsKey(typeof(T)))
            {
                return(null);
            }

            FetchMethod <T> method = FetchMethods[typeof(T)] as FetchMethod <T>;

            return(InquiryDataWithMethod(info, method));
        }
コード例 #3
0
 protected void RegisterMethod <T>(FetchMethod <T> method)
     where T : class, new()
 {
     FetchMethods[typeof(T)] = method;
 }