StructureMap CacheBy InstanceScope.HttpSession不工作 [英] StructureMap CacheBy InstanceScope.HttpSession not working

查看:140
本文介绍了StructureMap CacheBy InstanceScope.HttpSession不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的StructureMap引导:

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>();

当我有我的会话设置为使用.CacheBy(InstanceScope.HttpSession),我得到的对象引用发现,但是,如果我不使用它工作正常的CacheBy。这需要进入会议上,我真的不知道为什么这是行不通的。

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.

难道我做错了什么或但这似乎是一个bug StructureMap?

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

推荐答案

要回答我的问题,是的,这是StructureMap错误。该错误是固定在树干或将被固定在2.5.3或更高版本的二进制版本。

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.

这篇关于StructureMap CacheBy InstanceScope.HttpSession不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆