Open sandboxFocus

Class Fabric

Base class for compile-time entry points that execute within the compiler and IDE to add aspects, configure libraries, and implement architecture rules. This class cannot be inherited directly.

Namespace: Metalama.Framework.Fabrics
Assembly: Metalama.Framework.dll
Syntax
[Durable]
[CompileTime]
[ImmutableType]
public abstract class Fabric : ICompileTimeSerializable, ITemplateProvider
Remarks

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-they are invoked automatically simply because they exist in your code. Think of fabrics as compile-time entry points.

To create a fabric, inherit from one of the following derived classes:

  • ProjectFabric - Applies transformations to the current project.
  • TransitiveProjectFabric - Applies transformations to projects that reference the current assembly.
  • NamespaceFabric - Applies transformations to a specific namespace.
  • TypeFabric - Applies transformations to a specific type (implemented as a nested type).

With fabrics, you can add aspects programmatically using LINQ-like queries, configure aspect libraries, and implement architecture validation rules.

Implements

Extension Methods

See Also