This project is read-only.

transaction management

Jun 16, 2012 at 5:14 AM

Hello!

how can we perform transaction management in iris generator ?

for example ,

i want to perform following task.

 

try

{

                 Begin Transaction

                             table1.insert();

                             table2.insert();

                 Commit Transaction

}

catch

{

            Rollback transaction

}

In above example Table1.insert() and Table2.insert() should be considered as single transaction.

 

How can we do this ?

Aug 30, 2012 at 8:02 PM

Hello,

 

unfortunately this case is not handled. Nonetheless i've checked the code and i think you can manage it this way:

Each dataaccess class has a reference to a "mini framework" dataaccess class. Each time you create an instance of a dataaccess class (table1 and table2 in your sample), a new instance of the "framework" class is instanciated which is not the comportement you need. Therefore, you can create a new constructor which accepts a DataAccess class object and assign it to the private _dataAccess variable ,which will turn to be public also. You will then be able to do something like this:

table1 t1= new table1; ==> the _dataAccess variable is instanciated

t1._dataAccess.BeginTransaction();

t1.Insert();

table2 t2=new table2(t1._dataAccess);

t2.Insert();

t1._dataAccess.Commit(); Or Rollback.

I know this is ugly, but if you want a cleaner solution, you will have to modify much more code.

Regards