Metalama 1.0 / / Metalama Documentation / Aspect API Documentation / Metalama.​Framework.​Advising / IAdvice­Factory

Interface IAdviceFactory

Exposes all factory methods to create advice. Exposed on the Advice property of IAspectBuilder<TAspectTarget> or IAspectBuilder.

Namespace: Metalama.Framework.Advising
Assembly: Metalama.Framework.dll
Syntax
[InternalImplement]
[CompileTime]
public interface IAdviceFactory

Properties

Name Description
MutableCompilation

Gets the mutable compilation that the current aspect builder is working on. It includes all modifications done by the current aspect in the current type thanks to the IAdviceFactory.

Methods

Name Description
AddContract(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 direction parameter should be set to Output.

AddContract(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, ...).

AddInitializer(IConstructor, IStatement)

Adds an initializer to a specific constructor by specifying an IStatement.

AddInitializer(IConstructor, String, Object, Object)

Adds an initializer to a specific constructor by using a template.

AddInitializer(INamedType, IStatement, InitializerKind)

Adds a type or instance initializer by specifying an IStatement.

AddInitializer(INamedType, String, InitializerKind, Object, Object)

Adds a type or instance initializer by using a template.

ImplementInterface(INamedType, INamedType, OverrideStrategy, Object)

Makes a type implement a new interface specified as an INamedType.

ImplementInterface(INamedType, Type, OverrideStrategy, Object)

Makes a type implement a new interface specified as a reflection Type.

IntroduceAttribute(IDeclaration, IAttributeData, OverrideStrategy)

Adds a custom attribute to a given declaration.

IntroduceAutomaticProperty(INamedType, String, IType, IntroductionScope, OverrideStrategy, Action<IPropertyBuilder>, Object)

Introduces an automatic to the target type by specifying a property name and IType.

IntroduceAutomaticProperty(INamedType, String, Type, IntroductionScope, OverrideStrategy, Action<IPropertyBuilder>, Object)

Introduces an automatic to the target type by specifying a property name and Type.

IntroduceBinaryOperator(INamedType, String, IType, IType, IType, OperatorKind, OverrideStrategy, Action<IMethodBuilder>, Object, Object)
IntroduceConversionOperator(INamedType, String, IType, IType, Boolean, OverrideStrategy, Action<IMethodBuilder>, Object, Object)
IntroduceEvent(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.

IntroduceEvent(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.

IntroduceField(INamedType, String, IntroductionScope, OverrideStrategy, Action<IFieldBuilder>, Object)

Introduces a field to the target type by specifying a template.

IntroduceField(INamedType, String, IType, IntroductionScope, OverrideStrategy, Action<IFieldBuilder>, Object)

Introduces a field to the target type by specifying a field name and IType.

IntroduceField(INamedType, String, Type, IntroductionScope, OverrideStrategy, Action<IFieldBuilder>, Object)

Introduces a field to the target type by specifying a field name and Type.

IntroduceFinalizer(INamedType, String, OverrideStrategy, Object, Object)

Introduces a finalizer or overrides the implementation of the existing one.

IntroduceMethod(INamedType, String, IntroductionScope, OverrideStrategy, Action<IMethodBuilder>, Object, Object)

Introduces a new method or overrides the implementation of the existing one.

IntroduceParameter(IConstructor, String, IType, TypedConstant, Func<IParameter, IConstructor, PullAction>, ImmutableArray<AttributeConstruction>)
IntroduceParameter(IConstructor, String, Type, TypedConstant, Func<IParameter, IConstructor, PullAction>, ImmutableArray<AttributeConstruction>)
IntroduceProperty(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.

IntroduceProperty(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.

IntroduceUnaryOperator(INamedType, String, IType, IType, OperatorKind, OverrideStrategy, Action<IMethodBuilder>, Object, Object)
Override(IFieldOrProperty, String, Object)

Overrides a field or property by specifying a property template.

Override(IMethod, in MethodTemplateSelector, Object, Object)

Overrides the implementation of a method.

OverrideAccessors(IEvent, String, String, String, Object, Object)

Overrides an event by specifying a template for the adder, the remover, and/or the raiser.

OverrideAccessors(IFieldOrProperty, in GetterTemplateSelector, String, Object, Object)

Overrides a field or property by specifying a method template for the getter, the setter, or both.

RemoveAttributes(IDeclaration, INamedType)

Removes all custom attributes of a given INamedType from a given declaration.

RemoveAttributes(IDeclaration, Type)

Removes all custom attributes of a given Type from a given declaration.

WithTemplateProvider(ITemplateProvider)

Returns a copy of the current IAdviceFactory that will a specified object to find factory methods.

Extension Methods

PresentingExtensions.AsHyperlink(Object)

See Also