【发布时间】:2011-08-10 20:11:35
【问题描述】:
我想配置 Unity 以将接口(例如 ITest)解析为结构(例如 struct Test)。到目前为止,我有下一个:
<unity>
<containers>
<container>
<types>
<type
type="my.ITest, asm"
mapTo="my.Test, asm">
</type>
</types>
</container>
</containers>
</unity>
但我收到下一个错误:
Resolution of the dependency failed, type = "my.ITest", name = "(none)".
Exception occurred while: while resolving.
Exception is: InvalidOperationException - The type Test cannot be constructed. You must configure the container to supply this value.
At the time of the exception, the container was:
Resolving my.Test,(none) (mapped from my.ITest,(none))
为什么?
【问题讨论】:
标签: c# .net struct unity-container ioc-container