Hope I have understood your question. We use for transactions
(specially for rollback the entire insertion/updates in case of error)
the following


ISqlMapper sqlMapper = Mapper.Instance();
sqlMapper.BeginTransaction();

try {
... our inserts/updates/deletes directly goes here. For example, if
the class User has his own method User.Save() that uses iBatis, just
copy & paste the insert statement here:

sqlMapper.Insert("InsertUser", userObject);

in replace of

(Class User) sqlMapper.Insert("InsertUser", this);

... another insertions
...
if(some logical business error)
 throw new Exception("Error in some part");

// If everithing OK:
sqlMapper.CommitTransaction(true);
}
catch (Exception ex)  {
sqlMapper.RollBackTransaction(true);
throw ex
}



2008/6/30, Vincent Apesa <[EMAIL PROTECTED]>:
>
>
> Sal,
>    In our application we wrap calls the repository using the 
> System.Transactions built into .Net 2.0 in the Service layer. It works across 
> multiple databases and manages a few other types of operations as well 
> (email..etc).
>
> Vince
>
>
> ________________________________
From: [EMAIL PROTECTED]
> To: [email protected]
> Subject: Managing Transactions
> Date: Sun, 29 Jun 2008 17:53:56 -0400
>
>
>
> Hello,
>
> In my application, I am using ibatis inside my repository classes. I interact 
> with the repository classes in my service layer, and am wondering if there is 
> anything special I need to do to managing transactions. Meaning, in my 
> service layer classes, can I just wrap calls to repository methods inside a 
> TransactionScope? Or, is there a another suggested pattern for doing this? I 
> will need to have multiple calls to different repository methods in one 
> transaction.
>
> Thanks,
> Sal
>
> ________________________________
The other season of giving begins 6/24/08. Check out the i'm
Talkathon. Check it out!
> ________________________________
Earn cashback on your purchases with Live Search - the search that
pays you back! Learn More

Reply via email to