How to issue SQL Server lock hints in WCF Entity Framework?

Posted by TMN on Stack Overflow See other posts from Stack Overflow or by TMN
Published on 2010-04-06T18:30:34Z Indexed on 2010/04/06 18:33 UTC
Read the original article Hit count: 218

Filed under:
|
|
|

I'm just learning the WCF entity framework (and .net in general), and I'm running into a problem specifying lock hints in an embedded SQL query. I'm trying to specify a query that has lock hints in it (e.g., "SELECT * FROM xyz WITH(XLOCK, ROWLOCK)") and I keep getting errors from the runtime that the query syntax is not valid. The query works if I enter it directly into SQL Server. Is there some special syntax for lock hints when creating IQueryable result sets, or do I have to somehow mess with the transaction isolation level (probably not possible, as I need to specify different lock hints on a subquery within the main query).

© Stack Overflow or respective owner

Related posts about .NET

Related posts about ADO.NET