Open sandboxFocusImprove this doc

Namespace Metalama.Framework.Project

This namespace serves the following purposes:

  • It provides read access to the project configuration, which encompasses project references, preprocessor symbols, build properties, and other related information. Refer to the IProject interface for more details. This interface can be accessed from any code element through the ICompilation.Project property.

  • It discloses information about the current execution context via the MetalamaExecutionContext.Current property.

  • It reveals the service provider, which facilitates access from high-level code to the low-level plugins.

Conceptual documentation

Refer to Making aspects configurable.

Class diagram

classDiagram

    class ICompilation {
        Project
    }

    class IProject {
        AssemblyReferences
        Configuration
        Path
        PreprocessorSymbols
        ServiceProvider
        TargetFramework
        TryGetProperty()
    }

    class IExecutionContext {
        Compilation
        ExecutionScenario
        FormatProvider
        ServiceProvider
    }

    class MetalamaExecutionContext {
        Current
    }

    class IServiceProvider {
        GetService()
    }

    class IService {

    }

    class IExecutionScenario {
        Name
        IsDesignTime
        CapturesCodeFixImplementations
        CapturesCodeFixTitles
        CapturesNonObservableTransformations
    }

    IProject <-- ICompilation : exposes
    IServiceProvider <-- IProject: exposes
    IExecutionContext <-- MetalamaExecutionContext : exposes
    IServiceProvider <-- IExecutionContext: exposes
    IExecutionScenario <-- IExecutionContext: exposes
    IService <-- IServiceProvider: provides

Namespace members

Classes

MetalamaExecutionContext

Exposes the current execution context of Metalama.

ProjectExtension

An base class that must be implemented by classes that want to extend IProject with project-local configuration data using the Extension<T>() method.

ServiceProviderExtensions

Provides extensions methods to the IServiceProvider interface.

Interfaces

IExecutionContext

Represents the execution context of Metalama. Exposed by the Current property of MetalamaExecutionContext.

IExecutionScenario

Exposes the properties of the scenarios in which an aspect, template, or fabric is being executed. The interface is accessible from the MetalamaExecutionContext class.

IProject

Exposes the properties of the current C# project, such as Path, AssemblyReferences, PreprocessorSymbols, Configuration or TargetFramework. To access a custom MSBuild property, use TryGetProperty(string, out string?). You can extend this interface with your own framework-specific by using the Extension<T>() method.