如何在外部Spring.NET配置文件中指定类型别名和对象

如何在外部Spring.NET配置文件中指定类型别名和对象,spring.net,Spring.net,解决了!!!!谢谢你的帮助 我有点迷路了,我想删除Web.Config之外的所有Spring.NET配置,但我不知道如何放置我的typealias 我会感激你能给我的一切帮助 谢谢。您可以在app.config/web.config中注册类型别名: <configSections> <sectionGroup name="spring"> <section name="context" type="Spring.Context.Support

解决了!!!!谢谢你的帮助

我有点迷路了,我想删除Web.Config之外的所有Spring.NET配置,但我不知道如何放置我的typealias

我会感激你能给我的一切帮助


谢谢。

您可以在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>
你会在地图上找到这个

<?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>