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)); }
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)); }
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)); }
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()); }
public virtual TEntity FirstOrDefault(Action <EFRepositoryQueryBuilder <TEntity> > queryBuilderAction = null) { var queryBuilder = new EFRepositoryQueryBuilder <TEntity>(DbContext.Set <TEntity>()); queryBuilderAction?.Invoke(queryBuilder); return(queryBuilder.Build().FirstOrDefault()); }
public virtual bool Any(Action <EFRepositoryQueryBuilder <TEntity> > queryBuilderAction = null) { var queryBuilder = new EFRepositoryQueryBuilder <TEntity>(DbContext.Set <TEntity>()); queryBuilderAction?.Invoke(queryBuilder); return(queryBuilder.Build().Any()); }
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)); }
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)); }
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)); }