Open sandboxFocus

Class LocationValidationAdvice

Custom attribute that, when applied on a method of an aspect class, specifies that this method has the same semantics as the ValidateValue(T, string, LocationKind, LocationValidationContext) method of the ILocationValidationAspect<T> interface.

Inheritance
LocationValidationAdvice
Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp.dll
Syntax
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true, Inherited = true)]
public class LocationValidationAdvice : GroupingAdvice
Remarks

The method to which this custom attribute is applied must be public and must have the same signature as ValidateValue(T, string, LocationKind, LocationValidationContext), where T can be any type. However, the method can be static.

To validate locations of different types, group several validation methods, each with a different value type, by setting Master. For each field, property or parameter, PostSharp selects the method whose value type is the closest match for the type of the location. When several methods match equally well, Priority decides; if it does not, or if no method matches, PostSharp emits a build error.

Constructors

Name Description
LocationValidationAdvice()

Properties

Name Description
Priority

Gets or sets the priority for selecting a validation method from a group when more than one method matches the target element type. A method with a lower value has priority over a method with a higher value.

See Also