Best unofficial Apache Server developers community
Username
Forgot password?
Sign in with Twitter account
Sign in with Facebook account

Can I use TransactionScope in business layer instead of using SQLiteTransaction in data provider ?

0

175 views

I would like to use the TransactionScope class in my business layer:

In AdminService class:

public void DeleteSchoolclass(Schoolclass schoolclass)
        {
            using (var trans = new TransactionScope())
            {
                adminProvider.DeleteSchoolclass(schoolclass.SchoolclassId);
                timetableProvider.DeleteTimeTableEntry(schoolclass.SchoolclassCode);

                trans.Complete();
            }             
        }

When I debug both Delete methods abouve the Transaction property of each Delete command object inside the dataprovider is NULL so it seems there is no transaction... How can I find out wether a Transaction is used or not?

Wen I debug the transactionscope object I dont find any Connection...

TransactionScope seems like magic...

asked June 25, 2011 2:10 pm CDT
posted via StackOverflow

1 Answer

0
 

Transaction.Current will tell you whether there is an active transaction.

Only once a connection is opened within a transaction scope will it be included in the transaction.

HTH

answered June 25, 2011 2:23 pm CDT

Your answer

Join with account you already have


Sign in with Twitter account
Sign in with Facebook account
Sign in with Google Friend Connect

Preview
Similar questions