PostSharp.Constraints Namespace |
This namespace allows you to validate your code against predefined or custom design rules.

Class | Description | |
---|---|---|
![]() | ComponentInternalAttribute | ReferentialConstraint that, when applied on a declaration, limits the scope (namespace or type) in which this declaration
can be used. This constraint is useful to isolate several components from each other, even if they are implemented in
the same assembly. The ComponentInternal constraint sets the visibility of a declaration between internal and private.
|
![]() | Constraint |
Root class for all constraints based on MulticastAttribute.
A constraint is a piece validation logic executed at build time. Constraints
are applied to elements of code ((Assembly, Type,
MethodInfo, ConstructorInfo, PropertyInfo,
EventInfo, FieldInfo, ParameterInfo)
typically using multicast custom attributes, and verified
at build time for every assembly using this element of code.
|
![]() | ExperimentalAttribute |
Custom attribute that, when applied on a declaration, causes PostSharp to emit a warning if the declaration is being used.
|
![]() | InternalAttribute | ReferentialConstraint, when applied to a declaration, prevents it to be used from a different assembly.
This constraint can be used when a declaration must be made public for technical reasons, but its author does
not want it to be used in external code.
|
![]() | InternalImplementAttribute | ReferentialConstraint that, when applied on an interface, prevents it to be implemented
in a different assembly. This constraint should be used when the author of an interface
does not expect users to implement the interface and wants to reserve the possibility
to add new methods to the interface.
|
![]() | NamingConventionAttribute |
Custom attribute that, when applied to a target class or an interface, validates that classes and interfaces derived from this target class or interface
respect a giving naming convention, i.e. that their names matches a given pattern.
|
![]() | ParameterValueConstraint |
Base class to create architecture constraints that validate the value passed to a method parameter.
|
![]() | ProtectedAttribute |
Custom attribute that, when applied to a target declaration, causes PostSharp to emit a warning if the declaration
is being referenced from classes that are not derived from the target class. This constraint is similar to the
C# keyword protected and should be used only when the target declaration must be made public or internal
for non-architectural reasons.
|
![]() | ReferenceConstraint |
Base class for constraints validating code references.
|
![]() | ReferentialConstraint |
Implementation of IReferentialConstraint based on MulticastAttribute.
|
![]() | ScalarConstraint |
Implementation of IScalarConstraint based on MulticastAttribute.
|

Interface | Description | |
---|---|---|
![]() | IConstraint |
A constraint is a piece of validation logic executed at build time. Constraints
are applied to elements of code (Assembly, Type,
MethodInfo, ConstructorInfo, PropertyInfo,
EventInfo, FieldInfo, ParameterInfo),
typically (but not necessarily) using custom attributes or MulticastAttribute.
|
![]() | IReferentialConstraint |
A constraint is a piece validation logic executed at build time. Constraints
are applied to elements of code ((Assembly, Type,
MethodInfo, ConstructorInfo, PropertyInfo,
EventInfo, FieldInfo, ParameterInfo),
typically using custom attributes or MulticastAttribute, and verified
at build time for every assembly using this element of code.
|
![]() | IScalarConstraint |
A constraint that validates a specific element of code. Use an IReferentialConstraint
to validate relationships between elements of code.
|