解决了!!!!谢谢你的帮助
我有点迷失在这里,我想删除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>
Run Code Online (Sandbox Code Playgroud)
或者在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>
Run Code Online (Sandbox Code Playgroud)
您可以在文档中找到它.
| 归档时间: |
|
| 查看次数: |
2142 次 |
| 最近记录: |