PostSharp 4.3 / / 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
  Class Description
Public class 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. The constraint cannot be applied to public or protected declarations.
Public class 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.
Public class ExperimentalAttribute
Custom attribute that, when applied on a declaration, causes PostSharp to emit a warning if the declaration is being used.
Public class InternalAttribute
ReferentialConstraint, when applied to a declaration, prevents it to be used from an different assembly. This constraint can be used when a declaration must be made public for technical reasons, but its author do not want it to be used in external code.
Public class 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.
Public class 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.
Public class ReferentialConstraint
Implementation of IReferentialConstraint based on MulticastAttribute.
Public class ScalarConstraint
Implementation of IScalarConstraint based on MulticastAttribute.
Interfaces
  Interface Description
Public interface 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.
Public interface 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.
Public interface IScalarConstraint
A constraint that validates a specific element of code. Use an IReferentialConstraint to validate relationships between elements of code.