views:

439

answers:

1

This is my StructureMap bootstrapping:

ObjectFactory.Initialize(factory =>
{
  //Business Conversation is per session
  factory.ForRequestedType<IConversation>().
    TheDefaultIsConcreteType<Conversation>().
      CacheBy(InstanceScope.HttpSession);

  //Session Factory is life time
  factory.ForRequestedType<INHibernateSessionManager>().
    TheDefaultIsConcreteType<NHibernateSessionManager>().
      CacheBy(InstanceScope.Singleton);
});

var conversation = ObjectFactory.GetInstance<IConversation>();

When I have my Conversation set to use .CacheBy(InstanceScope.HttpSession), I get Object reference not found, however If I don't use the CacheBy it works fine. This needs to go into the session, I'm not really sure why this isn't working.

Am I doing something wrong or does this appear to be a bug in StructureMap?

+1  A: 

To answer my own question, yes this is bug in StructureMap. The bug is fixed in the trunk or will be fixed in any binary release of 2.5.3 or later.

Chris Marisic