Dear support team We uses DataObjects.net version 4.4.3 We use the lock method to control the concurrency. This method works very well in the happy scenario queryable.Lock(); Do some work on queryable; Transaction.Complete(); But in the following scenario, where the method returned before the transaction completion, the queryable remain locked and causes an error message "Sequence contains no elements" when trying to lock the queryable again and we have to restart the whole web server to free the lock. queryable.Lock(); if (1 == 1) return; Do some work on queryable; Transaction.Complete(); |
Hello Fawzy, it's hard to say something about your problem with provided information.
However some important things to note:
Complete()
does not commit a transaction, this method marks transaction for committing, but actual commit happens in when you callDispose()
onTransactionScope
. IfComplete()
was not called,Dispose()
will rollback transaction. You should always dispose transaction scope otherwise transaction will be leaked.Lock()
does not lock immediately, it constructs a query that will lock matching objects when query is executed (in other worlds when you start enumerating query results). If you don't enumerate the query results no locking happens.