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;
namespace Stashbox.Configuration
{
public static class Rules
{
public enum RegistrationBehavior
{
SkipDuplications,
ThrowException,
ReplaceExisting,
PreserveDuplications
}
[Flags]
public enum AutoMemberInjectionRules
{
None = 0,
PropertiesWithPublicSetter = 4,
PropertiesWithLimitedAccess = 8,
PrivateFields = 16
}
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;
}
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();
}
}
}