2011-10-21 48 views
0

我知道一個關於通過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> 

有沒有辦法做到這一點?

非常感謝。

回答

相關問題