A compile-time entry point that executes within the compiler and IDE to add aspects, configure libraries, and implement architecture rules for the current project.
Namespace: Metalama.Framework.Fabrics
Assembly: Metalama.Framework.dll
Syntax
public abstract class ProjectFabric : Fabric, ICompileTimeSerializable, ITemplateProviderRemarks
Project fabrics are unique classes that execute at compile time and design time. Unlike aspects, fabrics do not need to be applied to any declaration or called from anywhere—their primary method (AmendProject(IProjectAmender)) is invoked automatically simply because the class exists in your code. Think of fabrics as compile-time entry points.
With project fabrics, you can:
- Add aspects programmatically using LINQ-like code queries instead of marking individual declarations with custom attributes.
- Configure aspect libraries for the current project.
- Implement and enforce architecture rules and validation.
A ProjectFabric applies transformations only to the project in which it is defined. To apply transformations to projects that reference the current project, use TransitiveProjectFabric instead.
When a project contains multiple project fabrics, they are ordered by source file location (closest to the root directory first), then by type name.
Constructors
| Name | Description |
|---|---|
| ProjectFabric() |
Methods
| Name | Description |
|---|---|
| AmendProject(IProjectAmender) | Implement this method to programmatically analyze the current project, add aspects, configure options, validate architecture, and report or suppress diagnostics. This method is invoked automatically at compile time and design time. |