Exemplo n.º 1
0
 private void ShowTransaction()
 {
     using (PhoneContext db = new PhoneContext()) {
         using (var transaction = db.Database.BeginTransaction()) {
             try {
                 db.Database.ExecuteSqlCommand(@"UPDATE Phone SET Price = Price + 1000");
                 transaction.Commit();
             }
             catch (Exception ex) {
                 transaction.Rollback();
             }
         }
     }
 }
Exemplo n.º 2
0
 public GenericRepository(PhoneContext context)
 {
     this.context = context;
     this.dbSet   = context.Set <TEntity>();
 }