Ejemplo n.º 1
0
        public async Task <T> GetByIdWithInclude(Expression <Func <T, bool> > predicate, params Expression <Func <T, object> >[] includes)
        {
            var query = _context.Set <T>().Where(predicate);

            return(await includes.Aggregate(query, (current, includeProperty) => current.Include(includeProperty)).FirstAsync());
        }
Ejemplo n.º 2
0
 public GenericRepository(PlaneBookingContext _context)
 {
     this._context = _context;
     entity        = _context.Set <T>();
 }