public void Verify_CommitableTransaction_cannot_be_mixed_with_TransactionScope() { try { using (var ctx = CreateTransactionContext()) { ctx.Connection.Open(); using (var committableTransaction = new CommittableTransaction()) { ctx.Connection.EnlistTransaction(committableTransaction); using (var transactionScope = new TransactionScope()) { var transactionLogEntry = new TransactionLogEntry(); ctx.AddObject("Entities.TransactionLog", transactionLogEntry); Assert.Equal( Strings.EntityClient_ProviderSpecificError("EnlistTransaction"), Assert.Throws <EntityException>(() => ctx.SaveChanges()).Message); } } } } finally { ResetTables(); } }
private TransactionLogEntry AddLogEntryToDatabase(ObjectContext ctx) { var transactionLogEntry = new TransactionLogEntry(); ctx.AddObject("Entities.TransactionLog", transactionLogEntry); ctx.SaveChanges(); return(transactionLogEntry); }