Does the database connection have to be set inside a TransactionScope
?
Or can I set it in the ctor and then have instance methods create up a TransactionScope
?
EDIT: e.g.
Public Sub New()
Dim conn = new SqlConnection(...connection string)
Public Sub SomeClassMethod()
using ts as new TransactionScope
//conn has already been initialized
//so, here you can set commands, ExecuteDataSet, etc.
vs
Public Sub New()
//nothing here
Public Sub SomeClassMethod()
using ts as new TransactionScope
conn = new SqlConnection(...connection string)
set commands, ExecuteDataSet, etc.
the question is do you need to create the connection to the database after you've created a TransactionScope or can it be done before?