public static void Register(Type type) { var loadServices = ServiceLoader.Load(type); foreach (var service in loadServices) { RegisterServiceType(type, service); } }
/// <summary> /// 注册接口对应的多实例实现 /// </summary> /// <typeparam name="TIService"></typeparam> public static void Register <TIService>() { var loadServices = ServiceLoader.Load <TIService>(); foreach (var service in loadServices) { RegisterServiceType(typeof(TIService), service); } }