i always using the following format to use transactionscope.
using(TransactionScope scope = new TransactionScope()){
....
}
sometimes i want to wrap the transactionscope to a new class, for example DbContext class, i want to using the statement like
dbContext.Begin(); ... dbContext.Submit();
it seems the transactioncope class need use “using”statement to do dispose, i want to know if there is anyway not use “using”.
You can design your
DbContextclass as follows:and you can use it as follows: