Yes, Resolves. Thanks Henrik. On Mon, Jun 6, 2011 at 11:03 AM, Henrik Feldt <[email protected]> wrote:
> Yes, that’s correct and by design in the new version. > > > > However, > > > https://github.com/haf/Castle.Facilities.NHibernate/blob/master/src/Castle.Facilities.NHibernate/NHibernateFacility.cs > > > https://github.com/haf/Castle.Facilities.NHibernate/blob/master/src/Castle.Facilities.NHibernate/DefaultSessionLifeStyleOption.cs > > Finally if you want it transient and not PWR, specify that in your > dependencies: > > > > Component.For …().DependsOn(Key.Named(“MySessionFactory” + > NHibernateFacility.SessionTransientSuffix) > > > > Doesn’t this solve your issues? > > > > Regards, > > Henrik > > > > > > *From:* [email protected] [mailto: > [email protected]] *On Behalf Of *Berke Sokhan > *Sent:* den 6 juni 2011 15:32 > > *To:* [email protected] > *Subject:* Re: Transaction on a Service Layer > > > > BTW Henrik, > > If you remember our last discussion about transactions and how I dont want > to use AutoTx attributes on my service class... and if you remember I did > start NH transactions with WCF context classes in my sample codes. > > Well, it didnt work. I am getting exceptions form my repo classes (which I > inject Func<Session> objects) that saying I should use Transaction atrribute > or something like that implying a transaction must be opened. > > 2011/6/6 Henrik Feldt <[email protected]> > > Correct. > > > > Version 3.0 does away with that requirement, but right now, it’s beta (and > running in production I might add) and I’m making a lot of changes to the > file API. > > > > You can ‘see’ if you’re in a transaction through the call stack if you > place a break-point in the method. > > > > Cheers > > > > *From:* [email protected] [mailto: > [email protected]] *On Behalf Of *Berke Sokhan > *Sent:* den 5 juni 2011 15:29 > *To:* [email protected] > *Subject:* Re: Transaction on a Service Layer > > > > 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. > > -- > 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. > > -- > 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. > -- 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.
