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

                return(repo.GetAll());
            }
        }
Ejemplo n.º 17
0
        public static UserEntity GetUser(int id)
        {
            using (var uow = new UnitOfWork.UnitOfWork())
            {
                var repo = uow.GetRepository <IUserRepository>();

                return(repo.GetById(id));
            }
        }
Ejemplo n.º 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);
        }