Open sandboxFocus

Class NamespaceFabric

A compile-time entry point that executes within the compiler and IDE to add aspects and implement architecture rules for a specific namespace and its nested namespaces.

Inheritance
NamespaceFabric
Namespace: Metalama.Framework.Fabrics
Assembly: Metalama.Framework.dll
Syntax
public abstract class NamespaceFabric : Fabric, ICompileTimeSerializable, ITemplateProvider
Remarks

Namespace 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 (AmendNamespace(INamespaceAmender)) is invoked automatically simply because the class exists in the namespace.

A NamespaceFabric applies transformations to the namespace that contains it, allowing you to scope aspect application and validation rules to specific namespace hierarchies. This provides more granular control than ProjectFabric but broader scope than TypeFabric.

Constructors

Name Description
NamespaceFabric()

Methods

Name Description
AmendNamespace(INamespaceAmender)

Implement this method to programmatically analyze the current namespace, add aspects, configure options, validate architecture, and report or suppress diagnostics. This method is invoked automatically at compile time and design time.

Extension Methods

See Also