#### [Abblix\.Oidc\.Server\.Mvc](https://www.abblix.com/en/docs/api/abblix-oidc-server-mvc 'index')
### [Abblix\.Oidc\.Server\.Mvc](https://www.abblix.com/en/docs/api/abblix-oidc-server-mvc/Abblix.Oidc.Server.Mvc 'Abblix\.Oidc\.Server\.Mvc')

## ParameterValidator Class

Provides functionality for validating parameters, emulating the behavior of ASP\.NET MVC's
[System\.ComponentModel\.DataAnnotations\.RequiredAttribute](https://learn.microsoft.com/en-us/dotnet/api/system.componentmodel.dataannotations.requiredattribute 'System\.ComponentModel\.DataAnnotations\.RequiredAttribute')\. This class implements the [IParameterValidator](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Common.Interfaces.IParameterValidator 'Abblix\.Oidc\.Server\.Common\.Interfaces\.IParameterValidator') interface to offer
standard parameter validation routines, enabling its use in core application code where model binding and MVC
validation attributes are not directly applicable\.

```csharp
public class ParameterValidator : Abblix.Oidc.Server.Common.Interfaces.IParameterValidator
```

Inheritance [System\.Object](https://learn.microsoft.com/en-us/dotnet/api/system.object 'System\.Object') → ParameterValidator

Implements [IParameterValidator](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Common.Interfaces.IParameterValidator 'Abblix\.Oidc\.Server\.Common\.Interfaces\.IParameterValidator')

### Remarks
Use this class to enforce parameter requirements in service layers, domain models, or other parts of the application
where you want to ensure that inputs are not null without relying on MVC's model binding\. This is especially useful
in scenarios where data validation needs to occur outside of web controllers, ensuring consistency in validation
logic across different layers of an application\.
### Methods

## ParameterValidator\.Required\<T\>\(T, string\) Method {#Abblix.Oidc.Server.Mvc.ParameterValidator.Required_T_(T,string)}

Validates that a parameter is not null, emulating the enforcement of the [System\.ComponentModel\.DataAnnotations\.RequiredAttribute](https://learn.microsoft.com/en-us/dotnet/api/system.componentmodel.dataannotations.requiredattribute 'System\.ComponentModel\.DataAnnotations\.RequiredAttribute') in
ASP\.NET MVC\. This method provides a straightforward way to ensure parameters meet their required conditions,
throwing a descriptive exception if they are found to be null\.

```csharp
public void Required<T>(T? value, string name)
    where T : class;
```
#### Type parameters

###### `T` {#Abblix.Oidc.Server.Mvc.ParameterValidator.Required_T_(T,string).T}

The type of the parameter to validate\.
#### Parameters

###### `value` [T](https://www.abblix.com/en/docs/api/abblix-oidc-server-mvc/Abblix.Oidc.Server.Mvc.ParameterValidator#Abblix.Oidc.Server.Mvc.ParameterValidator.Required_T_(T,string).T 'Abblix\.Oidc\.Server\.Mvc\.ParameterValidator\.Required\<T\>\(T, string\)\.T') {#Abblix.Oidc.Server.Mvc.ParameterValidator.Required_T_(T,string).value}

The parameter value to validate\. The method checks if this value is null\.

###### `name` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String') {#Abblix.Oidc.Server.Mvc.ParameterValidator.Required_T_(T,string).name}

The name of the parameter, which is used in constructing the exception message if
            the parameter is found to be null\. This enhances the debuggability by specifying which parameter failed
            validation\.

Implements [Required&lt;T&gt;\(T, string\)](https://www.abblix.com/en/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Common.Interfaces.IParameterValidator#Abblix.Oidc.Server.Common.Interfaces.IParameterValidator.Required_T_(T,string) 'Abblix\.Oidc\.Server\.Common\.Interfaces\.IParameterValidator\.Required\`\`1\(\`\`0,System\.String\)')

#### Exceptions

[System\.ArgumentNullException](https://learn.microsoft.com/en-us/dotnet/api/system.argumentnullexception 'System\.ArgumentNullException')  
Thrown if the parameter value is null, indicating that a required
            parameter was not provided\.

### Remarks
This method simplifies the task of validating mandatory method parameters, ensuring that null values are
caught early in the execution flow\. By leveraging this method, developers can avoid repetitive null checks
and focus on the core logic of their methods\.
