RegistrationConfigurator
Represents the 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
})]
public class RegistrationConfigurator : FluentServiceConfigurator<RegistrationConfigurator>
{
internal RegistrationConfigurator(Type serviceType, Type implementationType, LifetimeDescriptor lifetimeDescriptor, [System.Runtime.CompilerServices.Nullable(2)] object name = null)
: base(serviceType, implementationType, name, lifetimeDescriptor, false)
{
}
public RegistrationConfigurator WithInstance(object instance, bool wireUp = false)
{
Shield.EnsureNotNull(instance, "instance");
if (Options == null)
Options = new Dictionary<RegistrationOption, object>();
Options[RegistrationOption.RegistrationTypeOptions] = new InstanceOptions(instance, wireUp);
base.ImplementationType = instance.GetType();
return this;
}
}
}