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

Work with transactions

1 Answer 67 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.
Andrey
Top achievements
Rank 1
Andrey asked on 03 Jun 2011, 05:48 PM

Hello Telerik team!

I get data from DB from several tables.

  public List<T> Get<T>(bool lazy = true) 
        {
            CheckTransaction();
  
            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!

Thanks!

1 Answer, 1 is accepted

Sort by
0
Accepted
Serge
Telerik team
answered on 13 Jun 2011, 07:44 AM
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. 

Regards,
Serge
the Telerik team
Q1’11 SP1 of Telerik OpenAccess is available for download; also available is the Q2'11 Roadmap for Telerik OpenAccess ORM.
Tags
General Discussions
Asked by
Andrey
Top achievements
Rank 1
Answers by
Serge
Telerik team
Share this question
or