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)); } }
object IServiceRegistrationProvider.GetService( Type serviceType, ServiceConstructorRequest serviceConstructorRequest) => tryGetService(serviceType, serviceConstructorRequest);