Пример #1
0
 public bool Any()
 {
     using (var uof = new UnitOfWork.UnitOfWork(_context))
     {
         return(uof.GetRepository <TEntity>().Any());
     }
 }
Пример #2
0
 public bool Any(Expression <Func <TEntity, bool> > predicate)
 {
     using (var uof = new UnitOfWork.UnitOfWork(_context))
     {
         return(uof.GetRepository <TEntity>().Any(predicate));
     }
 }
Пример #3
0
 public void RunCrudOperation(TEntity entity)
 {
     using (var uof = new UnitOfWork.UnitOfWork(_context))
     {
         uof.GetRepository <TEntity>().RunCrudOperation(entity);
     }
 }
Пример #4
0
 public int Count()
 {
     using (var uof = new UnitOfWork.UnitOfWork(_context))
     {
         return(uof.GetRepository <TEntity>().Count());
     }
 }
Пример #5
0
 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));
     }
 }
Пример #6
0
 public IEnumerable <TEntity> GetAll()
 {
     using (var uof = new UnitOfWork.UnitOfWork(_context))
     {
         return(uof.GetRepository <TEntity>().GetAll().ToList());
     }
 }
Пример #7
0
 public IEnumerable <TEntity> ExecuteSqlQuery(string sql, params object[] parameters)
 {
     using (var uof = new UnitOfWork.UnitOfWork(_context))
     {
         return(uof.GetRepository <TEntity>().ExecuteSqlQuery(sql, parameters));
     }
 }
Пример #8
0
 public IEnumerable <TEntity> ExecuteSqlQuery(IDbCommand sqlCommand)
 {
     using (var uof = new UnitOfWork.UnitOfWork(_context))
     {
         return(uof.GetRepository <TEntity>().ExecuteSqlQuery(sqlCommand));
     }
 }
Пример #9
0
 public void ExecuteSqlCommand(IDbCommand sqlCommand)
 {
     using (var uof = new UnitOfWork.UnitOfWork(_context))
     {
         uof.GetRepository <TEntity>().ExecuteSqlCommand(sqlCommand);
     }
 }
Пример #10
0
 public void ExecuteSqlCommand(string sql, object[] parameters)
 {
     using (var uof = new UnitOfWork.UnitOfWork(_context))
     {
         uof.GetRepository <TEntity>().ExecuteSqlCommand(sql, parameters);
     }
 }
Пример #11
0
 public void RunCrudOperationRange(IEnumerable <TEntity> entities)
 {
     using (var uof = new UnitOfWork.UnitOfWork(_context))
     {
         uof.GetRepository <TEntity>().RunCrudOperationRange(entities);
     }
 }
Пример #12
0
 public void Add(TEntity entity)
 {
     using (var uof = new UnitOfWork.UnitOfWork(_context))
     {
         uof.GetRepository <TEntity>().Add(entity);
     }
 }
Пример #13
0
 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());
     }
 }
Пример #14
0
 public void UpdateRange(IEnumerable <TEntity> entities)
 {
     using (var uof = new UnitOfWork.UnitOfWork(_context))
     {
         uof.GetRepository <TEntity>().UpdateRange(entities);
     }
 }
Пример #15
0
        /// <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);
        }
Пример #16
0
        public static IEnumerable <CategoryEntity> GetCategories()
        {
            using (var uow = new UnitOfWork.UnitOfWork())
            {
                var repo = uow.GetRepository <ICategoryRepository>();

                return(repo.GetAll());
            }
        }
Пример #17
0
        public static UserEntity GetUser(int id)
        {
            using (var uow = new UnitOfWork.UnitOfWork())
            {
                var repo = uow.GetRepository <IUserRepository>();

                return(repo.GetById(id));
            }
        }
Пример #18
0
        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);
        }