#region
|
|
using System;
|
using System.Collections.Generic;
|
using System.ServiceModel;
|
using System.ServiceModel.Channels;
|
using CSFrameworkV5.WCFContract.WCF_Class;
|
|
#endregion
|
|
namespace CSFrameworkV5.WCFContract
|
{
|
public static class WCFServiceProvider
|
{
|
public static Binding CreateBinding(BindingType type)
|
{
|
if (BindingType.BasicHttpBinding == type)
|
return new BasicHttpBinding("BasicHttpBinding");
|
|
if (BindingType.NetTcpBinding == type)
|
return new NetTcpBinding("NetTcpBinding");
|
|
if (BindingType.wsHttpBinding == type)
|
return new WSHttpBinding("WSHttpBinding");
|
|
throw new NotImplementedException();
|
}
|
|
/// <summary>
|
/// 获取WCF服务的接口
|
/// </summary>
|
/// <param name="classType"></param>
|
/// <returns></returns>
|
public static Type GetWCFInterfaceType(Type classType)
|
{
|
if (classType == typeof(CommonService))
|
return typeof(ICommonService);
|
|
if (classType == typeof(DataDictService))
|
return typeof(IDataDictService);
|
|
if (classType == typeof(MessageCenter))
|
return typeof(IMessageCenter);
|
|
if (classType == typeof(SystemSecurityService))
|
return typeof(ISystemSecurityService);
|
|
return null;
|
}
|
|
/// <summary>
|
/// 获取WCF服务的类
|
/// </summary>
|
/// <returns></returns>
|
public static List<Type> GetWCFServiceType()
|
{
|
var list = new List<Type>();
|
list.Add(typeof(CommonService));
|
list.Add(typeof(DataDictService));
|
list.Add(typeof(MessageCenter));
|
list.Add(typeof(SystemSecurityService));
|
return list;
|
}
|
}
|
}
|