private void LoadResults()
        {
            var query = _queryContainer.Compile();

            _queryContainer.AccessLayer.RaiseSelect(query);
            _enumerateDataRecords = _queryContainer.AccessLayer.EnumerateDataRecordsAsync(query);
        }
        /// <summary>
        ///     Wraps the Existing command into a DataPager for the underlying Database
        ///     <example>
        ///     </example>
        /// </summary>
        /// <returns></returns>
        public static IWrapperDataPager <TPoco, TVm> AsPagerViewModel <TPoco, TVm>(this IQueryContainer query, int pageSize)
        {
            var targetQuery = query.Compile();
            var dbAccess    = query.AccessLayer.Database.CreatePager <TPoco, TVm>();

            dbAccess.BaseQuery = targetQuery;
            dbAccess.PageSize  = pageSize;
            return(dbAccess);
        }
        /// <summary>
        ///     Wraps the Existing command into a DataPager for the underlying Database
        ///     <example>
        ///     </example>
        /// </summary>
        /// <returns></returns>
        public static IDataPager AsPager <TPoco>(this IQueryContainer query, int pageSize)
        {
            var targetQuery = query.Compile();
            var dbAccess    = query.AccessLayer.Database.CreatePager <TPoco>();

            dbAccess.AppendedComands.Add(targetQuery);
            dbAccess.PageSize = pageSize;
            return(dbAccess);
        }
		internal QueryLazyEnumerator(IQueryContainer queryContainer, Type type)
		{
			_type = queryContainer.AccessLayer.GetClassInfo(type);
			_accessLayer = new DbAccessLayer(queryContainer.AccessLayer.Database);
			_accessLayer.Database.Connect(IsolationLevel.ReadCommitted);
			var command = queryContainer.Compile();
			queryContainer.AccessLayer.RaiseSelect(command);

			_executeReader = command.ExecuteReader();
		}
        private void OpenReader(IQueryContainer queryContainer)
        {
            _accessLayer.Database.Connect();
            var command = queryContainer.Compile();

            queryContainer.AccessLayer.RaiseSelect(command);
            try
            {
                _executeReader = command.ExecuteReader();
            }
            catch (Exception ex)
            {
                _accessLayer.RaiseFailedQuery(this, command, ex);
                throw;
            }
        }