RegistrationConfiguration
Represents the collected configuration options of a registration.
using Stashbox.Lifetime;
using Stashbox.Registration.ServiceRegistrations;
using Stashbox.Utils;
using System;
using System.Runtime.CompilerServices;
namespace Stashbox.Registration.Fluent
{
[System.Runtime.CompilerServices.NullableContext(1)]
[System.Runtime.CompilerServices.Nullable(0)]
public class RegistrationConfiguration
{
public Type ServiceType { get; }
public Type ImplementationType => Registration.ImplementationType;
internal ServiceRegistration Registration { get; set; }
internal RegistrationConfiguration(Type serviceType, Type implementationType, [System.Runtime.CompilerServices.Nullable(2)] object name, LifetimeDescriptor lifetimeDescriptor, bool isDecorator)
{
ServiceType = serviceType;
Registration = new ServiceRegistration(implementationType, name, lifetimeDescriptor, isDecorator);
}
internal void ValidateTypeMap()
{
if (!(Registration is FactoryRegistration))
Shield.EnsureTypeMapIsValid(ServiceType, ImplementationType);
}
internal void ValidateImplementationIsResolvable()
{
if (!(Registration is FactoryRegistration))
Shield.EnsureIsResolvable(ImplementationType);
}
}
}