Rules
Represents the predefined configuration rules of the StashboxContainer.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Runtime.CompilerServices;
namespace Stashbox.Configuration
{
public static class Rules
{
[System.Runtime.CompilerServices.NullableContext(1)]
[System.Runtime.CompilerServices.Nullable(0)]
public static class ServiceRegistrationFilters
{
public static readonly Func<Type, Type, bool> Interfaces = (Type _, Type t) => t.IsInterface;
public static readonly Func<Type, Type, bool> AbstractClasses = delegate(Type _, Type t) {
if (t.IsAbstract)
return !t.IsInterface;
return false;
};
}
public enum RegistrationBehavior
{
SkipDuplications,
ThrowException,
ReplaceExisting,
PreserveDuplications
}
[Flags]
public enum AutoMemberInjectionRules
{
None = 2,
PropertiesWithPublicSetter = 4,
PropertiesWithLimitedAccess = 8,
PrivateFields = 16
}
[System.Runtime.CompilerServices.NullableContext(1)]
[System.Runtime.CompilerServices.Nullable(0)]
public static class ConstructorSelection
{
public static readonly Func<IEnumerable<ConstructorInfo>, IEnumerable<ConstructorInfo>> PreferMostParameters = (IEnumerable<ConstructorInfo> constructors) => from constructor in constructors
orderby constructor.GetParameters().Length descending
select constructor;
public static readonly Func<IEnumerable<ConstructorInfo>, IEnumerable<ConstructorInfo>> PreferLeastParameters = (IEnumerable<ConstructorInfo> constructors) => from constructor in constructors
orderby constructor.GetParameters().Length
select constructor;
}
[System.Runtime.CompilerServices.NullableContext(1)]
[System.Runtime.CompilerServices.Nullable(0)]
public static class ExpressionCompilers
{
public static readonly Func<LambdaExpression, Delegate> MicrosoftExpressionCompiler = (LambdaExpression lambda) => lambda.Compile();
public static readonly Func<LambdaExpression, Delegate> StashboxExpressionCompiler = (LambdaExpression lambda) => lambda.CompileDelegate();
}
}
}