LinqDataSource set isolation level to READ UNCOMMITTED
Is it possible to somehow set LinqDataSource's IsolationLevel to READ UNCOMMITTED?
I have LinqD开发者_如何学CataSource bound to pretty nasty SQL Server View (INNER JOIN to multiple tables) and sometimes Deadlock exception is thrown if I load the page with all entries from view while site is under heavy load.
If you want to use LinqDataSource
, then try setting the isolation level as part of the DataContext
connection itself (would mean that if you use the same DataContext
with other code that has different isolation level requirements, you would need to set up different ways of initializing the DataContext
).
Other options include:
- Open the
DataContext
in your codebehind, and set the transaction level thee - Access a stored procedure with your
LinqDataSource
or code, through yourDataContext
, and inside the stored procedure manually set the isolation level for the transaction.
See this blog post for more on there options.
精彩评论