注入通用的IList我在命名空间Device.Control枚举...从spring.net
public enum State {
IN_PROGRESS, SUSPENDED, HALTED, FINISHED
}
而且我有一个类...
public class CustomStateManager {
public IList<State> ManagingStates { get; set; }
}
下面是我的配置XML为spring.net ...
<object id="MyStateManager" type="CustomStateManager">
<property name="ManagingStates">
<list>
<value>SUSPENDED</value>
<value>HALTED</value>
</list>
</property>
</object>
建设,并试图注入MyStateManager对象后,spring.NET抱怨说,它不能设置个e对象的ManagingStates属性。我得到这个错误...
错误创建名为 'MyStateManager' 中所定义 '文件 [Spring.xml] 3' 线对象:错误设置属性值: PropertyAccessExceptionsException(1个错误);嵌套0PropertyAccessExceptions是:[Spring.Core.TypeMismatchException: 无法类型的属性值转换[System.Collections.ArrayList] 所需类型 [System.Collections.Generic.IList
1[[SandboxConsole.Device.Control.ApplicationEnumerations+State, SandboxConsole, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]] for property 'ManagingStates'., Inner Exception: Spring.Core.TypeMismatchException: Cannot convert property value of type [System.Collections.ArrayList] to required type [System.Collections.Generic.IList
1 [[SandboxConsole.Device.Control.ApplicationEnumerations +国家, SandboxConsole,版本= 1.0.0.0,文化=中立, 公钥=空]]]财产 'ManagingStates' ......
我有点新Spring.NET,我想不通除了它不能将一个ArrayList注入到IList属性中外,这里列出的问题是什么。 是否有可能在值为枚举类型的配置中创建列表?如果是这样,怎么样?
工作正常!谢谢! – kevin628