///<include file='docs.xml' path='doc/members/member[@name="M:GenericRepositoryAndService.Repository.GenericRepository`1.Collection(System.Boolean,System.Boolean)"]/*'/>
 public IQueryable <T> Collection(bool isIncludes, bool isTracked)
 {
     if (isIncludes)
     {
         if (isTracked)
         {
             return(GenericToolsQueriesAndLists.QueryTIncludeTracked <T>(DataContext));
         }
         else
         {
             return(GenericToolsQueriesAndLists.QueryTInclude <T>(DataContext));
         }
     }
     else
     {
         if (isTracked)
         {
             return(dbSet);
         }
         else
         {
             return(dbSet.AsNoTracking());
         }
     }
 }
 ///<include file='docs.xml' path='doc/members/member[@name="M:GenericRepositoryAndService.Repository.GenericRepository`1.FindByIdIncludesInNewContext(System.Data.Entity.DbContext,System.Object[])"]/*'/>
 private T FindByIdIncludesInNewContext(DbContext dbContext, params object[] objs)
 {
     GenericToolsTypeAnalysis.CheckIfObjectIsKey <T>(objs);
     return(GenericToolsQueriesAndLists.QueryWhereKeysAre(
                GenericToolsQueriesAndLists.QueryTInclude <T>(dbContext),
                objs
                ).SingleOrDefault());
 }
 ///<include file='docs.xml' path='doc/members/member[@name="M:GenericRepositoryAndService.Repository.GenericRepository`1.FindById(System.Boolean,System.Boolean,System.Object[])"]/*'/>
 public T FindById(bool isIncludes, bool isTracked, params object[] objs)
 {
     GenericToolsTypeAnalysis.CheckIfObjectIsKey <T>(objs);
     return(GenericToolsQueriesAndLists.QueryWhereKeysAre(
                Collection(isIncludes, isTracked),
                objs
                ).SingleOrDefault());
 }
        ///<include file='docs.xml' path='doc/members/member[@name="M:GenericRepositoryAndService.Repository.GenericRepository`1.Count(System.Linq.Expressions.Expression{System.Func{`0,System.Boolean}})"]/*'/>
        public long Count(Expression <Func <T, bool> > predicateWhere = null)
        {
            IQueryable <T> req = CollectionIncludes();

            if (predicateWhere != null)
            {
                req = GenericToolsQueriesAndLists.QueryTryPredicateWhere(req, predicateWhere);
            }

            return(req.Count());
        }
        ///<include file='docs.xml' path='doc/members/member[@name="M:GenericRepositoryAndService.Repository.GenericRepository`1.GetAll(System.Boolean,System.Boolean,System.Int32,System.Int32,System.Linq.Expressions.Expression{System.Func{System.Linq.IQueryable{`0},System.Linq.IOrderedQueryable{`0}}},System.Linq.Expressions.Expression{System.Func{`0,System.Boolean}})"]/*'/>
        public List <T> GetAll(bool isIncludes, bool isTracked, int start = 0, int maxByPage = int.MaxValue, Expression <Func <IQueryable <T>, IOrderedQueryable <T> > > orderreq = null, Expression <Func <T, bool> > predicateWhere = null)
        {
            IQueryable <T> req;
            IQueryable <T> reqorigin = Collection(isIncludes, isTracked);

            if (orderreq != null)
            {
                req = orderreq.Compile().Invoke(reqorigin);
            }
            else
            {
                req = GenericToolsQueriesAndLists.QueryDefaultOrderBy(reqorigin);
            }

            req = GenericToolsQueriesAndLists.WhereSkipTake(req, start, maxByPage, predicateWhere);

            return(req.ToList());
        }