Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/search/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# .net或如何在xml中为构造函数参数指定组件属性?_C#_Castle Windsor - Fatal编程技术网

C# .net或如何在xml中为构造函数参数指定组件属性?

C# .net或如何在xml中为构造函数参数指定组件属性?,c#,castle-windsor,C#,Castle Windsor,我不知道如何将Component属性传递给构造函数参数 <component id="NotificationCenterManager" service="Advise.Notification.INotificationCenterManager, Xsquare" type="Advise.Notification.NotificationCenterManager, Xsquare">

我不知道如何将Component属性传递给构造函数参数

<component id="NotificationCenterManager"
                     service="Advise.Notification.INotificationCenterManager, Xsquare"
                     type="Advise.Notification.NotificationCenterManager, Xsquare">        
</component>    
<component id="JobProcessorConfigurationSender"
                 service="Advise.Core.JobProcessor.IJobProcessorConfigurationSender, Advise.Core"
                 type="Advise.JobProcessorManagement.JobProcessorConfigurationSender, Xsquare">
      <parameters>
            <notificationCenterUri>${NotificationCenterManager.NotificationCenterUri}
</notificationCenterUri>
      </parameters>
</component>
其中NotificationCenterUri是接口INotificationCenterManager的属性。 目前${NotificationCenterManager.NotificationCenterUri}被视为一个文本

有什么想法吗


谢谢

温莎没有提供开箱即用的服务。您必须编写一个程序来实现它。但是,我不建议这样做:这样做会使JobProcessorConfigurationSender隐式依赖于NotificationCenterManager,因为它不在JobProcessorConfigurationSender的源代码中


取而代之的是,考虑将这个URI作为A,然后在NoTimeCtCurnMeCurnor和JoopPrimeCurraseServer的组件配置中引用它。问题在于URI是动态的,并且依赖于machinename。你还有其他建议吗?Thanks@Pierre-Louis:如果您必须使用XML进行此操作,您可以创建一个提供此信息的IUriProvider服务,然后在NotificationCenterManager和JobProcessorConfigurationSender@Pierre-Louis:另一个选择是编写ISubDependencyResolver或IContributeComponentModelConstruction,我想我会这么做。谢谢