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(); } } } }
public GenericRepository(PhoneContext context) { this.context = context; this.dbSet = context.Set <TEntity>(); }