Use Enum as Parameter in Windsor Configuration File

主宰稳场 提交于 2019-12-12 14:36:54

问题


how would I preset a Windsor configuration file parameter with an Enum specified entry such as "EntryType" below?

I currently have this:

<component
      id="test.service" service=".." type=".." lifestyle="transient">
      <parameters>
        <entryType>EntryType.Test</entryType>
      </parameters>
    </component>

Where .. obviously represents the full namespace and assembly.

But receiving this error:

Could not convert from 'EntryType.Test' to 
   Business.Common.Services.Core.TestService+EntryType.

回答1:


Written like this, it worked for me:

<component
  id="test.service" service=".." type=".." lifestyle="transient">
  <parameters>
    <entryType>Test</entryType><!-- NOT EntryType.Test -->
  </parameters>
</component>


来源:https://stackoverflow.com/questions/1629353/use-enum-as-parameter-in-windsor-configuration-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!