Hi the following lump of code throws a null exception because the .Current value is set to null (line 6). Could someone please help me understand why? I've taken this from a previous working project..
Code:
private static ISessionFactory SessionFactory
{
get
{
ISessionFactory sessionFactory = null;
sessionFactory = HttpContext.Current.Application["sessionFactory"] as ISessionFactory;
if (sessionFactory == null)
{
Configuration configuration = new Configuration().Configure();
sessionFactory = configuration.BuildSessionFactory();
HttpContext.Current.Application.Add("sessionFactory", sessionFactory);
}
return sessionFactory;
}
}
Comment