-
Notifications
You must be signed in to change notification settings - Fork 0
NativeTransactions
Marcin Sulecki edited this page Mar 28, 2017
·
1 revision
private static void TransactionTest()
{
Artist artist1 = new Artist();
Artist artist2 = new Artist();
using (var context = new MusicStoreContext())
using (var transaction = context.Database.BeginTransaction())
{
try
{
context.Artists.Add(artist1);
context.Artists.Add(artist2);
transaction.Commit();
}
catch(Exception)
{
transaction.Rollback();
}
}
}