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]>
> .
> 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.

Reply via email to