.net Castle Windsor how to specify component property to constructor parameter in xml?
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.
精彩评论