Order of saving of objects in a DB.

2 posts, 0 answers
  1. Ivan
    Ivan avatar
    1 posts
    Member since:
    Nov 2008

    Posted 04 Mar 2010 Link to this post

    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

  2. Jan Blessenohl
    Admin
    Jan Blessenohl avatar
    707 posts

    Posted 05 Mar 2010 Link to this post

    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.
  3. DevCraft banner
Back to Top