#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(); } /// /// 获取WCF服务的接口 /// /// /// 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; } /// /// 获取WCF服务的类 /// /// public static List GetWCFServiceType() { var list = new List(); list.Add(typeof(CommonService)); list.Add(typeof(DataDictService)); list.Add(typeof(MessageCenter)); list.Add(typeof(SystemSecurityService)); return list; } } }