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;
using System.Runtime.CompilerServices;
namespace Stashbox.Registration.Fluent
{
[System.Runtime.CompilerServices.NullableContext(1)]
[System.Runtime.CompilerServices.Nullable(new byte[] {
0,
1
})]
public class FluentServiceConfigurator<[System.Runtime.CompilerServices.Nullable(0)] 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 WithMetadata([System.Runtime.CompilerServices.Nullable(2)] object metadata)
{
base.Context.Metadata = metadata;
return (TConfigurator)this;
}
public TConfigurator WithName([System.Runtime.CompilerServices.Nullable(2)] object name)
{
base.Context.Name = name;
return (TConfigurator)this;
}
public TConfigurator DefinesScope([System.Runtime.CompilerServices.Nullable(2)] 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<[System.Runtime.CompilerServices.Nullable(2)] 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<[System.Runtime.CompilerServices.Nullable(2)] T1, [System.Runtime.CompilerServices.Nullable(2)] 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;
}
[System.Runtime.CompilerServices.NullableContext(2)]
[return: System.Runtime.CompilerServices.Nullable(1)]
public TConfigurator WithFactory<T1, T2, T3>([System.Runtime.CompilerServices.Nullable(1)] 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;
}
[System.Runtime.CompilerServices.NullableContext(2)]
[return: System.Runtime.CompilerServices.Nullable(1)]
public TConfigurator WithFactory<T1, T2, T3, T4>([System.Runtime.CompilerServices.Nullable(1)] 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;
}
[System.Runtime.CompilerServices.NullableContext(2)]
[return: System.Runtime.CompilerServices.Nullable(1)]
public TConfigurator WithFactory<T1, T2, T3, T4, T5>([System.Runtime.CompilerServices.Nullable(1)] 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;
}
}
}