using CCWcfService;
|
using System.ServiceModel;
|
|
namespace Admin.NET.Application.CommonHelper
|
{
|
/// <summary>
|
/// WCF服务帮助类
|
/// </summary>
|
public class WCFServiceHelper
|
{
|
|
/// <summary>
|
/// 获取SAPCC的WCF服务 Client对象
|
/// </summary>
|
/// <returns></returns>
|
public static async Task<ICCWcfService> GetWCFService_SAPCC_Client(SqlSugarRepository<SysConfig> _sysConfigRep)
|
{
|
var config = await _sysConfigRep.GetFirstAsync(x => x.Code == "CCWcfAddress");
|
if (config == null)
|
{
|
throw Oops.Oh("没有找到配置编号'CCWcfAddress'的数据");
|
}
|
var endpoint = config.Value;
|
var factory = new ChannelFactory<ICCWcfService>(new BasicHttpBinding(), new EndpointAddress(endpoint));
|
var client = factory.CreateChannel();
|
return client;
|
}
|
|
}
|
}
|