Пример #1
0
        static public Task <DbDataReader> ExecuteReader(IQuery query, bool onQueue = true)
        {
            var work = new WorkPackage <DbDataReader>(WorkType.Read, query);

            if (/*Config.DefaultCacheLevel == CacheLevel.Off ||*/ !onQueue)
            {
                return(work.DoWorkAsync());
            }
            else
            {
                GetWorker(query.DatabaseProvider).Enqueue(work);
                return(work.AwaitResult());
            }
        }
Пример #2
0
        public static Task <T> ExecuteScalar <T>(Database database, bool onQueue, params IQuery[] queries)
        {
            var work = new WorkPackage <T>(WorkType.Scalar, queries);

            if (/*Config.DefaultCacheLevel == CacheLevel.Off ||*/ !onQueue)
            {
                return(work.DoWorkAsync());
            }
            else
            {
                GetWorker(database).Enqueue(work);
                return(work.AwaitResult());
            }

            //return Task<T>.Factory.StartNew(() => DbAccess.ExecuteScalar<T>(queries));
        }