A commercial Metalama extension that allows to verify the code against architecture rules.
Install
| Product | Versions |
|---|---|
| .NET Standard |
README
About
The Metalama.Extensions.Architecture package allows you to validate your source code against architecture rules both in real time, straight in the IDE, or at compile time.
Features
- API: choose between custom attributes or a fluent API.
- Warnings appear as familiar C# warnings.
- Immediate feedback as you type in the IDE.
- Warnings can be suppressed using the standard mechanisms such as
#pragma warning disable. - Validate code references and dependencies.
- Validate naming conventions.
- Validate child/derived classes.
- Works across projects.
- Fully extensible using
Metalama.Extensions.Validation,Metalama.Frameworkand Roslyn. - Commercially supported.
License
This package is a commercial extension of the open-source Metalama.Framework and requires a Metalama Professional license.
Principal Types
There are two ways to use this package:
By adding to your code one of the following architecture custom attributes from the
Metalama.Extensions.Architecture.Aspectsnamespace:[CannotBeUsedFrom][CanOnlyBeUsedFrom][InternalsCannotBeUsedFrom][InternalsCanOnlyBeUsedFrom][Experimental][InternalImplementOnly][DerivedTypesMustRespectNamingConvention][DerivedTypesMustRespectRegexNamingConvention]
By using fabrics, using the extension methods in the
ArchitectureExtensionstypes
Example
The following snippet reports warnings whenever an internal type or member of the current namespace is used from a different namespace.
namespace SomeNamespace;
using Metalama.Extensions.Architecture.Fabrics;
using Metalama.Framework.Fabrics;
public class Fabric : NamespaceFabric
{
public override void AmendNamespace( INamespaceAmender amender )
{
amender.Verify().InternalsCanOnlyBeUsedFrom( UsageRule.OwnNamespace );
}
}
Documentation
- API Documentation: Metalama.Extensions.Architecture
- Conceptual Documentation: Verifying architecture
Related Packages
- Metalama.Extensions.Validation: the API on which
Metalama.Extensions.Architectureis built.
Changes from Previous Version
Adoption Assessment
A verified publisher signal is available. Assess fit from the package's supported frameworks, license and dependency graph rather than popularity alone.
Related Guides & Workflows
Learn how to evaluate, integrate, or audit this package in your .NET project.