Post­Sharp Documentation / API Reference / Post­Sharp.​Constraints Namespace

PostSharp.Constraints Namespace

The PostSharp.Constraints namespace allows you to validate your code against predefined or custom design rules.
Classes
  ClassDescription
Public classComponentInternalAttribute
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.
Public classConstraint
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.
Public classExperimentalAttribute
Custom attribute that, when applied on a declaration, causes PostSharp to emit a warning if the declaration is being used.
Public classInternalAttribute
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.
Public classInternalImplementAttribute
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.
Public classNamingConventionAttribute
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.
Public classParameterValueConstraint
Base class to create architecture constraints that validate the value passed to a method parameter.
Public classProtectedAttribute
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.
Public classReferenceConstraint
Base class for constraints validating code references.
Public classReferentialConstraint
Implementation of IReferentialConstraint based on MulticastAttribute.
Public classScalarConstraint
Implementation of IScalarConstraint based on MulticastAttribute.
Interfaces
  InterfaceDescription
Public interfaceIConstraint
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.
Public interfaceIReferentialConstraint
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.
Public interfaceIScalarConstraint
A constraint that validates a specific element of code. Use an IReferentialConstraint to validate relationships between elements of code.