Stashbox by Peter Csajtai

<PackageReference Include="Stashbox" Version="4.1.0-preview-676" />

 ContainerConfigurator

public class ContainerConfigurator
Represents a container configurator.
using Stashbox.Lifetime; using Stashbox.Registration.Fluent; using System; using System.Collections.Generic; using System.Linq.Expressions; using System.Reflection; namespace Stashbox.Configuration { public class ContainerConfigurator { public ContainerConfiguration ContainerConfiguration { get; } internal ContainerConfigurator(ContainerConfiguration containerConfiguration = null) { ContainerConfiguration = (containerConfiguration ?? ContainerConfiguration.DefaultContainerConfiguration()); } public ContainerConfigurator WithDisposableTransientTracking(bool enabled = true) { ContainerConfiguration.TrackTransientsForDisposalEnabled = enabled; return this; } public ContainerConfigurator WithRegistrationBehavior(Rules.RegistrationBehavior registrationBehavior) { ContainerConfiguration.RegistrationBehavior = registrationBehavior; return this; } public ContainerConfigurator WithRuntimeCircularDependencyTracking(bool enabled = true) { ContainerConfiguration.RuntimeCircularDependencyTrackingEnabled = enabled; return this; } public ContainerConfigurator WithCircularDependencyWithLazy(bool enabled = true) { ContainerConfiguration.CircularDependenciesWithLazyEnabled = enabled; return this; } public ContainerConfigurator WithDefaultValueInjection(bool enabled = true) { ContainerConfiguration.DefaultValueInjectionEnabled = enabled; return this; } public ContainerConfigurator WithUnknownTypeResolution(Action<UnknownRegistrationConfigurator> configurator = null, bool enabled = true) { ContainerConfiguration.UnknownTypeResolutionEnabled = enabled; ContainerConfiguration.UnknownTypeConfigurator = configurator; return this; } public ContainerConfigurator WithAutoMemberInjection(Rules.AutoMemberInjectionRules rule = Rules.AutoMemberInjectionRules.PropertiesWithPublicSetter, Func<MemberInfo, bool> filter = null, bool enabled = true) { ContainerConfiguration.AutoMemberInjectionEnabled = enabled; ContainerConfiguration.AutoMemberInjectionRule = rule; ContainerConfiguration.AutoMemberInjectionFilter = filter; return this; } public ContainerConfigurator WithConstructorSelectionRule(Func<IEnumerable<ConstructorInfo>, IEnumerable<ConstructorInfo>> selectionRule) { ContainerConfiguration.ConstructorSelectionRule = selectionRule; return this; } public ContainerConfigurator OnContainerConfigurationChanged(Action<ContainerConfiguration> configurationChanged) { ContainerConfiguration.ConfigurationChangedEvent = configurationChanged; return this; } public ContainerConfigurator TreatParameterAndMemberNameAsDependencyName(bool enabled = true) { ContainerConfiguration.TreatingParameterAndMemberNameAsDependencyNameEnabled = enabled; return this; } public ContainerConfigurator WithNamedDependencyResolutionForUnNamedRequests(bool enabled = true) { ContainerConfiguration.NamedDependencyResolutionForUnNamedRequestsEnabled = enabled; return this; } public ContainerConfigurator WithDefaultLifetime(LifetimeDescriptor lifetime) { ContainerConfiguration.DefaultLifetime = lifetime; return this; } public ContainerConfigurator WithLifetimeValidation(bool enabled = true) { ContainerConfiguration.LifetimeValidationEnabled = enabled; return this; } public ContainerConfigurator WithReBuildSingletonsInChildContainer(bool enabled = true) { ContainerConfiguration.ReBuildSingletonsInChildContainerEnabled = enabled; return this; } public ContainerConfigurator WithExpressionCompiler(Func<LambdaExpression, Delegate> compilerDelegate) { ContainerConfiguration.ExternalExpressionCompiler = compilerDelegate; return this; } } }