public bool Any() { using (var uof = new UnitOfWork.UnitOfWork(_context)) { return(uof.GetRepository <TEntity>().Any()); } }
public bool Any(Expression <Func <TEntity, bool> > predicate) { using (var uof = new UnitOfWork.UnitOfWork(_context)) { return(uof.GetRepository <TEntity>().Any(predicate)); } }
public void RunCrudOperation(TEntity entity) { using (var uof = new UnitOfWork.UnitOfWork(_context)) { uof.GetRepository <TEntity>().RunCrudOperation(entity); } }
public int Count() { using (var uof = new UnitOfWork.UnitOfWork(_context)) { return(uof.GetRepository <TEntity>().Count()); } }
public virtual TEntity Get(Expression <Func <TEntity, bool> > predicate, Expression <Func <TEntity, object> > path) { using (var uof = new UnitOfWork.UnitOfWork(_context)) { return(uof.GetRepository <TEntity>().Get(predicate, path)); } }
public IEnumerable <TEntity> GetAll() { using (var uof = new UnitOfWork.UnitOfWork(_context)) { return(uof.GetRepository <TEntity>().GetAll().ToList()); } }
public IEnumerable <TEntity> ExecuteSqlQuery(string sql, params object[] parameters) { using (var uof = new UnitOfWork.UnitOfWork(_context)) { return(uof.GetRepository <TEntity>().ExecuteSqlQuery(sql, parameters)); } }
public IEnumerable <TEntity> ExecuteSqlQuery(IDbCommand sqlCommand) { using (var uof = new UnitOfWork.UnitOfWork(_context)) { return(uof.GetRepository <TEntity>().ExecuteSqlQuery(sqlCommand)); } }
public void ExecuteSqlCommand(IDbCommand sqlCommand) { using (var uof = new UnitOfWork.UnitOfWork(_context)) { uof.GetRepository <TEntity>().ExecuteSqlCommand(sqlCommand); } }
public void ExecuteSqlCommand(string sql, object[] parameters) { using (var uof = new UnitOfWork.UnitOfWork(_context)) { uof.GetRepository <TEntity>().ExecuteSqlCommand(sql, parameters); } }
public void RunCrudOperationRange(IEnumerable <TEntity> entities) { using (var uof = new UnitOfWork.UnitOfWork(_context)) { uof.GetRepository <TEntity>().RunCrudOperationRange(entities); } }
public void Add(TEntity entity) { using (var uof = new UnitOfWork.UnitOfWork(_context)) { uof.GetRepository <TEntity>().Add(entity); } }
public IEnumerable <TEntity> GetAll(Expression <Func <TEntity, bool> > predicate, Expression <Func <TEntity, object> > path) { using (var uof = new UnitOfWork.UnitOfWork(_context)) { return(uof.GetRepository <TEntity>().GetAll(predicate, path).ToList()); } }
public void UpdateRange(IEnumerable <TEntity> entities) { using (var uof = new UnitOfWork.UnitOfWork(_context)) { uof.GetRepository <TEntity>().UpdateRange(entities); } }
/// <summary> /// Sorgu nesnesini ilişkileriyle, filtrelenmiş ve sıralanmış olarak oluşturur. /// </summary> /// <param name="uow">Açılmış olan veritabanı bağlantısı</param> /// <param name="additionalExpression">Ek filtre sorgusu yazılması gerekiyorsa yazılmalıdır.</param> /// <returns></returns> public IQueryable <T> GetQueryObject(UnitOfWork.UnitOfWork <D> uow, List <string> includePaths, Expression <Func <T, bool> > additionalExpression = null) { IQueryable <T> queryObject = uow.GetRepository <T>().GetAll(GetExpression()).Include(includePaths); if (additionalExpression != null) { queryObject = queryObject.Where(additionalExpression); } if (Sort != null) { IOrderedQueryable <T> orderedQueryable = (IOrderedQueryable <T>)queryObject; for (int i = 0; i < Sort.Count; i++) { orderedQueryable = i == 0 ? GetOrderQueryable(queryObject, Sort[i]) : GetOrderQueryable(orderedQueryable, Sort[i]); } queryObject = orderedQueryable; } if (TakeCount > 0) { queryObject = queryObject.Take(SkipCount + TakeCount); } if (SkipCount > 0) { queryObject = queryObject.Skip(SkipCount); } return(queryObject); }
public static IEnumerable <CategoryEntity> GetCategories() { using (var uow = new UnitOfWork.UnitOfWork()) { var repo = uow.GetRepository <ICategoryRepository>(); return(repo.GetAll()); } }
public static UserEntity GetUser(int id) { using (var uow = new UnitOfWork.UnitOfWork()) { var repo = uow.GetRepository <IUserRepository>(); return(repo.GetById(id)); } }
private Transaction TakeTransation() { var uow = new UnitOfWork.UnitOfWork(new OOProjectContext()); Transaction transaction = uow.GetRepository <Transaction>().All() .FirstOrDefault(c => c.TransactionId == TransactionId); uow.CompleteWork(); return(transaction); }