我有没有办法在Spring .NET配置中实例化TimeSpan结构?
我的配置看起来像这样:
<object id="historize_production_control" type="BB.VisCtrl.Process.ImageIndexer.ProcessLogic.HistorizeAndCleanProductionControl,BB.VisCtrl.Process.ImageIndexer">
<constructor-arg name="inspectionToKeep" value="6"></constructor-arg>
<constructor-arg name="destationDir" value=".\"></constructor-arg>
<constructor-arg name="resourceCleaner" ref="file_cleaner"></constructor-arg>
<constructor-arg name="cleanHistoryResourcesAfter" value="6d {TimeSpan here }"></constructor-arg>
<constructor-arg name="cleanResourcesAfter" ref="6d {TimeSpan here }" ></constructor-arg>
</object>
感谢您的回答。
答案 0 :(得分:2)
如果我理解正确,你需要这样的东西:
<object id="RefTimeSpan" type="System.TimeSpan">
<constructor-arg name="days" value="6" />
<constructor-arg name="hours" value="0" />
<constructor-arg name="minutes" value="0" />
<constructor-arg name="seconds" value="0" />
</object>
<constructor-arg name="cleanHistoryResourcesAfter" ref="RefTimeSpan" />
<constructor-arg name="cleanResourcesAfter" ref="RefTimeSpan" />
答案 1 :(得分:0)
使用此
<constructor-arg name="cleanResourcesAfter" type="System.TimeSpan" value="6.00:00:00" />