我已经在我的服务器上创建了一些WCF服务,现在我已经实现了客户端,我基本上只有两种方式:
使用ClientBase实现
function_score: {
query: { match: {
field => term,
}},
score_mode: :avg,
script_score: {
script: {
inline: "4 * (1 + Math.log(2 + _score))",
}
},
}
使用ChannelFactory
public class SampleServiceClient : ClientBase<ISampleService>, ISampleService
{
public SampleServiceClient(Binding binding, EndpointAddress remoteAddress) :
base(binding, remoteAddress)
{
}
public string SampleMethod(string msg)
{
return base.Channel.SampleMethod(msg);
}
}
一个优于另一个的优势是什么? public ISampleService GetService(Binding binding, EndpointAddress remoteAddress){
ChannelFactory<ISampleService> channelFactory = new ChannelFactory<ISampleService>(binding, address);
return channelFactory.CreateChannel();
}
中是否还有其他功能?有最好的做法吗?