none
NOLOCK on all queries in context -- it looks like there are no good options.. RRS feed

  • Question

  • This has been all over multiple forums - in order to force NOLOC query hint aka transaction isolation level, wrap queries in the TransactionScope. The problems with this solution are:

    1. MSDTC is required if more than one context is used since this becomes 2PC distributed transaction. This can be problematic in many environments.

    2. Code clutter. If I have a repository class, I new all contexts in the constructor while with TransactionScope I need to do that in every method.

    The other solutions such as stored procedures defeat the purpose of even having ER mapper, in my opinion. Not to mention the refactoring of the existing code.

    The perfect solution would be an isolation level property on the context. Is it possible?

    Are they any other workarounds?

    -Stan

    Friday, July 19, 2013 2:06 PM

All replies