This is a migrated thread and some comments may be shown as answers.

Active transaction required for write operation

4 Answers 170 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Alec
Top achievements
Rank 1
Alec asked on 06 Apr 2009, 07:15 AM
When I have added an object, and then retrieve it again and updated. That exception shows up.

What does this mean?

4 Answers, 1 is accepted

Sort by
0
Alexander
Telerik team
answered on 06 Apr 2009, 08:58 AM
Hi Alec,

All operations that make changes to the database are encapsulated within a transaction. This ensures that all changes are committed at once to the database. It also provides the ability to rollback the changes if something bad happens, so the database will not be polluted. Transactions are managed by the ObjectScope.Transaction property and its Begin, Commit and Rollback methods. Note that only one transaction can be active at the same time for each object scope instance. I believe you will find this Knowledge base article useful.

Kind regards,
Alexander
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
Nathan Heberley
Top achievements
Rank 2
answered on 10 Aug 2009, 08:05 AM
What if you want to make an alteration to an object whichyou are not going to persist?

In my sinario I'm binding Hierarchical data to a panelbar, I have to knock off the root Item and then update the root items children to contain a parentID value of 0 so that the auto binding will work.

I have no intention of persisting these values but I get the error mentioned.

Do you have a solution ?



0
Nathan Heberley
Top achievements
Rank 2
answered on 10 Aug 2009, 08:50 AM
I have founbd a solution bu I would prefer to find an alternative.

I rebuilt the returned List and created new objects for each one I wanted to alter.
This solution is fine for the particular use but I would like to know if there is an alternative for the case where there are allot of objects that need alteration. 
0
Alexander
Telerik team
answered on 11 Aug 2009, 02:52 PM
Hi Nathan Heberley,

The only way to edit an object out of transaction is when the object has not yet been added to an ObjectScope. For all other cases, an active transaction is necessary.
In order not to persist the alterations to already existing in the scope objects, you can use a transaction and call Transaction.Rollback() at the end to cancel the changes. Hope I understood you correctly.

Best wishes,
Alexander
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
General Discussions
Asked by
Alec
Top achievements
Rank 1
Answers by
Alexander
Telerik team
Nathan Heberley
Top achievements
Rank 2
Share this question
or