Work with transactions

Thread is closed for posting
2 posts, 1 answers
  1. Andrey
    Andrey avatar
    21 posts
    Member since:
    Aug 2010

    Posted 03 Jun 2011 Link to this post

    Hello Telerik team!

    I get data from DB from several tables.

      public List<T> Get<T>(bool lazy = true) 
                IEnumerable<T> result = scope.Extent<T>().Where(predicate);
                return lazy ? result.ToList() : RetreiveData(result).ToList();

    var patientList = Get<Patient>();

    var configurationList = Get<Configuration>();

    so, I have some lists for necessary data. And I work with it. During my work some data can be changed.

    Configuration - it is some visual settings for EditPatientForm (e.g. what Edit-fields are visible - user can switch off not important fields)

    And when user click on button "Save" - I need Save only PATIENT data, but not changed configuration data. Because for save Configuration we have another button (like "Save configuration")

    But both entities are on the scope, so when I call Transaction.Commit() - all data will be saved.

    But I don't want save Configurations. 

    What I should do?

    I need independent transaction for each entity?? It seems not correct..

    Ask me please, What I should do!


  2. Answer
    Serge avatar
    375 posts

    Posted 13 Jun 2011 Link to this post

    Hi Andrey,

    First of all I would like to apologize for the late reply. We weren't able to attend to your ticket sooner and I would like to assure you that this will not happen again. 

     The basis behind a transaction is that it atomic an it cannot be split. So all the changes that you have tracked by one transaction will be committed at once when you commit the transaction. Unfortunately there is no way to tell the transaction which objects it should track.

    In order to achieve your goal you will most probably need to use different transactions, however that shouldn't be too much of a hassle and I guess it will be easily implemented.

    I hope this helps and again I would like to apologize for the late reply. Please do not hesitate to let us know if you need more information or face further trouble. 

    the Telerik team
    Q1’11 SP1 of Telerik OpenAccess is available for download; also available is the Q2'11 Roadmap for Telerik OpenAccess ORM.
Back to Top