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]> 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/
>
>
>
> On Tue, Aug 31, 2010 at 1:19 PM, Luka <[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].
>> > > 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.
>>
>>
>  --
> 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