//
 public T getSingle(Expression <Func <T, bool> > whereCondition, Func <IQueryable <T>, IOrderedQueryable <T> > orderBy = null)
 {
     try {
         var query = _objectset.AsExpandable().Where(whereCondition);
         if (orderBy != null)
         {
             return(orderBy(query).FirstOrDefault <T>());
         }
         else
         {
             return(query.FirstOrDefault <T>());
         }
     } catch (Exception ex) {
         UtilLog.saveError(ex, this._objectset.ToString());
     }
     return(null);
 }
示例#2
0
 /// <summary>
 /// Retorna todos os objetos que satisfaçam a cláusula passada
 /// </summary>
 public IQueryable <E> ObterSomenteComPredicado(Expression <Func <E, bool> > where)
 {
     try
     {
         return(dbSet.AsExpandable().Where(where));
     }
     catch (Exception)
     {
         return(null);
     }
 }
示例#3
0
 public int Count(Expression <Func <T, bool> > expression)
 {
     return(Set.AsExpandable().Where(expression).Count());
 }
示例#4
0
 public IEnumerable <T> FindBy(Expression <Func <T, bool> > predicate)
 {
     return(dbSet.AsExpandable().Where(predicate));
 }
示例#5
0
 public IEnumerable <T> FindBy(System.Linq.Expressions.Expression <Func <T, bool> > predicate)
 {
     return(DbSet.AsExpandable().Where(predicate));
 }