Open sandboxFocus

Class BaseUsageValidationAttribute

The base class for all attributes that validate usage.

Namespace: Metalama.Extensions.Architecture.Aspects
Assembly: Metalama.Extensions.Architecture.dll
Syntax
[CompileTime]
public abstract class BaseUsageValidationAttribute : Attribute, IConditionallyInheritableAspect, IAspect, ICompileTimeSerializable, ITemplateProvider

Constructors

Name Description
BaseUsageValidationAttribute()

Properties

Name Description
CurrentAssembly

Gets a value indicating whether the rule is matched by the assembly in which the attribute is defined.

CurrentNamespace

Gets a value indicating whether the rule is matched by the namespace of the type to which the attribute is defined.

Description

Gets an optional description message appended to the warning message.

ExclusionPredicateType

Gets a Type, derived from ReferencePredicate, that determines exclusions for the current architecture rule. Specifically, no warning will be reported if the IsMatch(ReferenceValidationContext) method of the ReferencePredicate returns true. This type must have a default constructor.

NamespaceOfTypes

Gets the namespaces that match the rule by specifying a set of types directly contained in the namespaces.

Namespaces

Gets the namespaces that match the rule by identifying the namespaces by their full name. Any namespace string can contain one of the following patterns: * (matches any identifier character, but not the dot), .. (matches any sub-namespace in the middle of a namespace), . (matches any sub-namespace at the beginning of a namespace) or .** (matches any sub-namespace at the end of a namespace -- this pattern is allowed but redundant).

ReferenceKinds

Gets the kinds of references that must be validated. The default value is All.

TypeNames

Gets the full names of the types that match the rule. Any type string can contain one of the following patterns: * (matches any identifier character, but not the dot), .. (matches any sub-namespace in the middle of a full type name), . (matches any sub-namespace at the beginning of the full type name) or .** (matches any sub-namespace and any type name at the end of a namespace).

Types

Gets the types that match the rule.

ValidateDerivedTypes

Gets a value indicating whether the types that are derived from the target type should also be validated, e.g. whether the aspect is inheritable.

Methods

Name Description
AddPredicatesFromAttributes(ReferencePredicateBuilder, INamespace, Action<ReferencePredicate>, in ScopedDiagnosticSink)

Adds the predicates defined by the properties of the current custom attribute.

TryCreateExclusionPredicate(IAspectBuilder<IMemberOrNamedType>, ReferencePredicateBuilder, out ReferencePredicate?)
TryCreatePredicate(IAspectBuilder<IMemberOrNamedType>, ReferencePredicateBuilder, out ReferencePredicate?)

Creates a ReferencePredicate based on the properties of the custom attributes.