【问题标题】:Is it possible to move the container alias definitions into a separate file?是否可以将容器别名定义移动到单独的文件中?
【发布时间】:2011-12-12 11:38:37
【问题描述】:

我知道通过 configSource 包含配置部分:

Is there any way for an App.config file to reference another full config file? (.NET)

但这不是我想要的。

我有一个这样的容器配置:

<unity xmlns="http://schemas.microsoft.com/practices/2010/unity" >

  <alias alias="IFoo" type="Namespace.Foo,Foo.Interface.dll"/>
  <alias alias="Foo" type="Namespace.Foo,Foo.dll"/>

  <container name="myContainer">
    <register type="IFoo" mapTo="Foo" /> 
  </container>
</unity>

现在我想将别名定义移动到一个外部文件中并为他的容器引用它。像这样的:

<unity xmlns="http://schemas.microsoft.com/practices/2010/unity" include="AliasDefinitions.config">

  <container name="myContainer" >
    <register type="IFoo" mapTo="Foo" /> 
  </container>
</unity>

有什么办法吗?

非常感谢。

【问题讨论】:

    标签: unity-container app-config


    【解决方案1】:

    您应该创建一个功能请求,

    http://unity.codeplex.com/workitem/list/basic

    或者你开始一个新的讨论线程。

    Unity 是开源的,因此您也可以自行实现。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-11-10
      • 2016-06-06
      • 2010-12-06
      • 2020-05-16
      • 2023-02-08
      • 2011-06-20
      • 1970-01-01
      相关资源
      最近更新 更多