Skip to content

ValidatorProviderAttribute

NexusLabs.Needlr.Generators

ValidatorProviderAttribute Class

Marks an assembly as providing a validator base type that the Needlr analyzer should recognize. When a type used with [Options(Validator = typeof(...))] inherits from the specified base type, the analyzer will not report NDLRGEN014 (validator missing interface).

public sealed class ValidatorProviderAttribute : System.Attribute

Inheritance System.Object 🡒 System.Attribute 🡒 ValidatorProviderAttribute

Remarks

This enables integration packages (like FluentValidation adapters) to teach the core analyzer about their validator types without the core needing direct knowledge of those packages.

Example usage in an extension package:

[assembly: ValidatorProvider("FluentValidation.AbstractValidator`1")]

Constructors

ValidatorProviderAttribute(string) Constructor

Initializes a new instance of the ValidatorProviderAttribute class.

public ValidatorProviderAttribute(string baseTypeName);

Parameters

baseTypeName System.String

The fully-qualified metadata name of the base validator type.

Properties

ValidatorProviderAttribute.BaseTypeName Property

The metadata name of the base validator type. Use backtick notation for generic types: "FluentValidation.AbstractValidator`1"

public string BaseTypeName { get; }

Property Value

System.String