Thanks for the help so far. Yes, I do need the first - the banhandler has to be part of the overall uow, so I intend to do as @Ramon suggests and Try to seperate the transaction management and session creation/disposing logic from your application logic.
Are there any good practices on how to achieve that? This banHandler is initially created via IoC on application start and can't be created everytime, so I can't resolve/inject the session via IoC on every new call. I open a session at every new call, but not every call results in DB operations, so I can't open the transaction there, it would be a waste of resources. I am using "thread_static" as the SessionContext, but now I questioning whether that should be "call". Apart from NH reference documentation do you know any other good source of information here? Alex On 30 April 2012 12:28, Maximilian Raditya <[email protected]> wrote: > Looking at his code and understanding from the way he expected the code to > behave, I think it's the first. That's why I suggest him to remove the > transaction code in BanHandler.Handle(Ban). He should only get active > ISession there and let the outer ITransaction handles the transaction (in > the QueryManager/Windows Service-level exposed API). > > > > > > On Mon, Apr 30, 2012 at 3:30 PM, Ramon Smits <[email protected]>wrote: > >> On Mon, Apr 30, 2012 at 10:25 AM, Maximilian Raditya <[email protected]>wrote: >> >>> I couldn't agree more then. Well, I personally don't use it, as I use >>> Castle NHibernate Integration for resolving it. It's just since the OP has >>> already used it, I choose to continue it from what he's done. >>> >> >> True, that is why the OP should decide whether the banhandler is part of >> the overal uow or it is not. If it is the first, the he should remove the >> transaction management in the ban handler to rely on the overal transaction >> or keep it seperate and let it create its own nhibernate session. >> >> Ramon >> >> -- >> You received this message because you are subscribed to the Google Groups >> "nhusers" 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/nhusers?hl=en. >> > > > > -- > Regards, > > Maximilian Haru Raditya > > -- > You received this message because you are subscribed to the Google Groups > "nhusers" 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/nhusers?hl=en. > -- You received this message because you are subscribed to the Google Groups "nhusers" 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/nhusers?hl=en.
