I have been playing with Entity Framework and so far I like using it a lot. But everything I've done so far assumes optimistic locking which works well for me in most cases. However, I have the following scenario:
- A SQL Server table with only one row that holds application-wide data
- The row contains a column named "NextAvailableNumber"
- The Application needs to read the number, increment it by 1, and update it
The above has to guarantee that any competing process has to wait to get a number until the first transaction has completed. Previously we have done this using table locks (since there's only one row), but I would like to know how this should be done using LINQ to Entities?
Thanks,
Jim K.