Open sandboxFocusImprove this doc

Namespace Metalama.Framework.Workspaces

Overview

This namespace enables the loading of a C# project and solution into the Metalama.Framework.Code code model from any application, such as LinqPad.

The entry point of this namespace is the WorkspaceCollection class.

Class Diagram

classDiagram
    class ICompilationSet {
        Compilations
        Types
        Methods
        Fields
        Properties
        FieldsAndProperties
        Constructors
        Events
        TargetFrameworks
    }

    class IIntrospectionCompilationDetails {
        Diagnostics
        AspectClasses
        AspectLayers
        AspectInstances
        Advice
        Transformations
        IsMetalamaEnabled
        HasMetalamaSucceeded
    }

    class IProjectSet {
        Projects
        GetSubset()
        GetDeclaration()
    }

    IProjectSet --> ICompilationSet  : SourceCode
    ICompilationSetResult --|> IIntrospectionCompilationDetails
    ICompilationSetResult --> ICompilationSet  : TransformedCode

    IProjectSet --|>  ICompilationSet
    IProjectSet --|> ICompilationSetResult
    Project --|> IProjectSet
    Workspace  --|> IProjectSet
    WorkspaceCollection --* Workspace

    IProjectSet --* Project : Projects

Classes

DeclarationExtensions

DiagnosticExtensions

DiagnosticReporter

A utility class that makes it easy to report diagnostics from object queries in different environments. The default implementation writes messages to the console using the ReportToConsole(IReadOnlyList<IIntrospectionDiagnostic>) method. The action can be changed by setting the ReportAction property.

Project

Represents a C# project for a specific compilation.

ServiceBuilder

Workspace

Represents a set of projects. Workspaces can be created using the WorkspaceCollection class. When projects target several frameworks, they are represented by several instances of the Project class in the workspace.

WorkspaceCollection

Represents a set of workspaces. Two attempts to load a workspace with the same parameters, in the same WorkspaceCollection, will return the exact same instance, unless the Reset() method is called.

WorkspaceLoadException

Interfaces

ICompilationSet

Represents a set of compilations and exposes lists of declarations that merge the declarations from all the compilations in the set.

ICompilationSetResult

IProjectSet

Represents a set of projects. An IProjectSet can include several instances of the Project for the same file if they target multiple frameworks, one Project instance per framework. You can create a subset with the GetSubset(Predicate<Project>) method.

IWorkspaceLoadInfo

Exposes the information needed to reconstruct a Workspace.