解决了!!!!谢谢你的帮助
我有点迷路了,我想删除 Web.Config 之外的所有 Spring.NET 配置,但我不知道如何放置我的 typeAliases。
我会很感激你能给我的所有帮助。
谢谢。
解决了!!!!谢谢你的帮助
我有点迷路了,我想删除 Web.Config 之外的所有 Spring.NET 配置,但我不知道如何放置我的 typeAliases。
我会很感激你能给我的所有帮助。
谢谢。
您可以在 app.config/web.config 中注册类型别名:
<configSections>
<sectionGroup name="spring">
<section name="context" type="Spring.Context.Support.ContextHandler, Spring.Core"/>
<section name="typeAliases" type="Spring.Context.Support.TypeAliasesSectionHandler, Spring.Core"/>
</sectionGroup>
</configSections>
<spring>
<typeAliases>
<alias name="Prog" type="MyNs.Program, MyLibrary" />
</typeAliases>
<context>
<resource uri="context.xml"/>
</context>
</spring>
或者在 spring 配置文件中添加Spring.Objects.Factory.Config.TypeAliasConfigurer
对象的定义:
<?xml version="1.0" encoding="utf-8" ?>
<objects xmlns="http://www.springframework.net">
<object id="program" type="Prog" />
<object id="myTypeAlias" type="Spring.Objects.Factory.Config.TypeAliasConfigurer, Spring.Core">
<property name="TypeAliases">
<dictionary>
<entry key="Prog" value="MyNs.Program, MyLibrary"/>
</dictionary>
</property>
</object>
</objects>
您可以在文档中找到它。