... however if you did want to do this then you'd need some framework
to manage the sessions for you.
the best way may be to wrap each Create within a method that manages
the session for you e.g. (semi pseudo-code)
Parallel.ForEach(() => { ServiceLayer.Create(entity); };
ServiceLayer.Create<T>(T entity)
{
try
{
NH.Session.Open();
//Do Stuff
}
finally
{
NH.Session.Close();
}
}
Or something along these lines. Make sure that the entity you pass is
either a DTO (safer IMO) or you attach it to the new session within
the Create method. There may be some quirks with the latter though.
I've done some multi-threaded stuff with NH but not a huge amount so
there might be a problem with the above... but I've done something
similar myself and, so far, no issues I've come across.
--
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.