public IList <T> GetDataPart(Expression <Func <T, bool> > where, Expression <Func <T, dynamic> > sort, Expression <Func <T, dynamic> > thenby, string sortType, int takeCount) { List <T> list = new List <T>(); using (var context = new anketbazEntities()) { IQueryable <T> dbQuery = context.Set <T>(); if (sortType == "D") { list = dbQuery .AsNoTracking() .OrderByDescending(sort) .ThenByDescending(thenby) .Where(where) .Take(takeCount) .ToList <T>(); } else { list = dbQuery .AsNoTracking() .OrderBy(sort) .ThenBy(thenby) .Where(where) .Take(takeCount) .ToList <T>(); } list = list.ToList(); } return(list); }
public IList <T> GetDataPart(Expression <Func <T, bool> > @where, Expression <Func <T, dynamic> > sort, SortType sortType) { List <T> list = new List <T>(); using (var context = new anketbazEntities()) { IQueryable <T> dbQuery = context.Set <T>(); if (sortType == SortType.Descending) { list = dbQuery .AsNoTracking() .OrderByDescending(sort) .Where(where) .ToList <T>(); } else { list = dbQuery .AsNoTracking() .OrderBy(sort) .Where(where) .ToList <T>(); } list = list.ToList(); } return(list); }
public int GetDataCount(Expression <Func <T, bool> > @where) { int result = 0; using (var context = new anketbazEntities()) { IQueryable <T> dbQuery = context.Set <T>(); result = dbQuery .AsNoTracking() .Count(@where); } return(result); }
public T GetSingle(Expression <Func <T, bool> > @where) { T item = null; using (var context = new anketbazEntities()) { IQueryable <T> dbQuery = context.Set <T>(); item = dbQuery .AsNoTracking() .FirstOrDefault(where); } return(item); }
public IList <dynamic> GetDataPart(Expression <Func <T, bool> > @where, Expression <Func <T, dynamic> > @select) { List <dynamic> list = new List <dynamic>(); using (var context = new anketbazEntities()) { IQueryable <T> dbQuery = context.Set <T>(); list = dbQuery .AsNoTracking() .Where(where) .Select(select) .ToList(); } return(list); }
private static readonly PropertyInfo CrdatProperty = typeof(T).GetProperty("crdat"); //Tablo Alanlari public IList <T> GetList(Expression <Func <T, bool> > @where) { List <T> list; using (var context = new anketbazEntities()) { context.Database.CreateIfNotExists(); IQueryable <T> dbQuery = context.Set <T>(); list = dbQuery .AsNoTracking() .Where(where) .ToList <T>(); } return(list); }
public IList <dynamic> GetDataPart(Expression <Func <T, bool> > @where, Expression <Func <T, dynamic> > @select, Expression <Func <T, dynamic> > sort, int take) { if (take == 0) { take = 20; } List <dynamic> list = new List <dynamic>(); using (var context = new anketbazEntities()) { IQueryable <T> dbQuery = context.Set <T>(); list = dbQuery .AsNoTracking() .OrderByDescending(sort) .Where(where) .Select(select) .Take(take) .ToList(); } return(list); }