예제 #1
0
 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");
 }
예제 #2
0
 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");
 }