Hey.

I think I don't explain myself too well.

If I'm saving the children as you proposed

var children = session.get<Entity>(id).Children;
foreach(var child in children)
{
     Change(child);

}

I don't need NH events at all. I simply fire an event each time I
perform a save (or each K times). This is what I'm already doing.
However, I don't like doing something that NH is supposed to do (save
complex objects) - because it will probably do it much better.  So,
I'd like to perform a single ISession.Save() and NH notify me when the
interesting stuff happens.

Thanks.

On Oct 27, 3:03 pm, Jason Meckley <[email protected]> wrote:
> what's not to like about NH events this is exactly what you are
> looking for. if you are updating a collection from an aggregate than
> the model described above will work.
>
> You are going from the data access layer to the UI. there is no magic
> object to do that automatically. you will need to wire that up.
>
> You mentioned that is' running on a background thread. therefore you
> will also need to marshal the call back the UI using either
> ISynchronizaInvoke or SynchronizationContext.
>
> var children = session.get<Entity>(id).Children;
> foreach(var child in children)
> {
>      Change(child);
>
> }
>
> a pre/post event will pick up the changes and send a notification back
> to the UI where you can tell the user about it.  This does seem like a
> good candidate for an event aggregator. the NH event would notify the
> aggregator of the change happened. the aggregator would then publish
> events to presenters that the change occurred. the presenter would
> update the UI.
>
> On Oct 27, 6:37 am, Vadgros <[email protected]> wrote:
>
> > typo, sorry.
> > meant to say - I CAN report the progress myself without the NH events.
> > I just don't want to. I'd rather save a complex data structure using
> > cascades and a single save() than write a method to go through
> > everything inside...
>
> > On Oct 27, 10:29 am, Sidar Ok <[email protected]> wrote:
>
> > > >> I cant report the progress myself without the NH events.
>
> > > Why can't you use events, say Pre/Post Insert ?
>
> > > On Tue, Oct 27, 2009 at 9:07 AM, Vadgros <[email protected]> wrote:
>
> > > > Hey.
>
> > > > Thanks for the responses.
>
> > > > Jason, if I'm doing something like:
>
> > > > foreach(var entity in entities)
> > > > {
> > > >       session.Save(entity);
> > > > }
>
> > > > I cant report the progress myself without the NH events.
>
> > > > Fabio - The process runs on a different thread and nothing gets stuck.
> > > > However, I hate operation that take more than several seconds and
> > > > don't show the progress. If i need to save 1000 entities, I want to
> > > > know when each one was saved and let the user know as well. I don't
> > > > want to perform a foreach but use cascades. So far, interceptors is
> > > > the only way I see and I don't like it.
>
> > > > On Oct 27, 7:25 am, Fabio Maulo <[email protected]> wrote:
> > > > > a ver...
> > > > > you have an UI issue.
> > > > > The UI hopefully is implemented using MVP.
> > > > > After that you have, probably, a service layer
> > > > > then some DAOs/Repositories
> > > > > the DAOs/Repositories is using NHibernate
>
> > > > > the solution you are looking for is ?
> > > > > and it is for ? give to the user something to watch during the save ?
> > > > > give him a link to youtube or perform the task in another thread, live
> > > > him
> > > > > continue working, and send him something when the task is done.
>
> > > > > 2009/10/26 Vadgros <[email protected]>
>
> > > > > > Hey.
>
> > > > > > I have a scenario where I have to save lots of items to the DB and 
> > > > > > it
> > > > > > takes a while. I'd like the user to get some sort of an indication 
> > > > > > of
> > > > > > the progress being made. The easiest way to implement it is iterate
> > > > > > over the items I need to save, save each one and report the 
> > > > > > progress.
> > > > > > But I'd like to let NH do the work.
>
> > > > > > The only thing I thought of was using Interceptors (each time this
> > > > > > object gets saved fire another event if needed) but I don't think 
> > > > > > this
> > > > > > is what they were meant to do.
>
> > > > > > Am I wrong? Is there another way of doing it?
>
> > > > > > Thanks.
>
> > > > > --
> > > > > Fabio Maulo
>
> > > --
> > > Sidar Ok
>
> > >http://www.sidarok.comhttp://www.twitter.com/sidarok
--~--~---------~--~----~------------~-------~--~----~
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