public IEnumerable <T> GetManyByPredicate(Expression <Func <T, bool> > predicate) { if (predicate != null) { Expression <Func <U, T> > mapper = ExpressionMapper.ToDal((dynamic)context.Set <U>()); return(context.Set <U>().Select(mapper).Where(predicate)); } throw new ArgumentNullException(nameof(predicate), "Predicate is null"); }
public T GetByPredicate(Expression <Func <T, bool> > predicate) { if (predicate != null) { Expression <Func <U, T> > mapper = ExpressionMapper.ToDal((dynamic)context.Set <U>()); return(context.Set <U>().Select(mapper).FirstOrDefault(predicate)); } throw new ArgumentNullException(nameof(predicate), "Predicate is null"); }