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

CRUD best solution

1 Answer 79 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.
Michal Ogluszka
Top achievements
Rank 1
Michal Ogluszka asked on 02 Jul 2009, 11:23 AM
Hi,

 in our latest project we have decided to use OpenAccess, really nice tool, but I have a question. How would You suggest to organize CRUD operations. In fact the biggest problem I have to face is update. If I understand correctly Update of an object has to be between Transaction.Begin(), Commit?

If so do I need to always select this object from the database (i.e. extent.FirstorDefault or whatever) and than copy all updated properites from the object outside the begin-commit block? Or maybe there is better solution...

Greetings
M.

1 Answer, 1 is accepted

Sort by
0
Alexander
Telerik team
answered on 03 Jul 2009, 09:46 AM
Hello Michal,

Yes, all the updates should be made during an active transaction. What I can suggest you to make the process easier is using scope.TransactionProperties.AutomaticBegin = true. When this option is enabled, a transaction is automatically started after Commit() or Rollback(). However, you will still have to call manually scope.Transaction.Commit() to persist the changes.
You are right about the second question as well. If you have an object which is not 'attached' to an object scope, its changes could not be tracked and you will have to copy them manually to the actual object.

Sincerely yours,
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
Michal Ogluszka
Top achievements
Rank 1
Answers by
Alexander
Telerik team
Share this question
or