Yes, that's the most used pattern.
Why is it a good idea? Because it works :-)
A web request correlates pretty well with a NH session, as they both
represent a conversation, a (business) transaction, a unit of work.
So, it makes sense to make them have a similar lifetime.
Diego
On Sun, Aug 29, 2010 at 23:41, Thiago Alves <[email protected]> wrote:
> How about session-per-request in asp.net applications? Is it a good idea?
> Why?
>
>
> On Sun, Aug 29, 2010 at 11:23 PM, Diego Mijelshon
> <[email protected]>wrote:
>
>> Yes, that's a terrible idea for these reasons and many more:
>> - If there's an error in any session and for any reason, you have to close
>> the application.
>> - Performance will slow to a crawl after a while.
>>
>> A usual pattern is session per view(model)
>>
>> Diego
>>
>>
>>
>> On Sun, Aug 29, 2010 at 20:22, Kevin Anderson <[email protected]
>> > wrote:
>>
>>> What are the implications of having one session (managed by IOC) that is
>>> shared by the whole application?
>>>
>>> We have a WPF, MVVM application that originally used one session for each
>>> call to the repository, but found that we couldn't lazy load anything
>>> because the session was gone. We moved the session of the view model but
>>> found that in some instances a given object was being held in two different
>>> sessions. We then tried moving the session all the way up to the IOC and
>>> found that performance was fantastic.
>>>
>>> I am concerned that there will be negative impacts from having one
>>> session open for the lifetime of the application.
>>>
>>> Any thoughts?
>>>
>>> Thanks.
>>> Kevin
>>>
>>> --
>>> 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.
>>>
>>>
>> --
>> 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.
>>
>
> --
> 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.
>
--
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.