Example #1
0
 private object tryGetService(Type serviceType, ServiceConstructorRequest serviceConstructorRequest)
 {
     if (serviceType == null)
     {
         throw new ArgumentNullException(nameof(serviceType));
     }
     lock (registrations) {
         if (serviceConstructorRequest == null)
         {
             serviceConstructorRequest = newServiceConstructorRequest();
         }
         return(registrations.TryGetValue(serviceType, out ServiceRegistration registration)
                                         ? registration.Get(serviceConstructorRequest)
                                         : parentServiceRegistrationProvider != null
                                                         ? parentServiceRegistrationProvider.GetService(serviceType, serviceConstructorRequest)
                                                         : parentServiceProvider?.GetService(serviceType));
     }
 }
Example #2
0
 object IServiceRegistrationProvider.GetService(
     Type serviceType,
     ServiceConstructorRequest serviceConstructorRequest)
 => tryGetService(serviceType, serviceConstructorRequest);