/// <summary> /// 解析指定类型的所有服务实例 /// </summary> /// <param name="serviceType">服务类型</param> public IEnumerable <object> GetServices(Type serviceType) { Check.NotNull(_services, nameof(_services)); Check.NotNull(_provider, nameof(_provider)); IScopedServiceResolver scopedResolver = _provider.GetService <IScopedServiceResolver>(); if (scopedResolver != null && scopedResolver.ResolveEnabled) { return(scopedResolver.GetServices(serviceType)); } return(_provider.GetServices(serviceType)); }
/// <summary> /// 解析指定类型的所有服务实例 /// </summary> public IEnumerable <T> GetServices <T>() { _services.CheckNotNull(nameof(_services)); _provider.CheckNotNull(nameof(_provider)); IScopedServiceResolver scopedResolver = _provider.GetService <IScopedServiceResolver>(); if (scopedResolver != null && scopedResolver.ResolveEnabled) { return(scopedResolver.GetServices <T>()); } return(_provider.GetServices <T>()); }