Stashbox by Peter Csajtai

<PackageReference Include="Stashbox" Version="5.2.1" />

 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.Utils; using System; 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) : base(serviceType, implementationType) { } public RegistrationConfigurator<TService, TImplementation> WithInstance(TService instance, bool wireUp = false) { Shield.EnsureNotNull<TService>(instance, "instance"); base.Context.ExistingInstance = instance; base.Context.IsWireUp = wireUp; base.ImplementationType = instance.GetType(); return this; } } }