I think you also need to add Transactional attribute to the class.

2011/6/5 Glauber <[email protected]>

> Hi,
>
> I've a project structure where my service layer access my model
> (NHibernate) layer. The model has a generic Repository. I'm using
> NHibernateIntegration.NHibernateFacility and
> AutoTx.TransactionFacility. Above service there is a monorail MVC
> structure.
>
> I need to make a transaction on a service method. Does anyone know the
> syntax to do that? I tryed this:
>
> public class SomeService : ISomeService
>    {
>        IRepository<Cond> mCondRep;
>        IRepository<User> mUserRep;
>        IRepository<State> mStateRep;
>
>        public SomeService (IRepository<Cond> condRep,
> IRepository<Usuario> userRep, IRepository<State> stateRep)
>        {
>            mCondRep = condRep;
>            mUserRep= userRep;
>            mStateRep = stateRep;
>        }
>
>        [Transaction(TransactionMode.Requires)]
>        public virtual void Insert(Cond cond, User user)
>        {
>            mCondRep.Insert(cond);
>            mUserRep.Insert(user);
>        }
>    }
>
> But when the mUserRep.Insert fails mCondRep dosen't rollback. Do I
> have to use an open session in a using block? Or a transaction? How
> would be the syntax to ensure the transaction?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Castle Project Users" group.
> To post to this group, send email to [email protected]
> .
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/castle-project-users?hl=en.
>
>


-- 
Berke SOKHAN.

http://twitter.com/berkesokhan
http://blog.berkesokhan.com
http://www.birliktegelistir.com/editors.aspx

-- 
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en.

Reply via email to