I'm using Telerik Data Access and using it to generate our plain WCF service. I actually really like how it generates the service.
However, everything goes wrong when an exception occurs. This could be a very simple exception, like an object not being found by it's DTO key or trying to add an object with the same value for a unique field as an existing one. When this happens, every CRUD operation that I'm trying to execute (on the client sent to the WCF service and so to the data access library and the database) gives me a LockNotGrantedException. This exception (the LockNotGrantedException) keeps being thrown for every operation (even valid ones), until I restart the WCF service (which is not supposed to happen).
Stack trace (sorry for the little bit of Dutch in there...):
Telerik.OpenAccess.RT.sql.SQLException: Lock request time out period exceeded. ---> System.Data.SqlClient.SqlException: Lock request time out period exceeded.
bij System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
bij System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
bij System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
bij System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
bij System.Data.SqlClient.SqlDataReader.TryHasMoreRows(Boolean& moreRows)
bij System.Data.SqlClient.SqlDataReader.TryReadInternal(Boolean setTimeout, Boolean& more)
bij OpenAccessRuntime.Intellitrace.Read(DbDataReader reader, String id)
--- Einde van intern uitzonderingsstackpad ---
Next, I also noticed that the client application (a console application in this case) kept trying to execute the operation, even after the LockNotGrantedException was thrown in the service application. So I had to stop the client application to stop the calls to the WCF service. I don't know if that is something caused by the service and the LockNotGrantedException, or something specific to a console application?
I can also give you the following information. I tried to change the isolation level of the model and setting it to ReadUncommited still caused a LockNotGrantedException to be thrown when any operation occurs that throws an exception and still caused the console application to keep trying to execute the operation, but when shutting down the console application and restarting it, valid operations don't throw this LockNotGrantedException anymore.
As a side note: because in the docs it is stated that it is deprecated to change the isolation level on the model, I configured it like this:
cacheKey, BackendConfiguration backendConfiguration, MetadataContainer metadataContainer, Assembly callingAssembly)
.Init(connectionString, cacheKey, backendConfiguration, metadataContainer, callingAssembly);
.ContextOptions.IsolationLevel = IsolationLevel.ReadUncommitted;
What other information can I give you? Well, of course I extended the interface (I made it partial in the T4 templates) and the service. I also extended the assemblers to transform SqlGeography in WKT and so I also extended the DTO's to add this WKT to the relevant objects.
I also adapted the T4 templates for the assemblers a bit. I implemented the AssembleNavigational() and adapted it in a way that no StackOverflowException occurs. This way it is possible to get a DTO with its navigation properties. I also changed the T4 templates so a method was added that made the reverse also possible: filling navigation properties on the DTO's and so setting those in the entities. That way, it is also possible to execute CUD operations with the navigation properties on the DTO on the client. Of course, I did set 'IsManaged' to 'true'.
Can someone help me with this LockNotGrantedException?
Please ask when further information is required. However, this is quite important and urgent. ;)