Exemple #1
0
 public MovieRepositoryImpl(MySQLContext context)
 {
     _context = context;
     dataset  = _context.Set <Movie>();
     ds2      = _context.Set <_vw_mc_filme_visto>();
     ds3      = _context.Set <_vw_mc_filme_ver>();
 }
 public GenericRepositoryInter(MySQLContext context)
 {
     _context = context;
     dataset  = _context.Set <T>();
     dsa      = _context.Set <A>();
     dsb      = _context.Set <B>();
 }
 public List <TEntity> FindByFilter(Expression <Func <TEntity, bool> > predicate)
 {
     using (var db = new MySQLContext(_OptionsBuilder))
     {
         return(db.Set <TEntity>().Where(predicate).ToList());
     }
 }
 public List <TEntity> GetAll()
 {
     using (var db = new MySQLContext(_OptionsBuilder))
     {
         return(db.Set <TEntity>().AsNoTracking().ToList());
     }
 }
 public TEntity GetById(Guid id)
 {
     using (var db = new MySQLContext(_OptionsBuilder))
     {
         return(db.Set <TEntity>().Find(id));
     }
 }
 public College GetByIdIncluedTimeCollege(Guid id)
 {
     using (var db = new MySQLContext(_OptionsBuilder))
     {
         return(db.Set <College>().Include(x => x.CollegeTime).FirstOrDefault(x => x.Id == id));
     }
 }
 public void Delete(TEntity obj)
 {
     using (var db = new MySQLContext(_OptionsBuilder))
     {
         db.Set <TEntity>().Remove(obj);
         db.SaveChanges();
     }
 }
        public TEntity Update(TEntity obj)
        {
            using (var db = new MySQLContext(_OptionsBuilder))
            {
                var entity = db.Set <TEntity>().Update(obj);
                db.SaveChanges();

                return(entity.Entity);
            }
        }
 public ReceivePaymentCulturalExchange GetByIdIncludedDependency(Guid id)
 {
     using (var db = new MySQLContext(_OptionsBuilder))
     {
         return(db.Set <ReceivePaymentCulturalExchange>()
                .Include(x => x.Environment)
                .Include(x => x.CulturalExchange)
                .ThenInclude(x => x.Student)
                .FirstOrDefault(x => x.Id == id));
     }
 }
 public List <ReceivePaymentCulturalExchange> GetAllIncludedDependencys(Guid environmentId)
 {
     using (var db = new MySQLContext(_OptionsBuilder))
     {
         return(db.Set <ReceivePaymentCulturalExchange>()
                .Include(x => x.Environment)
                .Include(x => x.CulturalExchange)
                .ThenInclude(x => x.Student)
                .ToList());
     }
 }
        public TEntity Insert(TEntity obj)
        {
            using (var db = new MySQLContext(_OptionsBuilder))
            {
                db.Entry(obj).State = EntityState.Added;
                var entity = db.Set <TEntity>().Add(obj);
                db.SaveChanges();

                return(entity.Entity);
            }
        }
 public List <ReceivePaymentCulturalExchange> GetAllIncludedDependencysByCulturalExchangeId(Guid culturalExchangeId)
 {
     using (var db = new MySQLContext(_OptionsBuilder))
     {
         return(db.Set <ReceivePaymentCulturalExchange>()
                .Include(x => x.Environment)
                .Include(x => x.CulturalExchange)
                .ThenInclude(x => x.Student)
                .Include(x => x.CulturalExchange.College)
                .ThenInclude(col => col.CollegeTime)
                .Where(x => x.CulturalExchangeId == culturalExchangeId)
                .ToList());
     }
 }
        public Ability CreateAbility(Ability item)
        {
            if (Exists(item.name, item.type))
            {
                return(null);
            }

            DbSet <Ability> ds = _context.Set <Ability>();

            try
            {
                ds.Add(item);
                _context.SaveChanges();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(item);
        }
Exemple #14
0
        public T Update(T entity)
        {
            if (!Exists(entity.Id))
            {
                throw new NotSupportedException("Can not update inexist item");
            }
            var result = _mySQLContext.Set <T>().SingleOrDefault(p => p.Id.Equals(entity.Id));

            if (result != null)
            {
                try
                {
                    _mySQLContext.Entry(result).CurrentValues.SetValues(entity);
                    _mySQLContext.SaveChanges();
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(entity);
        }
 public GenericRepository(MySQLContext context, ILog logger)
 {
     _context = context;
     dataset  = _context.Set <T>();
     _logger  = logger;
 }
Exemple #16
0
 public GenericRepository(MySQLContext context)
 {
     this.context = context;
     this.dataset = context.Set <T>();
 }
 public BookRepository(MySQLContext context) : base(context)
 {
     _context = context;
     dataset  = _context.Set <Book>();
 }
 public ViewRepositoryImpl(MySQLContext context)
 {
     _context = context;
     dataset  = _context.Set <T>();
 }
 protected BaseRepository(MySQLContext context)
 {
     _context = context;
     _entity  = _context.Set <T>();
 }
 public BaseRepository(MySQLContext mySQLContext)
 {
     _mySQLContext = mySQLContext;
     _dbSet        = _mySQLContext.Set <T>();
 }
 public BaseRepository(MySQLContext context)
 {
     _context = context;
     _dbSet   = _context.Set <TEntity>();
 }
 public GenericRepository(MySQLContext mySQLContext)
 {
     _mySQLContext = mySQLContext;
     dataSet       = _mySQLContext.Set <T>();
 }
 public RepositoryBase(MySQLContext context)
 {
     _context = context;
     _dataset = _context.Set <T>();
 }
Exemple #24
0
 public GenericRepository(MySQLContext context)
 {
     _context = context;
     dataset  = _context.Set <T>(); //Aqui estamos setando o DbSet que fizemos na classe de contexto. Ele vai passar o dataset para 'T' que vai ser a classe que estiver em execução
 }
Exemple #25
0
 public GenericRepository(MySQLContext context)
 {
     _context = context;
     dataset  = _context.Set <T>();
 }
Exemple #26
0
 public PersonRepository(MySQLContext context) : base(context)
 {
     _context = context;
     dataset  = _context.Set <Person>();
 }