0
1

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();

asked Feb 17 '13 at 09:35

Fawzy's gravatar image

Fawzy
5123

edited Feb 17 '13 at 11:08

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 call Dispose() on TransactionScope. If Complete() was not called, Dispose() will rollback transaction. You should always dispose transaction scope otherwise transaction will be leaked.

(Feb 18 '13 at 02:44) Denis Krjuchkov Denis%20Krjuchkov's gravatar image

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.

(Feb 18 '13 at 02:47) Denis Krjuchkov Denis%20Krjuchkov's gravatar image
Be the first one to answer this question!
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
toggle preview

Subscription:

Once you sign in you will be able to subscribe for any updates here

Tags:

×4
×1

Asked: Feb 17 '13 at 09:35

Seen: 925 times

Last updated: Feb 18 '13 at 02:47

powered by OSQA