我有一个 WCF 服务,我正在尝试使用 Castle Windsor 来解决它。以前的注册是这样的:
container.Register(Component.For<IBatchDataService>()
.AsWcfClient(WCFEndpoint
.FromConfiguration("Internal.IBatchDataService"))
.LifestyeTransient())
现在我创建了一个存在于进程中的代理。它公开相同的接口 (IBatchDataService) 并将 WCF 服务的引用作为构造函数参数。如何在 Windsor 中进行设置,以便将任何其他类解析为使用代理类,但代理类解析为 WCF 服务。我现在有这个:
container.Register(Component.For<IBatchDataService>()
.ImplementedBy<BatchDataServiceClient>());
这应该解决新的代理类。