Stashbox by Peter Csajtai

<PackageReference Include="Stashbox" Version="3.2.6-preview-593" />

 RegistrationConfiguration

Represents the collected configuration options of a registration.
using System; namespace Stashbox.Registration.Fluent { public class RegistrationConfiguration { public Type ServiceType { get; } public Type ImplementationType { get; set; } internal RegistrationContext Context { get; } internal RegistrationConfiguration(Type serviceType, Type implementationType) : this(serviceType, implementationType, new RegistrationContext()) { } internal RegistrationConfiguration(Type serviceType, Type implementationType, RegistrationContext context) { ServiceType = serviceType; ImplementationType = implementationType; Context = context; } internal bool TypeMapIsValid(out string error) { error = null; if ((object)Context.ContainerFactory != null || (object)Context.SingleFactory != null) return true; if (!ImplementationType.IsResolvableType()) { error = $"""{ImplementationType}"""; return false; } if (ImplementationType.Implements(ServiceType)) return true; error = $"""{ImplementationType}""{ServiceType}"""; return false; } internal bool ImplementationIsResolvable(out string error) { error = null; if ((object)Context.ContainerFactory != null || (object)Context.SingleFactory != null) return true; if (ImplementationType.IsResolvableType()) return true; error = $"""{ImplementationType}"""; return false; } } }