In Metalama, use an aspect or a fabric, and register a reference validator using the ValidateReferences<TValidator>(Func<TDeclaration, TValidator>)
method. For instance, from the BuildAspect(IAspectBuilder<T>) method of an aspect, call
builder
.IAspectReceiverSelector<TTarget>.With<TMember>(System.Func<TTarget,System.Collections.Generic.IEnumerable<TMember>>)(...)
.ValidateReferences<TValidator>(Func<TDeclaration, TValidator>).
Inheritance
ReferenceConstraint
Namespace: PostSharp.Constraints
Assembly: Metalama.Migration.dll
Syntax
[AttributeUsage(AttributeTargets.Assembly|AttributeTargets.Module|AttributeTargets.Class|AttributeTargets.Struct|AttributeTargets.Enum|AttributeTargets.Constructor|AttributeTargets.Method|AttributeTargets.Property|AttributeTargets.Field|AttributeTargets.Event|AttributeTargets.Interface|AttributeTargets.Delegate, AllowMultiple = true)]
[MulticastAttributeUsage(MulticastTargets.AnyType|MulticastTargets.Field|MulticastTargets.Method|MulticastTargets.InstanceConstructor, TargetTypeAttributes = MulticastAttributes.Internal|MulticastAttributes.InternalOrProtected|MulticastAttributes.Public|MulticastAttributes.UserGenerated, TargetMemberAttributes = MulticastAttributes.Protected|MulticastAttributes.Internal|MulticastAttributes.InternalAndProtected|MulticastAttributes.InternalOrProtected|MulticastAttributes.Public)]
[Obsolete("In Metalama, use an aspect or a fabric, and register a reference validator using the 'IValidatorReceiver<TDeclaration>.ValidateReferences<TValidator>(Func<TDeclaration, TValidator>)' method. For instance, from the 'IAspect<T>.BuildAspect(IAspectBuilder<T>)' method of an aspect, call <c>builder</c>.'!:IAspectReceiverSelector<TTarget>.With<TMember>(System.Func<TTarget,System.Collections.Generic.IEnumerable<TMember>>)'<c>(...)</c>.'IValidatorReceiver<TDeclaration>.ValidateReferences<TValidator>(Func<TDeclaration, TValidator>)'.", false)]
public abstract class ReferenceConstraint : ReferentialConstraint, IReferentialConstraint, IConstraint
Constructors
Name | Description |
---|---|
ReferenceConstraint() |
Methods
Name | Description |
---|---|
ValidateCode(object, Assembly) | |
ValidateReference(ICodeReference) |