Thank you for your feedback! In my opinion blocking the UI should never be considered. But I don't really understand your second suggestion. Wouldn't that result in something like Conversation-per-Business- Transaction and not Conversation-per-Presenter?
The approach I'm pursuing now is the following: 1) Inject a custom implementation of AbstractConversation in all Presenters that need to do work with the database. 2) I no longer use SessionContexts and the ISessionFactory.GetCurrentSession() method. Instead I manage the lifetime of my Sessions through the Conversation, so there is always exactly one conversation (and session) per presenter. 3) If i want to persist changes, I call Conversation.Pause() - if I want to undo changes I call Conversation.Abort(). 4) Datachanges have to be communicated with events to subscribed presenters which have to reload the corresponding data. Now I can use the same conversation in UI, BackgroundWorkers and any other threads. Did a quick proof of concept with 3 presenters and it works great by now. Best Regards, Sebastian On 4 Jan., 17:05, Gustavo Ringel <[email protected]> wrote: > What you can do is managing the persistence only in the background thread, > and not using persistence from the UI, that will work. > > Gustavo. > > On Tue, Jan 4, 2011 at 5:49 PM, Gustavo Ringel > <[email protected]>wrote: > > > AFAIK this is a limitation of the approach, if you need the same session > > you should use the GUI Thread. Meaning you should block... > > > Gustavo. > > > On Tue, Jan 4, 2011 at 3:27 PM, Børgi <[email protected]> wrote: > > >> Hello! > > >> What I want to accomplish is Conversation-per-Presenter. > >> I'm done with the Castle.Windsor SessionFactory / Dao magic, so I can > >> inject ready to use Daos in my Presenters. > > >> It all works fairly well as long as I don't use Backgroundworkers for > >> data-queries. > >> I didn't think about this before, but now it's clear to me: accessing > >> my Daos in BackgroundWorker-Threads always results in a fresh > >> conversation / session because of the > >> ThreadLocalConversationalSessionContext. > > >> Is there a way to use only one conversation / session on the whole > >> form and also be able to use Backgroundworker? > >> Could somebody direct me in the right direction please? > > >> Best Regards, > >> Sebastian > > >> -- > >> 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]<nhusers%[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.
