/// <summary> /// 根据类型名列表添加Service /// </summary> /// <param name="serviceProxy"></param> /// <param name="typeNameList"></param> /// <returns></returns> public static IServiceProxy AddServices(this IServiceProxy serviceProxy, IList <string> typeNameList) { foreach (var typeName in typeNameList) { var type = Type.GetType(typeName); if (!type.IsServiceProxy()) { throw new InvalidOperationException($"{type.FullName} is not service proxy."); } serviceProxy.AddService(type); } return(serviceProxy); }
/// <summary> /// 添加Service /// </summary> /// <typeparam name="T"></typeparam> /// <param name="serviceProxy"></param> /// <returns></returns> public static IServiceProxy AddService <T>(this IServiceProxy serviceProxy) where T : class { serviceProxy.AddService(typeof(T)); return(serviceProxy); }