鉴于此操作合同:
<ServiceContract()>
Public Interface IService1
<OperationContract()>
Function GetData(ByVal composite As CompositeType) As CompositeType
End Interface
我使用 Castle.Windsor WCFClientFacility 创建了一个 WCF 客户端,如下所示:
container.Register(Component.
For(Of IService1).
ImplementedBy(Of Service1)().
AsWcfClient(New DefaultClientModel() With {
.Endpoint = WcfEndpoint.
BoundTo(New BasicHttpBinding()).
At(String.Format("http://localhost:50310/{0}.svc", "Service1"))
}))
这一切都很好,但现在我希望能够代理 GetData 操作的返回类型,CompositeType
. 只需CompositeType
像这样在容器中注册:
container.Register(Component.For(Of CompositeType).Interceptors(GetType(MyInterceptor))
没有做到这一点......这种行为可能吗?这样做的目的是使用代理/拦截器在返回的对象上自动实现 INPC。关键是在序列化程序激活一个新实例时拦截它的可能性CompositeType
?