Stashbox by Peter Csajtai

<PackageReference Include="Stashbox" Version="5.11.0-preview-817" />

 RegistrationConfigurator<TService, TImplementation>

public class RegistrationConfigurator<TService, TImplementation> : FluentServiceConfigurator<TService, TImplementation, RegistrationConfigurator<TService, TImplementation>> where TImplementation : TService
Represents the generic fluent service registration api.
using Stashbox.Lifetime; using Stashbox.Utils; using System; using System.Collections.Generic; using System.Runtime.CompilerServices; namespace Stashbox.Registration.Fluent { [System.Runtime.CompilerServices.NullableContext(1)] [System.Runtime.CompilerServices.Nullable(new byte[] { 0, 1, 1, 1, 1, 1 })] public class RegistrationConfigurator<TService, TImplementation> : FluentServiceConfigurator<TService, TImplementation, RegistrationConfigurator<TService, TImplementation>> where TService : class where TImplementation : class, TService { internal RegistrationConfigurator(Type serviceType, Type implementationType, LifetimeDescriptor lifetimeDescriptor, [System.Runtime.CompilerServices.Nullable(2)] object name = null) : base(serviceType, implementationType, name, lifetimeDescriptor, false) { } public RegistrationConfigurator<TService, TImplementation> WithInstance(TService instance, bool wireUp = false) { Shield.EnsureNotNull<TService>(instance, "instance"); if (Options == null) Options = new Dictionary<RegistrationOption, object>(); Options[RegistrationOption.RegistrationTypeOptions] = new InstanceOptions(instance, wireUp); base.ImplementationType = instance.GetType(); return this; } } }