如何使用 Enum 指定的条目(例如下面的“EntryType”)预设 Windsor 配置文件参数?
我目前有这个:
<component
id="test.service" service=".." type=".." lifestyle="transient">
<parameters>
<entryType>EntryType.Test</entryType>
</parameters>
</component>
其中 ..
显然代表了完整的命名空间和程序集。
但是收到这个错误:
Could not convert from 'EntryType.Test' to
Business.Common.Services.Core.TestService+EntryType.
最佳答案
这样写的,对我有用:
<component
id="test.service" service=".." type=".." lifestyle="transient">
<parameters>
<entryType>Test</entryType><!-- NOT EntryType.Test -->
</parameters>
</component>
关于.net - 在 Windsor 配置文件中使用枚举作为参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1629353/