public virtual TEntity FirstOrDefaultActive(Expression <Func <TEntity, bool> > predicate)
 {
     if (typeof(IActivable).IsAssignableFrom(typeof(TEntity)))
     {
         Expression <Func <TEntity, bool> > node = (TEntity q) => ((IActivable)q).Active;
         node = (Expression <Func <TEntity, bool> >)RemoveCastsVisitor.Visit(node);
         return(Queryable.FirstOrDefault <TEntity>(Queryable.Where <TEntity>((IQueryable <TEntity>) this.dbSet, predicate), node));
     }
     return(this.FirstOrDefault(predicate));
 }
 /// <summary>
 ///
 /// </summary>
 /// <returns></returns>
 public virtual IQueryable <TEntity> GetActive()
 {
     if (typeof(IActivable).IsAssignableFrom(typeof(TEntity)))
     {
         Expression <Func <TEntity, bool> > node = (TEntity q) => ((IActivable)q).Active;
         node = (Expression <Func <TEntity, bool> >)RemoveCastsVisitor.Visit(node);
         return(Queryable.Where <TEntity>(this.Get(), node));
     }
     return(this.Get());
 }
 public Task <TEntity> FirstOrDefaultActiveAsync()
 {
     if (typeof(IActivable).IsAssignableFrom(typeof(TEntity)))
     {
         Expression <Func <TEntity, bool> > node = (TEntity q) => ((IActivable)q).Active;
         node = (Expression <Func <TEntity, bool> >)RemoveCastsVisitor.Visit(node);
         return(QueryableExtensions.FirstOrDefaultAsync <TEntity>((IQueryable <TEntity>) this.dbSet, node));
     }
     return(this.FirstOrDefaultAsync());
 }
 public virtual TEntity FirstOrDefaultActive()
 {
     if (typeof(IDeleting).IsAssignableFrom(typeof(TEntity)))
     {
         Expression <Func <TEntity, bool> > node = (TEntity q) => ((IDeleting)q).IsDelete;
         node = (Expression <Func <TEntity, bool> >)RemoveCastsVisitor.Visit(node);
         return(Queryable.FirstOrDefault <TEntity>((IQueryable <TEntity>) this.dbSet, node));
     }
     return(this.FirstOrDefault());
 }
 public virtual IQueryable <TEntity> GetActive(Expression <Func <TEntity, bool> > predicate)
 {
     if (typeof(IDeleting).IsAssignableFrom(typeof(TEntity)))
     {
         Expression <Func <TEntity, bool> > node = (TEntity q) => !((IDeleting)q).IsDelete;
         node = (Expression <Func <TEntity, bool> >)RemoveCastsVisitor.Visit(node);
         return(Queryable.Where <TEntity>(Queryable.Where <TEntity>(this.Get(), node), predicate));
     }
     return(this.Get(predicate));
 }
 public Task <TEntity> FirstOrDefaultActiveAsync(Expression <Func <TEntity, bool> > predicate)
 {
     if (typeof(IDeleting).IsAssignableFrom(typeof(TEntity)))
     {
         Expression <Func <TEntity, bool> > node = (TEntity q) => ((IDeleting)q).IsDelete;
         node = (Expression <Func <TEntity, bool> >)RemoveCastsVisitor.Visit(node);
         return(QueryableExtensions.FirstOrDefaultAsync <TEntity>(Queryable.Where <TEntity>((IQueryable <TEntity>) this.dbSet, predicate), node));
     }
     return(this.FirstOrDefaultAsync(predicate));
 }