private Type GetIdentityType(IServiceKey serviceKey) { if (serviceKey is KeyedServiceKey) { var descriptor = _rabbitServiceDescriptors.LastOrDefault(i => i.ServiceKey.Equals(serviceKey)); return(descriptor?.ServiceType); } return(serviceKey.ServiceType); }
private object GetService(IServiceKey serviceKey) { var identityType = GetIdentityType(serviceKey); if (identityType == typeof(IServiceScopeFactory)) { return(_serviceScopeFactoryLazy.Value); } return(identityType == null ? null : _serviceProvider.GetService(identityType)); }