Fernando,
ICurrentSessionContext <==== the solution for every session-management

I'm using same Repository/DAO/EQO in web, tests and WCF without need any
external reference... well... NH + uNhAddIns even if uNhAddIns is only to
avoid copy&paste

On Fri, Sep 3, 2010 at 12:19 AM, Fernando Zago <[email protected]> wrote:

> yes, is where i prefered to save it. but it can be used in a non static
> variable too....
>
> ---
> Fernando Amadeu Zago
> Desenvolvedor Arquiteto
> Mult-e – People, solutions and technology
> http://www.mult-e.com.br/
>
>
> On Fri, Sep 3, 2010 at 12:14 AM, Fabio Maulo <[email protected]> wrote:
>
>> The code you have posted here has
>>  private static ISession _Static_Session;
>>
>> On Fri, Sep 3, 2010 at 12:05 AM, Fernando Zago <[email protected]> wrote:
>>
>>> hmm... ok, but... the peace of code that i've posted does not include the
>>> "manager" of ISession and Config variables...
>>>
>>> my session manager use session-per-request in webapp
>>> and
>>> conversation-per-business (using(Session) {  })
>>>
>>>
>>> ---
>>> Fernando Amadeu Zago
>>> Desenvolvedor Arquiteto
>>> Mult-e – People, solutions and technology
>>> http://www.mult-e.com.br/
>>>
>>>
>>> On Thu, Sep 2, 2010 at 11:33 PM, Fabio Maulo <[email protected]>wrote:
>>>
>>>> Done too many times.
>>>> http://fabiomaulo.blogspot.com/2009/04/empezando-con-nh-session.html
>>>> --
>>>> Fabio Maulo
>>>>
>>>>
>>>> El 02/09/2010, a las 22:44, Fernando Zago <[email protected]> escribió:
>>>>
>>>>  Fabio,
>>>> can you explain better why ?
>>>>
>>>> ---
>>>> Fernando Amadeu Zago
>>>> Desenvolvedor Arquiteto
>>>> Mult-e – People, solutions and technology
>>>> <http://www.mult-e.com.br/>http://www.mult-e.com.br/
>>>>
>>>>
>>>> On Thu, Sep 2, 2010 at 7:31 AM, Fabio Maulo < <[email protected]>
>>>> [email protected]> wrote:
>>>>
>>>>> Fernando,
>>>>> If you are using it in winform or in tests your implementation is a
>>>>> TIME BOMB.
>>>>>
>>>>> On Wed, Sep 1, 2010 at 11:21 PM, Fernando Zago < <[email protected]>
>>>>> [email protected]> wrote:
>>>>>
>>>>>> My session manager implementation do something like this, but, just
>>>>>> for winforms and web application....
>>>>>>
>>>>>> check it out the implementation for the property that holds a
>>>>>> Configuration class from nhibernate
>>>>>>
>>>>>>         private static Configuration _Static_Configuration;
>>>>>>         public static Configuration Configuration
>>>>>>         {
>>>>>>             get
>>>>>>             {
>>>>>>                 if (HttpContext.Current != null &&
>>>>>> HttpContext.Current.Application != null)
>>>>>>                     return
>>>>>> (Configuration)HttpContext.Current.Application["nHibernate_Configuration"];
>>>>>>                 else
>>>>>>                     return _Static_Configuration;
>>>>>>             }
>>>>>>             set
>>>>>>             {
>>>>>>                 if (HttpContext.Current != null &&
>>>>>> HttpContext.Current.Application != null)
>>>>>>
>>>>>>  HttpContext.Current.Application["nHibernate_Configuration"] = value;
>>>>>>                 else
>>>>>>                     _Static_Configuration = value;
>>>>>>             }
>>>>>>         }
>>>>>>
>>>>>> as the same, but with a little difference, a ISession interface but in
>>>>>> a Current.Session from a HttpContext
>>>>>>
>>>>>>         private static ISession _Static_Session;
>>>>>>         public static ISession Session
>>>>>>         {
>>>>>>             get
>>>>>>             {
>>>>>>                 if (HttpContext.Current != null &&
>>>>>> HttpContext.Current.Session != null)
>>>>>>                     return
>>>>>> (ISession)HttpContext.Current.Session["nHibernate_ISession"];
>>>>>>                 else
>>>>>>                     return _Static_Session;
>>>>>>             }
>>>>>>             set
>>>>>>             {
>>>>>>                 if (HttpContext.Current != null &&
>>>>>> HttpContext.Current.Session != null)
>>>>>>                     HttpContext.Current.Session["nHibernate_ISession"]
>>>>>> = value;
>>>>>>                 else
>>>>>>                     _Static_Session = value;
>>>>>>             }
>>>>>>         }
>>>>>>
>>>>>>
>>>>>> so, it checks where to store the variable...
>>>>>> by the way, when "HttpContext.Current != null" means that we can use
>>>>>> it to store in a webapp HttpContext otherwise
>>>>>> store in a static variable from de (winform) Application....
>>>>>>
>>>>>> or, maybe...
>>>>>> you can do a "Configuration setting" in your Application that the
>>>>>> Session Manager can identify what to do....
>>>>>>
>>>>>> Sorry... my english is awful!
>>>>>> ---
>>>>>> Fernando Amadeu Zago
>>>>>> Desenvolvedor Arquiteto
>>>>>> Mult-e – People, solutions and technology
>>>>>> <http://www.mult-e.com.br/>http://www.mult-e.com.br/
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Tue, Aug 31, 2010 at 1:19 PM, Luka < <[email protected]>
>>>>>> [email protected]> wrote:
>>>>>>
>>>>>>> thank you guys, for the help and suggestions.
>>>>>>>
>>>>>>> On Aug 31, 5:52 pm, Fabio Maulo <[email protected]> wrote:
>>>>>>> > What you have to do is implements ICurrentSessionContext and then
>>>>>>> configure
>>>>>>> > it through session-factory configuration in each scenario.
>>>>>>> > Everything is already done.
>>>>>>> >
>>>>>>> >
>>>>>>> >
>>>>>>> >
>>>>>>> >
>>>>>>> >
>>>>>>> >
>>>>>>> >
>>>>>>> >
>>>>>>> > On Tue, Aug 31, 2010 at 11:21 AM, Luka <[email protected]> wrote:
>>>>>>> > > Hi,
>>>>>>> > > I am trying to build an universal session manager that will work
>>>>>>> in
>>>>>>> > > these scenarios:
>>>>>>> > > WinForm Application
>>>>>>> > > Asp.NET application (web)
>>>>>>> > > WCF services
>>>>>>> >
>>>>>>> > > Is there any suggestion or is there any project like this one?
>>>>>>> >
>>>>>>> > > --
>>>>>>> > > You received this message because you are subscribed to the
>>>>>>> Google Groups
>>>>>>> > > "nhusers" group.
>>>>>>> > > To post to this group, send email to <[email protected]>
>>>>>>> [email protected].
>>>>>>> > > To unsubscribe from this group, send email to
>>>>>>> > > <nhusers%[email protected]>
>>>>>>> [email protected]<
>>>>>>> nhusers%[email protected]<nhusers%[email protected]>
>>>>>>> >
>>>>>>> > > .
>>>>>>> > > For more options, visit this group at
>>>>>>> > > <http://groups.google.com/group/nhusers?hl=en>
>>>>>>> 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]>
>>>>>>> [email protected].
>>>>>>> To unsubscribe from this group, send email to
>>>>>>> <nhusers%[email protected]>
>>>>>>> [email protected].
>>>>>>> For more options, visit this group at
>>>>>>> <http://groups.google.com/group/nhusers?hl=en>
>>>>>>> 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]>
>>>>>> [email protected].
>>>>>> To unsubscribe from this group, send email to
>>>>>> <nhusers%[email protected]>
>>>>>> [email protected].
>>>>>> For more options, visit this group at
>>>>>> <http://groups.google.com/group/nhusers?hl=en>
>>>>>> 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]>
>>>>> [email protected].
>>>>> To unsubscribe from this group, send email to
>>>>> <nhusers%[email protected]>
>>>>> [email protected].
>>>>> For more options, visit this group at
>>>>> <http://groups.google.com/group/nhusers?hl=en>
>>>>> 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.
>>>>
>>>>  --
>>>> 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.
>>>
>>
>>
>>
>> --
>> 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.
>>
>
>  --
> 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