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 (base.Options == null) {
Dictionary<byte, object> dictionary2 = base.Options = new Dictionary<byte, object>();
}
base.Options[16] = new InstanceOptions(instance, wireUp);
base.ImplementationType = instance.GetType();
return this;
}
}
}