This is a migrated thread and some comments may be shown as answers.
Order of saving of objects in a DB.
1 Answer 24 Views
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Ivan
Top achievements
Rank 1
Ivan asked on 04 Mar 2010, 01:41 PM
Hi All

private void Method (MyObj persistentObj)  
{  
   scope.Transaction.Begin();  
 
   scope.Remove(persistentObj);  
 
   MyObj objNew = new MyObj {a = persistentObj.a, b = persistentObj.b};  
   scope.Add(obj);  
 
   scope.Transaction.Commit();  

Here, in a DB at first there will be create a new object (objNew), then the old will be remove (persistentObj).

Can I to change this order?

Thanks

1 Answer, 1 is accepted

Sort by
0
Jan Blessenohl
Telerik team
answered on 05 Mar 2010, 09:57 PM
Hi Ivan,
We have to execute all inserts before all updates, before all deletes to get all fk references updated in the right way. This leads to the limitation that you see, sorry. You have to use 2 transactions.

Sincerely yours,
Jan Blessenohl
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Development (API, general questions)
Asked by
Ivan
Top achievements
Rank 1
Answers by
Jan Blessenohl
Telerik team
Share this question
or