Not for me, I will help you. But first I need to finish my work, make loads
of money, and then I'll be able to do more complex oss pending tasks.

2009/10/6 justin coon <[email protected]>

> Is this dead?
>
>  ------------------------------
> *From:* webpaul <[email protected]>
> *To:* nhusers <[email protected]>
> *Sent:* Friday, October 2, 2009 10:59:00 AM
>
> *Subject:* [nhusers] Re: WPF BackgroundWorker and NHibernate
>
>
> Make a simple throw away winforms app which submits the request in the
> background thread so we can see all the repository/session stuff you
> are doing in one place. My suspicion though is that once you do that
> you will see the issue yourself.
>
> Keep all the repository/nhibernate stuff in the Process method,
> dispose everything before leaving. In WhenFinished you should only be
> dealing with already populated objects, no DB calls should be
> submitted once you are in that part of the code.
>
> On Oct 2, 10:21 am, justin coon <[email protected]> wrote:
> > Great replies, however im not doing any lazy loading at all, just for
> that purpose, so that I grab everything at once. There must be something
> else Im doing wrong, cause I dont have any Lazy=true attributes set anywhere
> and that is by design in order to help me to be able to do exactly what we
> are trying to accomplish here...do nHibernate stuff on a background
> thread....any more thoughts? =\
> >
> > ________________________________
> > From: webpaul <[email protected]>
> > To: nhusers <[email protected]>
> > Sent: Friday, October 2, 2009 9:38:08 AM
> > Subject: [nhusers] Re: WPF BackgroundWorker and NHibernate
> >
> > Actually, after looking at your original post, I think the issue may
> > be that you have a lazy initialized object or collection and you are
> > accessing it after you have disposed the session or connection
> > somehow. You may want to look into not using lazy init, getting back
> > all the data you need to display at once in the background thread, and
> > then displaying it on the main thread.
> >
> > I reread some of your responses and it looks like you are trying to
> > take advantage of lazy loading, but I don't know what advantage there
> > is to be had in this scenario. If you continue to use lazy loading
> > you're going to have DB requests going out on the main thread as
> > things are accessed. For the most part I try to keep all that on the
> > background thread so it doesn't tie up the UI which means not using
> > lazy loading in this scenario.
> >
> > On Oct 2, 9:32 am, webpaul <[email protected]> wrote:
> >
> >
> >
> > > In the .process you do the work, i.e. using(var repository = new
> > > WhateverRepository()) { return repository.GetAll(); }
> >
> > > In the WhenFinished, you take that IList and bind it or do whatever
> > > you need to with it. Same story with updates, except I tend to just
> > > return the count of things updated and display that to the user
> > > instead of the list of businessobjects.
> >
> > > I don't share sessions among repositories unless they need to
> > > participate in the same transaction so I don't run into the problem of
> > > needing to worry about multiple threads accessing the same session
> > > using this method. After reading the other separate post made today I
> > > think this is pretty similar to the option he is suggesting with the
> > > asyncmethod attribute.
> >
> > > On Oct 1, 4:35 pm, justin coon <[email protected]> wrote:
> >
> > > > webpaul,
> >
> > > > Refreshing an activerecord business object with the code i grabbed
> from your post results in this exception.
> > > > "There is already an open DataReader associated with this Command
> which must be closed first"
> > > > All im doing is calling a method thats calls .Refresh() on my
> business object in the .Process() => and then it returns an int (since it
> doesnt support methods with void return type."
> >
> > > > using
> > > > {
> > > > executer
> > > > .Process(() =>
> > > > {})
> >
> > > > .WhenFinished(businessObject =>
> > > > {
> > > > BuildInvoiceViewModels();
> >
> > > > })
> > > > .Run();
> > > > }
> > > > }
> > > > }
> > > > {
> > > > }intGetData()this.EndUser.Refresh();return1;(ThreadedExecuter<int>
> executer = newThreadedExecuter<int>(this))returnGetData();
> >
> > > > Any thoughts?
> >
> > > > ________________________________
> > > > From: justin coon <[email protected]>
> > > > To: [email protected]
> > > > Sent: Thursday, October 1, 2009 4:12:06 PM
> > > > Subject: [nhusers] Re: WPF BackgroundWorker and NHibernate
> >
> > > > webpaul,
> >
> > > > thanks so much for your input...however i dont see you using
> nHibernate in your example..this is the kicker to the problem. Nhibernate
> sessions are associated with a thread and thats whats causing the problems
> for me....do you know about nHibernate and doing things on another thread?
> > > > Appreciate your help and input very much!!
> >
> > > > Justin
> >
> > > > ________________________________
> > > > From: webpaul <[email protected]>
> > > > To: nhusers <[email protected]>
> > > > Sent: Thursday, October 1, 2009 3:58:27 PM
> > > > Subject: [nhusers] Re: WPF BackgroundWorker and NHibernate
> >
> > > > I use this on all my winform projects for putting requests on the
> > > > background thread (including nhibernate ones) and then getting the
> > > > results when it is done, without having to mess with invokerequired
> or
> > > > anything.
> >
> > > >http://www.codeproject.com/KB/threads/ThreadedExecuter.aspx
> >
> > > > On Oct 1, 10:02 am, José F. Romaniello <[email protected]>
> wrote:
> >
> > > > > I've been very busy this weeks, I will write about it, be patient
> please.
> >
> > > > > 2009/9/30 justin coon <[email protected]>
> >
> > > > > > I would LOVE LOVE LOVE to see someone demonstrate how to do
> > > > > > multithreading with nHibernate on a desktop app(in particular a
> WPF
> > > > > > app)
> >
> > > > > > Ive been at 2 employers, both which would like to figure out if
> this
> > > > > > is possible, and if so, how to implement it. Right now i would be
> > > > > > happy with being able to do things in a background worker like
> the OP,
> > > > > > but i ran in to the exact same issues. Any chance Jose of you
> posting
> > > > > > some code? I would be so en debted.
> >
> > > > > > Thanks
> > > > > > Justin- Hide quoted text -
> >
> > > > > - Show quoted text -- Hide quoted text -
> >
> > > > - Show quoted text -- Hide quoted text -
> >
> > > - Show quoted text -- Hide quoted text -
> >
> > - Show quoted text -
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to