Namespace: Metalama.Framework.Aspects
Assembly: Metalama.Framework.dll
Syntax
[CompileTime]
public static class AdviserExtensionsMethods
| Name | Description |
|---|---|
| AddAnnotation<TDeclaration>(IAdviser<TDeclaration>, IAnnotation<TDeclaration>, bool) | Adds a custom annotation to a declaration. Annotations enable communication between aspects by attaching arbitrary serializable objects to declarations that other aspects can query. |
| AddAspect<TAspect>(IAdviser) | Adds an aspect to the target declaration, using the aspect type's default constructor. Use the With<TNewDeclaration>(TNewDeclaration) method to add the aspect to a different declaration than the current one. |
| AddAspect<TDeclaration>(IAdviser<TDeclaration>, IAspect<TDeclaration>) | Adds an aspect to the target declaration. Use the With<TNewDeclaration>(TNewDeclaration) method to add the aspect to a different declaration than the current one. |
| AddContract(IAdviser<IFieldOrPropertyOrIndexer>, string, ContractDirection, object?, object?) | Adds a contract to a field, property or indexer. Contracts validate or normalize values, typically used to validate assigned values (setters) or returned values (getters). Fields with contracts are automatically transformed into properties. Use the With<TNewDeclaration>(TNewDeclaration) method to add the contract to a different field, property or indexer than the current one. |
| AddContract(IAdviser<IParameter>, string, ContractDirection, object?, object?) | Adds a contract to a parameter. Contracts validate or normalize parameter values at different points in the data flow, typically used for precondition checks (input parameters) or postcondition checks (output parameters and return values). Use the With<TNewDeclaration>(TNewDeclaration) method to add the contract to a different parameter than the current one. |
| AddInitializer(IAdviser<IConstructor>, IStatement) | Adds an initializer to a specific constructor by specifying an IStatement. Use the With<TNewDeclaration>(TNewDeclaration) method to add the initializer to a different constructor than the current one. |
| AddInitializer(IAdviser<IConstructor>, string, object?, object?) | Adds an initializer to a specific constructor by using a template. Use the With<TNewDeclaration>(TNewDeclaration) method to add the initializer to a different constructor than the current one. |
| AddInitializer(IAdviser<INamedType>, IStatement, InitializerKind) | Adds a type or instance initializer by specifying an IStatement. Use the With<TNewDeclaration>(TNewDeclaration) method to add the initializer to a different type than the current one. |
| AddInitializer(IAdviser<INamedType>, string, InitializerKind, object?, object?) | Adds a type or instance initializer by using a template. Use the With<TNewDeclaration>(TNewDeclaration) method to add the initializer to a different type than the current one. |
| ImplementInterface(IAdviser<INamedType>, INamedType, OverrideStrategy, object?) | Makes a type implement a new interface specified as an INamedType. Interface members can be introduced declaratively by marking an aspect member with InterfaceMemberAttribute or IntroduceAttribute(IAdviser<IDeclaration>, IAttributeData, OverrideStrategy), or programmatically using introduction methods. Use the With<TNewDeclaration>(TNewDeclaration) method to implement the interface on a different type than the current one. |
| ImplementInterface(IAdviser<INamedType>, Type, OverrideStrategy, object?) | Makes a type implement a new interface specified as a reflection Type. Interface members can be introduced declaratively by marking an aspect member with InterfaceMemberAttribute, IntroduceAttribute(IAdviser<IDeclaration>, IAttributeData, OverrideStrategy) or programmatically using introduction methods. Use the With<TNewDeclaration>(TNewDeclaration) method to implement the interface on a different type than the current one. |
| IntroduceAttribute(IAdviser<IDeclaration>, IAttributeData, OverrideStrategy) | Adds a custom attribute to a given declaration. Use the With<TNewDeclaration>(TNewDeclaration) method to add the attribute to a different declaration than the current one. |
| IntroduceAutomaticProperty(IAdviser<INamedType>, string, IType, IntroductionScope, OverrideStrategy, Action<IPropertyBuilder>?, object?) | Introduces an auto-implemented property to the target type by specifying a property name and IType. |
| IntroduceAutomaticProperty(IAdviser<INamedType>, string, Type, IntroductionScope, OverrideStrategy, Action<IPropertyBuilder>?, object?) | Introduces an auto-implemented property to the target type by specifying a property name and Type. |
| IntroduceBinaryOperator(IAdviser<INamedType>, string, IType, IType, IType, OperatorKind, OverrideStrategy, Action<IMethodBuilder>?, object?, object?) | Introduces a binary operator to the target type, or overrides the implementation of an existing one. Use the With<TNewDeclaration>(TNewDeclaration) method to apply the advice to a different type than the current one. |
| IntroduceClass(IAdviser<INamespaceOrNamedType>, string, OverrideStrategy, Action<INamedTypeBuilder>?) | Introduces a new class into the current namespace (as a top-level type) or type (as a nested type). Use the With<TNewDeclaration>(TNewDeclaration) or WithNamespace(IAdviser<ICompilation>, string) method to introduce the class to a different type or namespace than the current one. |
| IntroduceConstructor(IAdviser<INamedType>, string, OverrideStrategy, Action<IConstructorBuilder>?, object?, object?) | Introduces a constructor to the target type, or overrides the implementation of an existing one. Use the With<TNewDeclaration>(TNewDeclaration) method to apply the advice to another type than the current one. |
| IntroduceConversionOperator(IAdviser<INamedType>, string, IType, IType, bool, bool, OverrideStrategy, Action<IMethodBuilder>?, object?, object?) | Introduces a conversion operator to the target type, or overrides the implementation of an existing one. Use the With<TNewDeclaration>(TNewDeclaration) method to apply the advice to a different type than the current one. |
| IntroduceEvent(IAdviser<INamedType>, string, IntroductionScope, OverrideStrategy, Action<IEventBuilder>?, object?) | Introduces a new event to the target type, or overrides the implementation of an existing one, by specifying an event template. Use the With<TNewDeclaration>(TNewDeclaration) method to introduce the event to a different type than the current one. |
| IntroduceEvent(IAdviser<INamedType>, string, string, string, string?, string?, IntroductionScope, OverrideStrategy, Action<IEventBuilder>?, object?, object?) | Introduces a new event to the target type, or overrides the implementation of an existing one, by specifying individual template methods for the adder and the remover, and optionally an invocation interception template. |
| IntroduceField(IAdviser<INamedType>, string, IntroductionScope, OverrideStrategy, Action<IFieldBuilder>?, object?) | Introduces a field to the target type by specifying a template. Use the With<TNewDeclaration>(TNewDeclaration) method to apply the advice to a different type than the current one. |
| IntroduceField(IAdviser<INamedType>, string, IType, IntroductionScope, OverrideStrategy, Action<IFieldBuilder>?, object?) | Introduces a field to the target type by specifying a field name and IType. |
| IntroduceField(IAdviser<INamedType>, string, Type, IntroductionScope, OverrideStrategy, Action<IFieldBuilder>?, object?) | Introduces a field to the target type by specifying a field name and Type. |
| IntroduceFinalizer(IAdviser<INamedType>, string, OverrideStrategy, object?, object?) | Introduces a finalizer or overrides the implementation of the existing one. Use the With<TNewDeclaration>(TNewDeclaration) method to apply the advice to a different type than the current one. |
| IntroduceIndexer(IAdviser<INamedType>, IType, string?, string?, IntroductionScope, OverrideStrategy, Action<IIndexerBuilder>?, object?, object?) | Introduces an indexer to the target type, or overrides the implementation of an existing one, by specifying individual template methods for each accessor. |
| IntroduceIndexer(IAdviser<INamedType>, IReadOnlyList<(IType Type, string Name)>, string?, string?, IntroductionScope, OverrideStrategy, Action<IIndexerBuilder>?, object?, object?) | Introduces an indexer to the target type, or overrides the implementation of an existing one, by specifying individual template methods for each accessor. |
| IntroduceIndexer(IAdviser<INamedType>, IReadOnlyList<(Type Type, string Name)>, string?, string?, IntroductionScope, OverrideStrategy, Action<IIndexerBuilder>?, object?, object?) | Introduces an indexer to the target type, or overrides the implementation of an existing one, by specifying individual template methods for each accessor. |
| IntroduceIndexer(IAdviser<INamedType>, Type, string?, string?, IntroductionScope, OverrideStrategy, Action<IIndexerBuilder>?, object?, object?) | Introduces an indexer to the target type, or overrides the implementation of an existing one, by specifying individual template methods for each accessor. |
| IntroduceInterface(IAdviser<INamespaceOrNamedType>, string, OverrideStrategy, Action<INamedTypeBuilder>?) | Introduces a new interface into the current namespace (as a top-level type) or type (as a nested type). Use the With<TNewDeclaration>(TNewDeclaration) or WithNamespace(IAdviser<ICompilation>, string) method to introduce the interface to a different type or namespace than the current one. |
| IntroduceMethod(IAdviser<INamedType>, string, IntroductionScope, OverrideStrategy, Action<IMethodBuilder>?, object?, object?) | Introduces a new method to a type, or optionally overrides an existing method with the same signature. |
| IntroduceParameter(IAdviser<IConstructor>, string, IType, TypedConstant, IPullStrategy?, ImmutableArray<AttributeConstruction>) | |
| IntroduceParameter(IAdviser<IConstructor>, string, IType, TypedConstant, Func<IParameter, IConstructor, PullAction>?, ImmutableArray<AttributeConstruction>) | |
| IntroduceParameter(IAdviser<IConstructor>, string, Type, TypedConstant, IPullStrategy?, ImmutableArray<AttributeConstruction>) | |
| IntroduceParameter(IAdviser<IConstructor>, string, Type, TypedConstant, Func<IParameter, IConstructor, PullAction>?, ImmutableArray<AttributeConstruction>) | |
| IntroduceProperty(IAdviser<INamedType>, string, IntroductionScope, OverrideStrategy, Action<IPropertyBuilder>?, object?) | Introduces a property to the target type, or overrides the implementation of an existing one, by specifying a property template. Use the With<TNewDeclaration>(TNewDeclaration) method to apply the advice to a different type than the current one. |
| IntroduceProperty(IAdviser<INamedType>, string, string?, string?, IntroductionScope, OverrideStrategy, Action<IPropertyBuilder>?, object?, object?) | Introduces a property to the target type by specifying individual template methods for each accessor (getter and setter). |
| IntroduceUnaryOperator(IAdviser<INamedType>, string, IType, IType, OperatorKind, OverrideStrategy, Action<IMethodBuilder>?, object?, object?) | Introduces a unary operator to the target type, or overrides the implementation of an existing one. Use the With<TNewDeclaration>(TNewDeclaration) method to apply the advice to a different type than the current one. |
| Override(IAdviser<IConstructor>, string, object?, object?) | Overrides the implementation of a constructor. Use the With<TNewDeclaration>(TNewDeclaration) method to apply the advice to a different constructor than the current one. |
| Override(IAdviser<IFieldOrProperty>, string, object?) | Overrides a field or property by specifying a property template. Use the With<TNewDeclaration>(TNewDeclaration) method to apply the advice to a different field or property than the current one. |
| Override(IAdviser<IMethod>, in MethodTemplateSelector, object?, object?) | Overrides a method's implementation with code from a template. |
| OverrideAccessors(IAdviser<IEvent>, string?, string?, string?, string?, object?, object?) | Overrides an event by specifying a template for the adder, the remover, and/or the invocation interception. Use the With<TNewDeclaration>(TNewDeclaration) method to override a different event than the current one. |
| OverrideAccessors(IAdviser<IFieldOrPropertyOrIndexer>, in GetterTemplateSelector, string?, object?, object?) | Overrides a field, property, or indexer by specifying templates for the getter and/or setter. Use the With<TNewDeclaration>(TNewDeclaration) method to apply the advice to a different field, property or indexer than the current one. |
| OverrideAccessors(IAdviser<IFieldOrProperty>, in GetterTemplateSelector, string?, object?, object?) | Overrides a field or property by specifying a method template for the getter, the setter, or both. Use the With<TNewDeclaration>(TNewDeclaration) method to apply the advice to another field or property than the current one. |
| OverrideAccessors(IAdviser<IIndexer>, in GetterTemplateSelector, string?, object?, object?) | Overrides an indexer by specifying a method template for the getter, the setter, or both. Use the With<TNewDeclaration>(TNewDeclaration) method to apply the advice to another indexer than the current one. |
| RemoveAttributes(IAdviser<IDeclaration>, INamedType) | Removes all custom attributes of a given INamedType from a given declaration. Use the With<TNewDeclaration>(TNewDeclaration) method to remove attributes from a different declaration than the current one. |
| RemoveAttributes(IAdviser<IDeclaration>, Type) | Removes all custom attributes of a given Type from a given declaration. Use the With<TNewDeclaration>(TNewDeclaration) method to remove attributes from a different declaration than the current one. |
| RequireAspect(IAdviser, Type) | Adds an aspect to the target declaration, unless there is already an aspect of that type on the declaration. Use the With<TNewDeclaration>(TNewDeclaration) method to add the aspect to a different declaration than the current one. |
| RequireAspect<TAspect>(IAdviser) | Adds an aspect to the target declaration, unless there is already an aspect of that type on the declaration. Use the With<TNewDeclaration>(TNewDeclaration) method to add the aspect to a different declaration than the current one. |
| WithChildNamespace(IAdviser<INamespace>, string) | Gets an IAdviser<T> for a specific child namespace of the current namespace. |
| WithDeclaringType(IAdviser<IMember>) | Gets an IAdviser<T> for the declaring type of the current member. |
| WithNamespace(IAdviser<ICompilation>, string) | Gets an IAdviser<T> for a specific namespace of the current compilation. |
| WithTemplateProvider<TDeclaration>(IAdviser<TDeclaration>, ITemplateProvider) | Gets an IAdviser<T> with a different template provider, provided as an ITemplateProvider. |
| WithTemplateProvider<TDeclaration>(IAdviser<TDeclaration>, in TemplateProvider) | Gets an IAdviser<T> with a different template provider, specified as a TemplateProvider. |