Stashbox by Peter Csajtai

<PackageReference Include="Stashbox" Version="3.6.4-preview-649" />

 FluentServiceConfigurator<TConfigurator>

public class FluentServiceConfigurator<TConfigurator> : BaseFluentConfigurator<TConfigurator>, IFluentCompositor<TConfigurator> where TConfigurator : FluentServiceConfigurator<TConfigurator>
Represents the fluent service registration api.
using Stashbox.Utils; using System; namespace Stashbox.Registration.Fluent { public class FluentServiceConfigurator<TConfigurator> : BaseFluentConfigurator<TConfigurator>, IFluentCompositor<TConfigurator> where TConfigurator : FluentServiceConfigurator<TConfigurator> { internal FluentServiceConfigurator(Type serviceType, Type implementationType) : base(serviceType, implementationType) { } internal FluentServiceConfigurator(Type serviceType, Type implementationType, RegistrationContext registrationContext) : base(serviceType, implementationType, registrationContext) { } public TConfigurator WithName(object name) { base.Context.Name = name; return (TConfigurator)this; } public TConfigurator DefinesScope(object scopeName = null) { base.Context.DefinedScopeName = (scopeName ?? base.ImplementationType); return (TConfigurator)this; } public TConfigurator WithFactory(Func<IDependencyResolver, object> factory, bool isCompiledLambda = false) { SetFactory(factory, isCompiledLambda, Constants.ResolverType, Constants.ObjectType); return (TConfigurator)this; } public TConfigurator WithFactory(Func<object> factory, bool isCompiledLambda = false) { SetFactory(factory, isCompiledLambda, Constants.ObjectType); return (TConfigurator)this; } public TConfigurator WithFactory<T1>(Func<T1, object> factory, bool isCompiledLambda = false) { base.SetFactory((Delegate)factory, isCompiledLambda, new Type[2] { typeof(T1), Constants.ObjectType }); return (TConfigurator)this; } public TConfigurator WithFactory<T1, T2>(Func<T1, T2, object> factory, bool isCompiledLambda = false) { base.SetFactory((Delegate)factory, isCompiledLambda, new Type[3] { typeof(T1), typeof(T2), Constants.ObjectType }); return (TConfigurator)this; } public TConfigurator WithFactory<T1, T2, T3>(Func<T1, T2, T3, object> factory, bool isCompiledLambda = false) { base.SetFactory((Delegate)factory, isCompiledLambda, new Type[4] { typeof(T1), typeof(T2), typeof(T3), Constants.ObjectType }); return (TConfigurator)this; } public TConfigurator WithFactory<T1, T2, T3, T4>(Func<T1, T2, T3, T4, object> factory, bool isCompiledLambda = false) { base.SetFactory((Delegate)factory, isCompiledLambda, new Type[5] { typeof(T1), typeof(T2), typeof(T3), typeof(T4), Constants.ObjectType }); return (TConfigurator)this; } public TConfigurator WithFactory<T1, T2, T3, T4, T5>(Func<T1, T2, T3, T4, T5, object> factory, bool isCompiledLambda = false) { base.SetFactory((Delegate)factory, isCompiledLambda, new Type[6] { typeof(T1), typeof(T2), typeof(T3), typeof(T4), typeof(T5), Constants.ObjectType }); return (TConfigurator)this; } } }