我正在尝试将参数传递给需要 System.TimeSpan 的组件。我只能解决“长滴答声” ctor。
这是配置文件的片段:
<component id="timeInForce" type="System.TimeSpan, mscorlib">
<parameters>
<hours>0</hours>
<minutes>15</minutes>
<seconds>0</seconds>
</parameters>
</component>
<component id="FooSettings" type="Foo.FooSettings, Foo">
<parameters>
<tif>${timeInForce}</tif>
</parameters>
</component>
这是一个例外:
Castle.MicroKernel.Handlers.HandlerException : Cant create component 'timeInForce'
as it has dependencies to be satisfied.
timeInForce is waiting for the following dependencies:
Keys (components with specific keys)
- ticks which was not registered.
为组件参数传递刻度值是可行的,如下所示:
<parameters><tif>0</tif></parameters>
但这违背了目的。