コード例 #1
0
 private Type GetIdentityType(IServiceKey serviceKey)
 {
     if (serviceKey is KeyedServiceKey)
     {
         var descriptor = _rabbitServiceDescriptors.LastOrDefault(i => i.ServiceKey.Equals(serviceKey));
         return(descriptor?.ServiceType);
     }
     return(serviceKey.ServiceType);
 }
コード例 #2
0
        private object GetService(IServiceKey serviceKey)
        {
            var identityType = GetIdentityType(serviceKey);

            if (identityType == typeof(IServiceScopeFactory))
            {
                return(_serviceScopeFactoryLazy.Value);
            }

            return(identityType == null ? null : _serviceProvider.GetService(identityType));
        }