MetalamaAPI documentationAspect APIMetalama.​Framework.​AdvisingIAdvice­Factory
Open sandboxFocus

IAdviceFactory Interface

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
[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 using declarative advices and the IAdviceFactory.

Methods

Name Description
AddAnnotation<TDeclaration>(TDeclaration, IAnnotation<TDeclaration>, Boolean)

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.

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 using aspect members marked by InterfaceMemberAttribute.

ImplementInterface(INamedType, Type, OverrideStrategy, Object)

Makes a type implement a new interface specified as a reflection System.Type using aspect members marked by InterfaceMemberAttribute.

IntroduceAttribute(IDeclaration, IAttributeData, OverrideStrategy)

Adds a custom attribute to a given declaration.

IntroduceAutomaticProperty(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(INamedType, String, Type, IntroductionScope, OverrideStrategy, Action<IPropertyBuilder>, Object)

Introduces an auto-implemented property to the target type by specifying a property name and System.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 System.Type.

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

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

IntroduceIndexer(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(INamedType, IReadOnlyList<(IType, String)>, 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(INamedType, IReadOnlyList<(Type, String)>, 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(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.

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(IConstructor, String, Object, Object)

Overrides the implementation of a constructor.

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(IFieldOrPropertyOrIndexer, 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 System.Type from a given declaration.

WithTemplateProvider(ITemplateProvider)

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

WithTemplateProvider(TemplateProvider)

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

See Also