Naruto
Naruto

Reputation: 9634

transactionscope locks the tables

in my app, transaction scope is there, inside that i'm doing all copying operation to dc object and finnally dc.submittchanges() will be performed.

Will the transaction scope locks down the table present in dc?, will this cause any deadlocks?

Eg:

  using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, TimeSpan.FromSeconds(30)))
            {
                using (var dc = new ProposalDataContext(_ConnectionString))
                {
    scope.Complete(); 
                }
            }

Upvotes: 2

Views: 4355

Answers (1)

Darren
Darren

Reputation: 70748

TransactionScope makes the code block transactional. While the code has not been COMMITED the tables involved will be locked, if another process requests the contents of the table(s) involved it will have to wait until the transaction is committed or rolled back.

Upvotes: 8

Related Questions