使用Spring.NET获取typeof(…).Name
有没有办法使用Spring.NET获取接口的字符串表示形式 代码:使用Spring.NET获取typeof(…).Name,.net,spring.net,.net,Spring.net,有没有办法使用Spring.NET获取接口的字符串表示形式 代码: typeof(ISsoUrlTemplateRepository).Name 我需要在Spring.NET配置中使用此名称。。。我可以只接受字符串本身,但如果我重构并更改某些接口的名称,Spring配置将不再有效 这与我所问的另一个问题有关--> typeof(ISsoUrlTemplateRepository).AssemblyQualifiedName 它包括完整的类型名,加上从中加载的程序集名。要在Spring.NET
typeof(ISsoUrlTemplateRepository).Name
我需要在Spring.NET配置中使用此名称。。。我可以只接受字符串本身,但如果我重构并更改某些接口的名称,Spring配置将不再有效
这与我所问的另一个问题有关-->
typeof(ISsoUrlTemplateRepository).AssemblyQualifiedName
它包括完整的类型名,加上从中加载的程序集名。要在Spring.NET配置中获取类型名,需要使用Spring表达式语言 像这样:
<object id="MyClass" type="Assembly.Type, Assembly">
<property name ="MyTypeProperty" value="T(AnotherAssembly.AnotherType, AnotherAssembly)"/>
</object>
我看不出“获取接口的字符串表示”与Spring.NET.Related有什么关系。在这个问题中,我们总结了使用xml config在spring.net中注入类型的不同方法。Benny,看起来您已经经常使用spring.net了。谢谢你的回答。