/// <summary> /// Make a transient instance persistent. This operation cascades to associated /// instances if the association is mapped with <tt>cascade="persist"</tt>.<br/> /// The semantics of this method are defined by JSR-220. /// </summary> /// <param name="obj">a transient instance to be made persistent </param> void Persist(object obj);
In addition I can say that Persist will assign the POID to the graph. P.S. take care on what the comment say. 2010/3/24 Jason Meckley <[email protected]> > Fabio, are you saying session.persist for saving the task (HiLo POID) > or the pvm? > > On Mar 24, 5:29 pm, Fabio Maulo <[email protected]> wrote: > > Use session.Persist instead session.Save but take care with > session.Persist > > if you aren't using XML to map NH.... well I mean if you are not using > > neither XML nor ConfORM. > > > > 2010/3/24 Jason Meckley <[email protected]> > > > > > > > > > I am spiking an example of CQRS as described by Udi. I am using rhino > > > service bus to process commands and then fire events in the domain. > > > I'm using a 'To Do List' for the spike > > > > > public void Consume(NewQuickTask message) > > > { > > > var task= > > > session.Get<User>(message.UserId).AddTask(message.Title); > > > domainEvents.Raise(new QuickTaskAdded{Task= task}); > > > } > > > > > where domainEvents.Raise() will resolve all the Handles<T> from the > > > container and execute against each one. for example > > > class InsertNewQuickTaskIntoPersisentViewModel: > > > Handles<QuickTaskAdded> > > > { > > > public void Handle(QuickTaskAdded arg) > > > { > > > var pvm = mapper.Map<Task, ListOfItemsToDo>(arg.Task); > > > session.Save(pvm); > > > } > > > } > > > > > ListOfItemsToDo uses the assigned POID. this way it has the same id as > > > the Task in the domain. Task uses HiLo POID. I know I can call > > > session.Save(new Task()); to get the id, but I'm adding the Task to > > > the User to avoid the explicit call to session. > > > > > however I need the id from Task to insert new records into the PVM > > > (persistent view model). Is there another way to do this with HiLo? I > > > could probably use Guid.Comb, but I prefer numbers since they are > > > easier to read when logging and generating urls. I'm trying to avoid > > > database POID strategies for now. > > > > > -- > > > 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]> > <nhusers%[email protected]<nhusers%[email protected]> > > > > > . > > > For more options, visit this group at > > >http://groups.google.com/group/nhusers?hl=en. > > > > -- > > Fabio Maulo > > -- > 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. > > -- Fabio Maulo -- 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.
