<configuration>
<configSections>
<section name="unity" type="Microsoft.Practices.Unity.Configuration.UnityConfigurationSection, Microsoft.Practices.Unity.Configuration"/>
</configSections>
<unity xmlns="http://schemas.microsoft.com/practices/2010/unity">
<alias alias="IInterface" type="InterfaceNamespace.IInterface, InterfaceLibraryName" />
<alias alias="Implementation" type="ImpNamespace.Implementation, ImpLibraryName" />
<container name="default">
<register type="IInterface" mapTo="Implementation" />
</container>
</unity>
</configuration>假如IInterface对应有两个实现Implementation1和Implementation2时,配置文件该怎么写啊?<register type="IInterface" mapTo="Implementation1" name="imp1"/>
<register type="IInterface" mapTo="Implementation2" name="imp2"/>
这样是肯定不对的
<configSections>
<section name="unity" type="Microsoft.Practices.Unity.Configuration.UnityConfigurationSection, Microsoft.Practices.Unity.Configuration"/>
</configSections>
<unity xmlns="http://schemas.microsoft.com/practices/2010/unity">
<alias alias="IInterface" type="InterfaceNamespace.IInterface, InterfaceLibraryName" />
<alias alias="Implementation" type="ImpNamespace.Implementation, ImpLibraryName" />
<container name="default">
<register type="IInterface" mapTo="Implementation" />
</container>
</unity>
</configuration>假如IInterface对应有两个实现Implementation1和Implementation2时,配置文件该怎么写啊?<register type="IInterface" mapTo="Implementation1" name="imp1"/>
<register type="IInterface" mapTo="Implementation2" name="imp2"/>
这样是肯定不对的
解决方案 »
- 做压力测试中碰到的几个问题
- 请教:如何在调用外部程序去掉外部程序exe的窗口标题栏 用c#
- C# WINFORM中一个ToolStripButton与ToolStripMenuItem相对应的问题,帮忙看看!
- comboBox1.DataBindings.add()方法使用困惑
- 大家帮忙起个名,来者有分
- 高手!!帮忙!!
- Sql中,枚举CommandType.
- 兄弟们,一个关于图像编辑的问题!
- 为什么在win2k中运行正常,在win98中在出错
- 一个小问题!
- 如何用循环遍历多个相同类型的控件?
- 10000000 转换成十进制 128 再转char 后,signed char 范围-128~~128 有越界嫌隙
<configuration>
<configSections>
<section name="unity" type="Microsoft.Practices.Unity.Configuration.UnityConfigurationSection, Microsoft.Practices.Unity.Configuration"/>
</configSections>
<unity xmlns="http://schemas.microsoft.com/practices/2010/unity">
<alias alias="IInterface" type="InterfaceNamespace.IInterface, InterfaceLibraryName" />
<alias alias="Implementation1" type="ImpNamespace.Implementation1, ImpLibraryName" />
<alias alias="Implementation1" type="ImpNamespace.Implementation2, ImpLibraryName" />
<container name="default">
<register type="IInterface" mapTo="Implementation" name="Implementation1" />
<register type="IInterface" mapTo="Implementation" name="Implementation2" />
</container>
</unity>
</configuration>
List<IInterface> interfaces;public Class1(IUnityContainer container)
{
interfaces = new List<IInterface>(container.ResolveAll<IInterface>());
}刚问完就找到答案了。郁闷,我的50分啊!
该引用的DLL应该都引用了呀。难道它不是在某个DLL里吗?Microsoft.Practices.Composite;
Microsoft.Practices.Composite.Presentation;
Microsoft.Practices.Composite.UnityExtensions;
Microsoft.Practices.ServiceLocation;
Microsoft.Practices.Unity;
Microsoft.Practices.Unity.Configuration;