Namespace: Metalama.Framework.Advising
Assembly: Metalama.Framework.dll
Syntax
[CompileTime]
public static class AdviserExtensions
Methods
Name | Description |
---|---|
AddAnnotation<TDeclaration>(IAdviser<TDeclaration>, IAnnotation<TDeclaration>, bool) | Adds a custom annotation to a declaration. An annotation is an arbitrary but serializable object that can then be retrieved using the GetAnnotations<TAnnotation>() method of the Enhancements<T>(T) object. Annotations are a way of communication between aspects or classes of aspects. Use the With<TNewDeclaration>(TNewDeclaration) method to apply the advice to another declaration than the current one. |
AddContract(IAdviser<IFieldOrPropertyOrIndexer>, string, ContractDirection, object?, object?) | Adds a contract to a field, property or indexer. Contracts are usually used to validate the value assigned to fields properties or indexers or to normalize their value (null-to-empty, trimming, normalizing case, ...)
before assignment. Alternatively, a contract can be used to validate the value returned by a property or indexer, in which case the |
AddContract(IAdviser<IParameter>, string, ContractDirection, object?, object?) | Adds a contract to a parameter. Contracts are usually used to validate parameters (pre- or post-conditions) or to normalize their value (null-to-empty, trimming, normalizing case, ...). Use the With<TNewDeclaration>(TNewDeclaration) method to apply the advice to another declaration 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 apply the advice to another declaration 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 apply the advice to another declaration 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 apply the advice to another declaration 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 apply the advice to another declaration 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 by InterfaceMemberAttribute or
IntroduceAttribute, or programmatically using |
ImplementInterface(IAdviser<INamedType>, Type, OverrideStrategy, object?) | Makes a type implement a new interface specified as a reflection Type.
Interface members can be introduced by marking an aspect member by InterfaceMemberAttribute,
IntroduceAttribute or programmatically using |
IntroduceAttribute(IAdviser<IDeclaration>, IAttributeData, OverrideStrategy) | Adds a custom attribute to a given declaration. Use the With<TNewDeclaration>(TNewDeclaration) method to apply the advice to another 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. Use the With<TNewDeclaration>(TNewDeclaration) method to apply the advice to another declaration than the current one. |
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. Use the With<TNewDeclaration>(TNewDeclaration) method to apply the advice to another declaration than the current one. |
IntroduceBinaryOperator(IAdviser<INamedType>, string, IType, IType, IType, OperatorKind, OverrideStrategy, Action<IMethodBuilder>?, object?, object?) | |
IntroduceClass(IAdviser<INamespaceOrNamedType>, string, OverrideStrategy, Action<INamedTypeBuilder>?) | |
IntroduceConstructor(IAdviser<INamedType>, string, OverrideStrategy, Action<IConstructorBuilder>?, object?, object?) | |
IntroduceConversionOperator(IAdviser<INamedType>, string, IType, IType, bool, OverrideStrategy, Action<IMethodBuilder>?, object?, object?) | |
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 apply the advice to another declaration than the current one. |
IntroduceEvent(IAdviser<INamedType>, 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, the remover, and the raiser. Use the With<TNewDeclaration>(TNewDeclaration) method to apply the advice to another declaration than the current one. |
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 another declaration 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. Use the With<TNewDeclaration>(TNewDeclaration) method to apply the advice to another declaration than the current one. |
IntroduceField(IAdviser<INamedType>, string, Type, IntroductionScope, OverrideStrategy, Action<IFieldBuilder>?, object?) | Introduces a field to the target type by specifying a field name and Type. Use the With<TNewDeclaration>(TNewDeclaration) method to apply the advice to another declaration than the current one. |
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 another declaration 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. Use the With<TNewDeclaration>(TNewDeclaration) method to apply the advice to another declaration than the current one. |
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. Use the With<TNewDeclaration>(TNewDeclaration) method to apply the advice to another declaration than the current one. |
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. Use the With<TNewDeclaration>(TNewDeclaration) method to apply the advice to another declaration than the current one. |
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. Use the With<TNewDeclaration>(TNewDeclaration) method to apply the advice to another declaration than the current one. |
IntroduceInterface(IAdviser<INamespaceOrNamedType>, string, OverrideStrategy, Action<INamedTypeBuilder>?) | |
IntroduceMethod(IAdviser<INamedType>, string, IntroductionScope, OverrideStrategy, Action<IMethodBuilder>?, object?, object?) | Introduces a new method or overrides the implementation of the existing one. Use the With<TNewDeclaration>(TNewDeclaration) method to apply the advice to another declaration than the current one. |
IntroduceParameter(IAdviser<IConstructor>, string, IType, TypedConstant, Func<IParameter, IConstructor, PullAction>?, ImmutableArray<AttributeConstruction>) | Appends a parameter to a constructor by specifying its name and IType. Use the With<TNewDeclaration>(TNewDeclaration) method to apply the advice to another declaration than the current one. |
IntroduceParameter(IAdviser<IConstructor>, string, Type, TypedConstant, Func<IParameter, IConstructor, PullAction>?, ImmutableArray<AttributeConstruction>) | Appends a parameter to a constructor by specifying its name and Type. Use the With<TNewDeclaration>(TNewDeclaration) method to apply the advice to another declaration than the current one. |
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 another declaration than the current one. |
IntroduceProperty(IAdviser<INamedType>, string, string?, string?, IntroductionScope, OverrideStrategy, Action<IPropertyBuilder>?, object?, object?) | Introduces a property to the target type, or overrides the implementation of an existing one, by specifying individual template methods for each accessor. Use the With<TNewDeclaration>(TNewDeclaration) method to apply the advice to another declaration than the current one. |
IntroduceUnaryOperator(IAdviser<INamedType>, string, IType, IType, OperatorKind, OverrideStrategy, Action<IMethodBuilder>?, object?, object?) | |
Override(IAdviser<IConstructor>, string, object?, object?) | Overrides the implementation of a constructor. Use the With<TNewDeclaration>(TNewDeclaration) method to apply the advice to another declaration 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 another declaration than the current one. |
Override(IAdviser<IMethod>, in MethodTemplateSelector, object?, object?) | Overrides the implementation of a method. Use the With<TNewDeclaration>(TNewDeclaration) method to apply the advice to another declaration than the current one. |
OverrideAccessors(IAdviser<IEvent>, string?, string?, string?, object?, object?) | Overrides an event by specifying a template for the adder, the remover, and/or the raiser. Use the With<TNewDeclaration>(TNewDeclaration) method to apply the advice to another declaration than the current one. |
OverrideAccessors(IAdviser<IFieldOrPropertyOrIndexer>, 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 declaration than the current one. |
OverrideAccessors(IAdviser<IFieldOrProperty>, in GetterTemplateSelector, string?, object?, object?) | |
OverrideAccessors(IAdviser<IIndexer>, in GetterTemplateSelector, string?, object?, object?) | |
RemoveAttributes(IAdviser<IDeclaration>, INamedType) | Removes all custom attributes of a given INamedType from a given declaration. Use the With<TNewDeclaration>(TNewDeclaration) method to apply the advice to another 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 apply the advice to another declaration than the current one. |
WithChildNamespace(IAdviser<INamespace>, string) | |
WithNamespace(IAdviser<ICompilation>, string) | |
WithTemplateProvider<TDeclaration>(IAdviser<TDeclaration>, ITemplateProvider) |