예제 #1
0
        public virtual IPagedListResult <TEntity> GetPagedList(Action <EFRepositoryQueryBuilder <TEntity> > queryBuilderAction = null, int pageNumber = 1, int pageSize = 20)
        {
            var queryBuilder = new EFRepositoryQueryBuilder <TEntity>(DbContext.Set <TEntity>());

            queryBuilderAction?.Invoke(queryBuilder);

            return(queryBuilder.Build().ToPagedList(pageNumber, pageSize));
        }
예제 #2
0
        public virtual Task <TEntity> FirstOrDefaultAsync(Action <EFRepositoryQueryBuilder <TEntity> > queryBuilderAction = null, CancellationToken cancellationToken = default)
        {
            var queryBuilder = new EFRepositoryQueryBuilder <TEntity>(DbContext.Set <TEntity>());

            queryBuilderAction?.Invoke(queryBuilder);

            return(queryBuilder.Build().FirstOrDefaultAsync(cancellationToken));
        }
예제 #3
0
        public virtual Task <TResult> FirstOrDefaultResultAsync <TResult>(Expression <Func <TEntity, TResult> > selector, Action <EFRepositoryQueryBuilder <TEntity> > queryBuilderAction = null, CancellationToken cancellationToken = default)
        {
            var queryBuilder = new EFRepositoryQueryBuilder <TEntity>(DbContext.Set <TEntity>());

            queryBuilderAction?.Invoke(queryBuilder);

            return(queryBuilder.Build(selector).FirstOrDefaultAsync(cancellationToken));
        }
예제 #4
0
        public virtual TResult FirstOrDefaultResult <TResult>(Expression <Func <TEntity, TResult> > selector, Action <EFRepositoryQueryBuilder <TEntity> > queryBuilderAction = null)
        {
            var queryBuilder = new EFRepositoryQueryBuilder <TEntity>(DbContext.Set <TEntity>());

            queryBuilderAction?.Invoke(queryBuilder);

            return(queryBuilder.Build(selector).FirstOrDefault());
        }
예제 #5
0
        public virtual TEntity FirstOrDefault(Action <EFRepositoryQueryBuilder <TEntity> > queryBuilderAction = null)
        {
            var queryBuilder = new EFRepositoryQueryBuilder <TEntity>(DbContext.Set <TEntity>());

            queryBuilderAction?.Invoke(queryBuilder);

            return(queryBuilder.Build().FirstOrDefault());
        }
예제 #6
0
        public virtual bool Any(Action <EFRepositoryQueryBuilder <TEntity> > queryBuilderAction = null)
        {
            var queryBuilder = new EFRepositoryQueryBuilder <TEntity>(DbContext.Set <TEntity>());

            queryBuilderAction?.Invoke(queryBuilder);

            return(queryBuilder.Build().Any());
        }
예제 #7
0
        public virtual Task <IPagedListResult <TResult> > GetPagedListResultAsync <TResult>(Expression <Func <TEntity, TResult> > selector, Action <EFRepositoryQueryBuilder <TEntity> > queryBuilderAction = null, int pageNumber = 1,
                                                                                            int pageSize = 20, CancellationToken cancellationToken = default)
        {
            var queryBuilder = new EFRepositoryQueryBuilder <TEntity>(DbContext.Set <TEntity>());

            queryBuilderAction?.Invoke(queryBuilder);

            return(queryBuilder.Build(selector).ToPagedListAsync(pageNumber, pageSize, cancellationToken));
        }
예제 #8
0
        public virtual IPagedListModel <TResult> GetPagedListResult <TResult>(Expression <Func <TEntity, TResult> > selector, Action <EFRepositoryQueryBuilder <TEntity> > queryBuilderAction = null, int pageNumber = 1,
                                                                              int pageSize = 20)
        {
            var queryBuilder = new EFRepositoryQueryBuilder <TEntity>(DbContext.Set <TEntity>());

            queryBuilderAction?.Invoke(queryBuilder);

            return(queryBuilder.Build(selector).ToPagedList(pageNumber, pageSize));
        }
예제 #9
0
        public virtual Task <IPagedListModel <TEntity> > GetPagedListAsync(Action <EFRepositoryQueryBuilder <TEntity> > queryBuilderAction = null, int pageNumber = 1, int pageSize = 20,
                                                                           CancellationToken cancellationToken = default)
        {
            var queryBuilder = new EFRepositoryQueryBuilder <TEntity>(DbContext.Set <TEntity>());

            queryBuilderAction?.Invoke(queryBuilder);

            return(queryBuilder.Build().ToPagedListAsync(pageNumber, pageSize, cancellationToken));
        }