Extension methods for IEligibilityBuilder.
Namespace: Metalama.Framework.Eligibility
Assembly: Metalama.Framework.dll
Syntax
[CompileTime]
public static class EligibilityExtensions
Methods
Name | Description |
---|---|
AddRules<T>(IEligibilityBuilder<T>, Action<IEligibilityBuilder<T>>) | Adds rules to the given IEligibilityBuilder by operating directly on the IEligibilityBuilder. |
Convert<T>(IEligibilityBuilder<T>) | Gets an object that allows to convert the given IEligibilityBuilder into an IEligibilityBuilder for a more specific type. |
DeclaringMember(IEligibilityBuilder<IParameter>) | Gets an IEligibilityBuilder for the declaring method or property of the parameter validated by the given IEligibilityBuilder. |
DeclaringType<T>(IEligibilityBuilder<T>) | Gets an IEligibilityBuilder for the declaring type of the member validated by the given IEligibilityBuilder. |
ExceptForInheritance<T>(IEligibilityBuilder<T>) | Gets an IEligibilityBuilder for the same declaration as the given IEligibilityBuilder but that is not applicable when the aspect is inheritable and is applied to a declaration that can be inherited or overridden. |
ExceptForScenarios<T>(IEligibilityBuilder<T>, EligibleScenarios) | Gets an IEligibilityBuilder for the same declaration as the given IEligibilityBuilder but that is not applicable to specified EligibleScenarios. |
ForScenarios<T>(IEligibilityBuilder<T>, EligibleScenarios) | Gets an IEligibilityBuilder for the same declaration as the given IEligibilityBuilder but that is applicable only to specified EligibleScenarios. |
If<T>(IEligibilityBuilder<T>, Predicate<T>) | Adds a rule to the given IEligibilityBuilder, but only if the validate object satisfies a given predicate. Otherwise, the rule is ignored. |
IsAdviceEligible(IDeclaration, AdviceKind) | Determines whether the given declaration is an eligible target for a specified kind of advice. |
IsAspectEligible(IDeclaration, Type, EligibleScenarios) | Determines whether the given declaration is an eligible target for a specified aspect type given as a reflection Type(IEligibilityBuilder<IHasType>). |
IsAspectEligible<T>(IDeclaration, EligibleScenarios) | Determines whether the given declaration is an eligible target for a specified aspect type given as a type parameter. |
IsContractAdviceEligible(IDeclaration, ContractDirection) | Determines whether the given declaration is an eligible target for an AddContract advice for a given ContractDirection. |
MustBe(IEligibilityBuilder<IType>, IType, ConversionKind) | |
MustBe(IEligibilityBuilder<IType>, Type, ConversionKind) | |
MustBeConvertibleTo(IEligibilityBuilder<IType>, IType, ConversionKind) | Requires the target type to be convertible to a given type (specified as an IType). |
MustBeConvertibleTo(IEligibilityBuilder<IType>, Type, ConversionKind) | Requires the target type to be convertible to a given type (specified as a reflection Type). |
MustBeConvertibleTo<T>(IEligibilityBuilder<IType>, ConversionKind) | Requires the target type to be convertible to a given type (specified as a type parameter). |
MustBeExplicitlyDeclared(IEligibilityBuilder<IDeclaration>) | Requires the declaration to be explicitly declared in source code. |
MustBeInstanceOfAnyType<T>(IEligibilityBuilder<T>, params Type[]) | Requires the validated object to be of one of the specified types. Note that this validates the object itself, not the declaration
that it represents. For instance, if the object is an IParameter and the |
MustBeInstanceOfType<T>(IEligibilityBuilder<T>, Type) | Requires the validated object to be of a certain type of metadata object, e.g. an IField or IMethod.
To check the type of a field, property or parameter, use code like |
MustBeOfAnyType<T>(IEligibilityBuilder<T>, params Type[]) | |
MustBeOfType<T>(IEligibilityBuilder<T>, Type) | |
MustBeReadable(IEligibilityBuilder<IFieldOrPropertyOrIndexer>) | Requires the target field, property or indexer to be writable. |
MustBeReadable(IEligibilityBuilder<IParameter>) | Requires the parameter to be readable, i.e. not |
MustBeRef(IEligibilityBuilder<IParameter>) | Requires the parameter to be |
MustBeReturnParameter(IEligibilityBuilder<IParameter>) | Requires the parameter to be the return parameter. |
MustBeRunTimeOnly(IEligibilityBuilder<INamedType>) | Requires the target type to be run-time, as opposed to compile-time or run-time-or-compile-time. |
MustBeStatic(IEligibilityBuilder<IMemberOrNamedType>) | Requires the target member or type to be static. |
MustBeWritable(IEligibilityBuilder<IFieldOrPropertyOrIndexer>) | Requires the target property or indexer to be writable. |
MustBeWritable(IEligibilityBuilder<IParameter>) | Requires the target parameter to be writable, i.e. |
MustBe<T>(IEligibilityBuilder<IType>, ConversionKind) | |
MustEqual(IEligibilityBuilder<IType>, SpecialType) | |
MustEqual(IEligibilityBuilder<IType>, Type) | |
MustEqual<T>(IEligibilityBuilder<T>, T) | |
MustHaveAccessibility(IEligibilityBuilder<IMemberOrNamedType>, Accessibility, params Accessibility[]) | Requires the target member to have exactly one of the given accessibilities. |
MustHaveAspectOfType(IEligibilityBuilder<IDeclaration>, Type) | Requires the target declaration to have an aspect of a given type. |
MustHaveAttributeOfType(IEligibilityBuilder<IDeclaration>, Type) | |
MustNotBeAbstract(IEligibilityBuilder<IMemberOrNamedType>) | Forbids the target member or type from being abstract. |
MustNotBeExtern(IEligibilityBuilder<IMethod>) | Forbids the target method from being extern. |
MustNotBeInterface(IEligibilityBuilder<INamedType>) | Forbids the target type from being an interface. |
MustNotBePartial(IEligibilityBuilder<IMemberOrNamedType>) | Requires the target declaration not to be partial. |
MustNotBePartial(IEligibilityBuilder<IMethod>) | Requires the target method not to be partial. |
MustNotBePrimaryConstructor(IEligibilityBuilder<IConstructor>) | Forbids the target constructor from being a primary constructor. |
MustNotBePrimaryConstructorOfNonRecordType(IEligibilityBuilder<IConstructor>) | Forbids the target constructor from being a primary constructor of a class or a struct (C# 12.0). |
MustNotBeRecordCopyConstructor(IEligibilityBuilder<IConstructor>) | Forbids the target constructor from being the copy constructor of a record. |
MustNotBeRef(IEligibilityBuilder<IFieldOrPropertyOrIndexer>) | Forbids the field, property or indexer from being |
MustNotBeRef(IEligibilityBuilder<IMethod>) | Forbids the method from returning a |
MustNotBeRef(IEligibilityBuilder<INamedType>) | Forbids the type from being |
MustNotBeReturnParameter(IEligibilityBuilder<IParameter>) | Forbids the parameter from being the return parameter. |
MustNotBeStatic(IEligibilityBuilder<IMemberOrNamedType>) | Forbids the target member or type from being static. |
MustNotBeVoid(IEligibilityBuilder<IParameter>) | Requires the parameter not to be |
MustNotHaveAspectOfType(IEligibilityBuilder<IDeclaration>, Type) | Forbids the target declaration from having an aspect of a given type. |
MustNotHaveAttributeOfType(IEligibilityBuilder<IDeclaration>, Type) | |
MustNotHaveRefOrOutParameter(IEligibilityBuilder<IMethod>) | Requires the target method not to have |
MustSatisfyAll<T>(IEligibilityBuilder<T>, params Action<IEligibilityBuilder<T>>[]) | Adds a group of conditions to the given IEligibilityBuilder, where all conditions must be satisfied by the declaration in order to be eligible for the aspect. |
MustSatisfyAny<T>(IEligibilityBuilder<T>, params Action<IEligibilityBuilder<T>>[]) | Adds a group of conditions to the given IEligibilityBuilder, where at least one condition must be satisfied by the declaration in order to be eligible for the aspect. |
MustSatisfy<T>(IEligibilityBuilder<T>, Predicate<T>, Func<IDescribedObject<T>, FormattableString>) | Adds a condition to the given IEligibilityBuilder, where the condition must be satisfied by the declaration in order to be eligible for the aspect. The new rule is given as a Predicate<T>. |
Parameter(IEligibilityBuilder<IHasParameters>, int) | Gets an IEligibilityBuilder for a parameter of the method validated by the given IEligibilityBuilder, identified by index. |
Parameter(IEligibilityBuilder<IHasParameters>, string) | Gets an IEligibilityBuilder for a parameter of the method validated by the given IEligibilityBuilder, identified by name. |
ReturnParameter(IEligibilityBuilder<IMethod>) | |
ReturnType(IEligibilityBuilder<IMethod>) | Gets an IEligibilityBuilder for the return type of the method validated by the given IEligibilityBuilder. |
Type(IEligibilityBuilder<IHasType>) | Gets an IEligibilityBuilder for the type of the declaration validated by the given IEligibilityBuilder. |