Exemplo n.º 1
0
        public T FindWithChildren(string nomeBase, Expression <Func <T, bool> > predicate, bool recursive = false)
        {
            var element = DataBaseService.Conexao(nomeBase).Find <T>(predicate);

            if (element == null)
            {
                return(null);
            }

            DataBaseService.Conexao(nomeBase).GetChildren(element, recursive);

            return(element);
        }
Exemplo n.º 2
0
        public int Save(T entity, string nomeBase)
        {
            var affectedItens = 0;

            try
            {
                if (entity.Id == 0)
                {
                    affectedItens = DataBaseService.Conexao(nomeBase).Insert(entity);
                }
                else
                {
                    affectedItens = DataBaseService.Conexao(nomeBase).Update(entity);
                }
            }
            catch (Exception ex)
            {
            }

            return(affectedItens);
        }
Exemplo n.º 3
0
 public IEnumerable <T> Collection(string nomeBase, Expression <Func <T, bool> > predicate, bool recursive = false)
 {
     return(DataBaseService.Conexao(nomeBase).GetAllWithChildren(predicate, recursive));
 }
Exemplo n.º 4
0
 public IEnumerable <T> Collection(string nomeBase, Func <T, bool> predicate = null)
 {
     return(predicate == null?DataBaseService.Conexao(nomeBase).Table <T>() : DataBaseService.Conexao(nomeBase).Table <T>().Where(predicate));
 }
Exemplo n.º 5
0
 public T Find(Expression <Func <T, bool> > predicate, string nomeBase)
 {
     return(DataBaseService.Conexao(nomeBase).Find <T>(predicate));
 }
Exemplo n.º 6
0
 public T GetWithChildren(string nomeBase, int id, bool recursive = false)
 {
     return(DataBaseService.Conexao(nomeBase).GetWithChildren <T>(id, recursive));
 }
Exemplo n.º 7
0
 public T Get(int id, string nomeBase)
 {
     return(DataBaseService.Conexao(nomeBase).Get <T>(id));
 }
Exemplo n.º 8
0
        public bool Delete(T entity, string nomeBase)
        {
            int affectedItens = DataBaseService.Conexao(nomeBase).Delete(entity);

            return(affectedItens == 1);
        }
Exemplo n.º 9
0
        public bool InsertList(List <T> entity, string nomeBase)
        {
            var affectedItens = DataBaseService.Conexao(nomeBase).InsertAll(entity);

            return(affectedItens == 1);
        }