public List <TData> GetList <TData>(ISelectSpecification <TEntity, TData> specification) { return(_context .Set <TEntity>() .ApplaySelectSpecification(specification) .ToList()); }
public TData Get <TData>(ISelectSpecification <TEntity, TData> specification) { return(_context .Set <TEntity>() .ApplaySelectSpecification(specification) .FirstOrDefault()); }
public TData SingleOrDefault <TData>(ISelectSpecification <TEntity, TData> specification) { return(_context .Set <TEntity>() .AsNoTracking() .ApplaySelectSpecification(specification) .SingleOrDefault()); }
public Task <List <TData> > GetList <TData>(ISelectSpecification <TEntity, TData> specification) { return(_context .Set <TEntity>() .AsNoTracking() .ApplaySelectSpecification(specification) .ToListAsync()); }
public Task <TData> FirstOrDefault <TData>(ISelectSpecification <TEntity, TData> specification) { return(_context .Set <TEntity>() .AsNoTracking() .ApplaySelectSpecification(specification) .FirstOrDefaultAsync()); }
public static IQueryable <TData> ApplaySelectSpecification <TEntity, TData>(this IQueryable <TEntity> query, ISelectSpecification <TEntity, TData> specification) where TEntity : class, IBaseEntity { if (specification == null) { throw new ArgumentNullException($"Specification can not be null"); } if (specification.Select == null) { throw new Exception("Select can not be null"); } query = query.ApplayBaseSpecification(specification); return(query.Select(specification.Select)); }