WCF 服务有一个参数化的构造函数,它接受一个结构
WCF Service has a paramterized constructor, which accepts a struct
请看下面的代码:
public void Install(IWindsorContainer container, IConfigurationStore store)
{
container.Register(
Component.For<ICalculator, Calculator>());
}
计算器是一个结构体。打开 .svc 时出现的错误是:"Calculator is not a class nor an interface, and those are the only values allowed."。是否可以使用 Castle Windsor 注入结构?
我花了一些时间在谷歌上搜索这个,但是我没有找到答案。
让我们看看source code of Windsor。
所以,不,你不能。通过温莎容器的设计。
请看下面的代码:
public void Install(IWindsorContainer container, IConfigurationStore store)
{
container.Register(
Component.For<ICalculator, Calculator>());
}
计算器是一个结构体。打开 .svc 时出现的错误是:"Calculator is not a class nor an interface, and those are the only values allowed."。是否可以使用 Castle Windsor 注入结构?
我花了一些时间在谷歌上搜索这个,但是我没有找到答案。
让我们看看source code of Windsor。
所以,不,你不能。通过温莎容器的设计。