Can I prevent a LINQ DataContext from using a transaction when a TransactionScope is present? -
i'm using transactionscope
in model controller class coordinates several lower level, data access classes. data access classes each use own linq datacontext
, , magic of transactionscope
, participate in same transaction if 1 present.
under normal circumstances, perfect , works. however, i've added activity logging class , 1 of places can write database. unfortunately, automatically picks on transactionscope
, if transaction gets rolled back, log entries.
i've checked transaction
property of datacontext
, it's null, expected, i'm not sure how tell ignore transactionscope
.
in logging class, wrap using(new datacontext())
into:
using (var s = new transactionscope(transactionscopeoption.suppress)) { }
Comments
Post a Comment