Exemple #1
0
        public LazyDataLoader(Expression <Func <S, bool> > whereClause, IApplicationDataSession dataSession, int defaultChunkSize = 30, int?totalRecords = null)
        {
            _defaultChunkSize = defaultChunkSize;
            _whereClause      = whereClause;
            _dataSession      = dataSession;

            _totalRecords = totalRecords;
        }
Exemple #2
0
        public LazyDataLoader(Expression <Func <T, bool> > whereClause, IApplicationDataSession dataSession, DataConverter <S, T> converter = null, int defaultChunkSize = 30, int?totalRecords = null)
        {
            _defaultChunkSize = defaultChunkSize;
            _whereClause      = whereClause;
            _dataSession      = dataSession;

            _totalRecords = totalRecords;

            if (converter == null && typeof(S) != typeof(T))
            {
                throw new ArgumentException("if a converter is not given, then S must be the same type as T.");
            }

            _converter = converter ?? DefaultDataConverter;
        }