This question is locked. New answers and comments are not allowed.
I have a forward only model mapped entirely using Fluent, and I'm trying to lock a collection without success.
There aren't many examples out there, and few posts in the forum.
Here's an example of how I'm setting up:-
Then I'm trying something like this:-
But I get "Telerik.OpenAccess.Exceptions.TransactionException: Transaction properties cannot be modified for active transactions." trying to set the concurrency. So I try a commit just before, to close the transaction:
Now I get: "Telerik.OpenAccess.Exceptions.TransactionException: The method Commit is not supported for managed transactions."
OK.. I'll try flush then...
Now I get: "Telerik.OpenAccess.OpenAccessException: no active transaction"... hey?? didn't it just say there *was* a transaction?
Usually I have a context I generate in a HttpModule, however trying using a new scope as in the example above makes no difference.
Has anyone got a working example for this scenario?
Currently using ORM 2011.2.713, but doesn't seem version dependent.
There aren't many examples out there, and few posts in the forum.
Here's an example of how I'm setting up:-
BackendConfiguration backendConfiguration =
new
BackendConfiguration();
backendConfiguration.Backend =
"mssql"
;
Meta2.Context context =
new
Meta2.Context(connectionString, backendConfiguration);
Then I'm trying something like this:-
context.Scope.TransactionProperties.Concurrency = TransactionMode.PESSIMISTIC_EXPLICIT;
context.Scope.Transaction.Begin();
context.Scope.Transaction.Lock(context.Scope.Extent<Accounts.Payable.Invoice>(), LockMode.WRITE);
But I get "Telerik.OpenAccess.Exceptions.TransactionException: Transaction properties cannot be modified for active transactions." trying to set the concurrency. So I try a commit just before, to close the transaction:
context.Scope.Transaction.Commit();
context.Scope.TransactionProperties.Concurrency = TransactionMode.PESSIMISTIC_EXPLICIT;
context.Scope.Transaction.Begin();
context.Scope.Transaction.Lock(context.Scope.Extent<Accounts.Payable.Invoice>(), LockMode.WRITE);
Now I get: "Telerik.OpenAccess.Exceptions.TransactionException: The method Commit is not supported for managed transactions."
OK.. I'll try flush then...
context.Scope.Transaction.Flush();
context.Scope.TransactionProperties.Concurrency = TransactionMode.PESSIMISTIC_EXPLICIT;
context.Scope.Transaction.Begin();
context.Scope.Transaction.Lock(context.Scope.Extent<Accounts.Payable.Invoice>(), LockMode.WRITE);
Now I get: "Telerik.OpenAccess.OpenAccessException: no active transaction"... hey?? didn't it just say there *was* a transaction?
Usually I have a context I generate in a HttpModule, however trying using a new scope as in the example above makes no difference.
Has anyone got a working example for this scenario?
Currently using ORM 2011.2.713, but doesn't seem version dependent.