Reputation: 14881
I am using Entity framework 3.5
I need to edit a database row, and I want to ensure that no other process edits this row once I start editing it.
How do I achieve this in Entity Framework 3.5?
I am looking to lock a specific row, not an entire table.
Upvotes: 3
Views: 9865
Reputation: 767
You can use Scope like this:
var transactionOptions = new TransactionOptions
{
IsolationLevel = IsolationLevel.Serializable,
Timeout = TimeSpan.MaxValue
};
using (var scope = new TransactionScope(
TransactionScopeOption.Required, transactionOptions))
{
// Your code
}
Upvotes: 1