我正在使用带有“Castle.DynamicProxy.ProxyGenerator”的城堡使用代码创建WCF服务代理。这是创建频道的现有类:
public class ChannelProxyGenerator : IChannelProxyGenerator
{
private readonly ProxyGenerator proxyGenerator;
public ChannelProxyGenerator()
{
proxyGenerator = new ProxyGenerator();
}
public TInterface CreateCannelWithRetries<TInterface>(IServiceProxy<TInterface> serviceProxy) where TInterface : class
{
return proxyGenerator.CreateInterfaceProxyWithTargetInterface(serviceProxy.Channel);
}
}
我希望能够创建代理,但通过指定其名称来使用特定端点,如 https://docs.microsoft.com/en-us/previous-versions/office/developer/sharepoint-2010/ee535060(v=office.14) 中所述。原因是我需要为同一个合约支持多个端点配置。
这可以使用 Castle 还是我应该使用其他替代方案?我没有看到任何支持它的重载。