/// <summary> /// 取任意已经提供的Web服务。客户端使用 /// </summary> /// <typeparam name="T">服务类型。</typeparam> /// <param name="MapKey">服务标识。</param> /// <returns></returns> public static T GetRemoteService <T>(string MapKey = "") where T : class { if (AppSettings.Debug) { return(GetService <T>(MapKey)); } var theMaped = MapContainer.GetTypeMap(MapKey, typeof(T).FullName); if (theMaped == null) { throw new Exception(typeof(T).FullName + " 没有在配置文件中注册映射。"); } var Manager = GetService <IRemoteProxyManager>(); T proxy = Manager.GetApiProxy <T>(theMaped); return(proxy); }
/// <summary> /// 按给定的key取任意已经提供的服务。 /// </summary> /// <param name="typeName">服务类型名</param> /// <param name="MapKey">服务标识</param> /// <param name="Params">获取服务的参数</param> /// <returns></returns> public static object GetServiceByKey(string MapKey, string typeName, params object[] Params) { return(MapContainer.GetInstance(MapKey, typeName, Params)); }
/// <summary> /// 取任意已经提供的服务,如果存在多个,则返回第一个。 /// </summary> /// <param name="typeName">服务类型名</param> /// <param name="Params">获取服务的参数</param> /// <returns></returns> public static object GetService(string typeName, params object[] Params) { return(MapContainer.GetInstance(typeName, "", Params)); }
public static object GetServiceByKey <T>(string MapKey) { return(MapContainer.GetInstance(MapKey)); }
/// <summary> /// 按给定的key取任意已经提供的服务。 /// </summary> /// <typeparam name="T">服务类型</typeparam> /// <param name="MapKey">服务标识</param> /// <param name="Params">获取服务的参数</param> /// <returns></returns> public static T GetServiceByKey <T>(string MapKey, params object[] Params) where T : class { return(MapContainer.GetInstance(MapKey, typeof(T).FullName, Params) as T); }
/// <summary> /// 取任意已经提供的服务,如果存在多个,则返回第一个。 /// </summary> /// <typeparam name="T">服务类型</typeparam> /// <param name="Params">获取服务的参数</param> /// <returns></returns> public static T GetService <T>(params object[] Params) where T : class { return(MapContainer.GetInstance("", typeof(T).FullName, Params) as T); }