开发者

.net Castle Windsor how to specify component property to constructor parameter in xml?

开发者 https://www.devze.com 2023-04-02 12:23 出处:网络
I can\'t figure out how to pass a compoment property to a constructor parameter. <component id=\"NotificationCenterManager\"

I can't figure out how to pass a compoment property to a constructor parameter.

<component id="NotificationCenterManager"
                     service="Advise.Notification.INotificationCenterManager, Xsquare"
                     type="Advise.Notification.NotificationCenterManager, Xsquare">        
开发者_JAVA技巧</component>    
<component id="JobProcessorConfigurationSender"
                 service="Advise.Core.JobProcessor.IJobProcessorConfigurationSender, Advise.Core"
                 type="Advise.JobProcessorManagement.JobProcessorConfigurationSender, Xsquare">
      <parameters>
            <notificationCenterUri>${NotificationCenterManager.NotificationCenterUri}
</notificationCenterUri>
      </parameters>
</component>

Where NotificationCenterUri is a property of interface INotificationCenterManager. At the moment ${NotificationCenterManager.NotificationCenterUri} is treated like a literal...

Any ideas ?

Thanks


Windsor does not provide that out of the box. You'd have to write a facility to implement it. However, I wouldn't recommend it: by doing this you're implicitly making JobProcessorConfigurationSender depend on NotificationCenterManager (implicitly because it's not anywhere in the source code of JobProcessorConfigurationSender).

Instead, consider putting this URI as a property, then reference it in the component configuration of NotificationCenterManager and JobProcessorConfigurationSender.

0

精彩评论

暂无评论...
验证码 换一张
取 消