<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"/>
这样是肯定不对的
解决方案 »
- 在c#如何将DataGridview中的内容打印出来
- ultraGrid 数值型字段排序问题
- 帮我看种语法叫什么?
- 如何操作Datagrid换列?
- 高手指点下啊!!!没分了只20啊
- socket通信的问题!有人能解决吗?
- developer express的ImageComboxEdit控件问题.
- 我想把值放到TexBox中????
- 在c#中文BATE2版中,用什么方法调出系统中的“日期/时间属性”对话框???
- 怎样更改.net 的安装路径?高手们啊,哎!
- 如何用循环遍历多个相同类型的控件?
- 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;