public object GetInstance(Type serviceType) { assertNotDisposed(); var resolver = ServiceGraph.FindResolver(serviceType); if (resolver == null) { throw new LamarMissingRegistrationException(serviceType); } return(resolver(this)); }
public object GetInstance(Type serviceType) { assertNotDisposed(); var resolver = ServiceGraph.FindResolver(serviceType); if (resolver == null) { if (ServiceGraph.Families.TryGetValue(serviceType, out var family)) { if (family.CannotBeResolvedMessage.IsNotEmpty()) { throw new LamarMissingRegistrationException(family); } } throw new LamarMissingRegistrationException(serviceType); } return(resolver(this)); }
public object TryGetInstance(Type serviceType) { assertNotDisposed(); return(ServiceGraph.FindResolver(serviceType)?.Invoke(this)); }