コード例 #1
0
 public void Update2(T entity)
 {
     using (var Db2 = new GerenciadorContext())
     {
         Db.Entry(entity).State = EntityState.Modified;
         Db.SaveChanges();
     }
 }
コード例 #2
0
 public List <T> GetList()
 {
     using (var Db2 = new GerenciadorContext())
     {
         var DbSet2 = Db2.Set <T>();
         return(DbSet2.ToList());
     }
 }
コード例 #3
0
 public IEnumerable <T> GetBy(Func <T, bool> predicate)
 {
     using (var Db2 = new GerenciadorContext())
     {
         var DbSet2 = Db2.Set <T>();
         return(DbSet2.Where(predicate)?.ToList());
     }
 }
コード例 #4
0
        public HomeController()
        {
            Db    = new GerenciadorContext();
            DbSet = Db.Set <Usuario>();

            //Dapper
            dbConnection = Db.Database.GetDbConnection();
        }
コード例 #5
0
 public UsuarioController(GerenciadorContext context)
 {
     _context = context;
 }
コード例 #6
0
 public TarefaController(GerenciadorContext context)
 {
     _context = context;
 }
コード例 #7
0
 public BaseRepository()
 {
     Db = new GerenciadorContext();
     Db.Configuration.ProxyCreationEnabled = false;
     DbSet = Db.Set <T>();
 }