An object that allows declarations to be advised (transformed) using extension methods from AdviserExtensions. This is the non-generic base interface; aspects typically use the generic IAdviser<T> variant.
Namespace: Metalama.Framework.Aspects
Assembly: Metalama.Framework.dll
Syntax
[InternalImplement]
[CompileTime]
public interface IAdviserRemarks
The IAdviser interface provides the foundation for code transformation in Metalama. It exposes:
- Target declaration: The code element being advised (method, type, property, etc.)
- Diagnostics: Report errors, warnings, or suppress compiler diagnostics
- Compilation context: Access to the code model in both original and modified states
- Declaration switching: Create adviser instances for other declarations via With<TNewDeclaration>(TNewDeclaration)
Advising is performed through extension methods in AdviserExtensions, such as Override(),
IntroduceMethod(), ImplementInterface(), and others.
Properties
| Name | Description |
|---|---|
| Compilation | Gets the compilation in its original state, before any modifications by aspects. |
| Diagnostics | Gets a service that allows to report or suppress diagnostics. |
| MutableCompilation | Gets the mutable compilation that the current IAspectBuilder is working on. It includes all modifications made by the current aspect so far, including advice added programmatically via AdviserExtensions methods and advice added declaratively via attributes like IntroduceAttribute. |
| Target | Gets the declaration that will be advised. |
Methods
| Name | Description |
|---|---|
| With<TNewDeclaration>(TNewDeclaration) |