How to working with transaction

Mar 24, 2010 at 7:58 PM

Dear sir

   How to implement XmlDataMapper with transaction?

Thank you in advance

Mar 29, 2010 at 9:09 AM

Hi J Deva,

If your intention in using XmlDataMapper is to just convert your DataReader / DataTable / DataRow into DTOs/ BusinessEntities then transactions are not relevant in the scenario.
What I mean is that even if you use or not use transactions the DTOConverter will work. Check the documentation tab for the sample implementation or download the sample project  XmlDataMapper_with_example_using_ConsoleClient.zip from the downloads tab.

But if you are using the BaseDataHelper provided to retrieve or update/insert/delete data and you want to use transactions there then you can use the below code.

using (DbHelper baseDataHelper = new DbHelper(true)) //true indicating that you want to enlist in transaction
{
   recordsAffected = baseDataHelper.ExecuteNonQueryInstance(“SpNameHere”, paramList, false);
  // use any other method of baseDataHelper.<methodName>
  //And finally call 
   baseDataHelper.Commit();
}

//Use the above code only if you want to use the DataAccess helper class BaseDataHelper, don’t use this if you are using only the DTOConverter