简体   繁体   English

使用Spring.net进行上下文绑定

[英]Contextual Binding with Spring.net

In other IoC containers like ninject you can setup contextual binding pretty easily. 在其他的IoC容器(如ninject)中,您可以轻松设置上下文绑定。 I was wondering if contextual binding was supported by the Spring.net IoC container? 我想知道Spring.net IoC容器是否支持上下文绑定?

You can easily use Spring Expressions to do contextual binding. 您可以轻松地使用Spring Expressions进行上下文绑定。 Instead of 代替

<object name="myotherobject" ... />

<object name="thisobject">
  <property name="TheService" ref="myotherobject" />

you may write 你可以写

<property name="TheService" expr="<whatever spring expression you like>" />

cheers, Erich 干杯,埃里希

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM