I have a simple service which loads users specific data into session
on session start.
if I place this code in the global.asax  session_start member it loads
fine. abstracting this away from the http context. I created a
UserStartUp service which takes IEngineContext and IUserRepository as
ctor args.

I then created a sub dependency resolver to resolve the context
engine. which is basically an adapter around
MonorailHttpHandlerFactory.CurrentEngineContext.

however when my application starts I get an null reference exception
at
context.Session[key] = value;

the context is created, but session is null.

I call the UserStartUp service in
Global : HttpAppliation
{
         public void Session_Start(...)
         {
                  Container.Resolve<IUserStartUp>().start();
         }
}

[Transient]
UserStartUp : IUserStartUp
{
         //ctor args

         public void start()
         {
                  var id = context.CurrentUser.Identity.Name;
                  context.Session[key] = repository.get(id).name;
         }
}

again, if the code is placed directly in the Session_Start member it
works. however if I move the code into a service and call the service
from Session_Start, session is null.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" 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/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to