3 Answers, 1 is accepted
0
Hi Armin,
When you make a change to the OpenAccess context, a transaction is started automatically. All subsequent changes (inserts, updates, deletes) are added to this transaction until it is closed either by the SaveChanges() or ClearChanges() methods which respectively commit or rollback the transaction. If your scenario allows it, you can design your application in such way that there would always be a single change to the context which would be pushed to the database. For more information about the related features of our Context API you can check the Handling Transactions and Tracking Context Changes articles in our documentation.
Due to those design decisions in the product, in order to achieve a more fine-grain change handling, it should be implemented above the OpenAccessContext, in a layer or a derived wrapper class that takes care for calling SaveChanges or FlushChanges for each change that is performed.
If possible, could you provide details for your scenario so that we may better advise you on the possible approaches?
I am looking forward to your feedback.
Regards,
Kristian Nikolov
Telerik
When you make a change to the OpenAccess context, a transaction is started automatically. All subsequent changes (inserts, updates, deletes) are added to this transaction until it is closed either by the SaveChanges() or ClearChanges() methods which respectively commit or rollback the transaction. If your scenario allows it, you can design your application in such way that there would always be a single change to the context which would be pushed to the database. For more information about the related features of our Context API you can check the Handling Transactions and Tracking Context Changes articles in our documentation.
Due to those design decisions in the product, in order to achieve a more fine-grain change handling, it should be implemented above the OpenAccessContext, in a layer or a derived wrapper class that takes care for calling SaveChanges or FlushChanges for each change that is performed.
If possible, could you provide details for your scenario so that we may better advise you on the possible approaches?
I am looking forward to your feedback.
Regards,
Kristian Nikolov
Telerik
OpenAccess ORM Q3 2013 Beta is available for immediate download in your account. Get it now and play with the latest bits. See what's new >>
0
Armin
Top achievements
Rank 1
answered on 24 Oct 2013, 07:40 AM
My Problem is that i
can edit two different records at the same time.
Scenario : two different records(Record A and Record B) in edit mode
Now the user want reject record A and save record B.
The problem is RejectChanges() flush all changes
and SaveChanges() save all.
Is it possible to read the changes and save/delete the selected record.
with best regard
can edit two different records at the same time.
Scenario : two different records(Record A and Record B) in edit mode
Now the user want reject record A and save record B.
The problem is RejectChanges() flush all changes
and SaveChanges() save all.
Is it possible to read the changes and save/delete the selected record.
with best regard
0
Accepted
Hello Armin,
For scenarios like this, we recommend using several separate instances of the context class of your model. In your case you could have two instances of the context responsible for Record A and Record B respectively. This approach will allow you to have fine control over committing and rolling back transactions or just pushing changes to the database.
I hope this helps. In case you have additional questions, do not hesitate to get back to us.
Regards,
Kristian Nikolov
Telerik
For scenarios like this, we recommend using several separate instances of the context class of your model. In your case you could have two instances of the context responsible for Record A and Record B respectively. This approach will allow you to have fine control over committing and rolling back transactions or just pushing changes to the database.
I hope this helps. In case you have additional questions, do not hesitate to get back to us.
Regards,
Kristian Nikolov
Telerik
OpenAccess ORM Q3 2013 Beta is available for immediate download in your account. Get it now and play with the latest bits. See what's new >>