【问题标题】:configure Castle Windosor and generic配置温莎城堡和通用
【发布时间】:2010-02-16 10:27:45
【问题描述】:

这是我在 Global.asax 中的代码

 WindsorContainer container = new WindsorContainer();
container.Register(Component.For(typeof(IRepository<>))
                                       .ImplementedBy(typeof(NHRepository<>))
                                       .LifeStyle.Transient)

我试图用这个将它翻译成一个 xml 配置文件,但没有成功

<component id="NHRepository"
           service="NCommon.Data.IRepository'1, NCommon"
           type="NCommon.Data.NHibernate.NHRepository'1, NCommon.NHibernate"
           lifestyle="transient">
</component>

如何将此代码转换为 Windsor.config 配置文件中的代码?

坦克 米尔科

【问题讨论】:

标签: castle-windsor


【解决方案1】:

你需要使用backticks,而不是apostrophes

<component id="NHRepository"
           service="NCommon.Data.IRepository`1, NCommon"
           type="NCommon.Data.NHibernate.NHRepository`1, NCommon.NHibernate"
           lifestyle="transient">
</component>

【讨论】:

  • 好一个。我没注意到;)
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多