Immediate.Validations 0.2.0

There is a newer version of this package available.
See the version list below for details.
The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package Immediate.Validations --version 0.2.0
NuGet\Install-Package Immediate.Validations -Version 0.2.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Immediate.Validations" Version="0.2.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Immediate.Validations --version 0.2.0
#r "nuget: Immediate.Validations, 0.2.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Immediate.Validations as a Cake Addin
#addin nuget:?package=Immediate.Validations&version=0.2.0

// Install Immediate.Validations as a Cake Tool
#tool nuget:?package=Immediate.Validations&version=0.2.0

Immediate.Validations

NuGet GitHub release GitHub license GitHub issues GitHub issues-closed GitHub Actions

Immediate.Validations is a source generator validating Immediate.Handlers handler parameters.

Installing Immediate.Validations

You can install Immediate.Validations with NuGet:

Install-Package Immediate.Validations

Or via the .NET Core command line interface:

dotnet add package Immediate.Validations

Either command, from Package Manager Console or .NET Core CLI, will download and install Immediate.Validations.

Using Immediate.Validations

Add Immediate.Validations to the Immediate.Handlers behaviors pipeline by including it in the list of default Behaviors for the assembly:

using Immediate.Validations.Shared;

[assembly: Behaviors(
	typeof(ValidationBehavior<,>)
)]

Creating Validation Classes

Indicate that a class should be validated by adding the [Validate] attribute and IValidationTarget<> interface:

[Validate]
public record Query : IValidationTarget<Query>;

When Nullable Reference Types is enabled, any non-nullable reference types are automatically checked for null. Other validations are available like so:

[Validate]
public record Query : IValidationTarget<Query>
{
	[GreaterThan(0)]
	public required int Id { get; init; }
}

Results

The result of doing the above is that when a parameter fails one or more validations, a ValidationException is thrown, which can be handled via ProblemDetails or any other infrastructure mechanism.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.12.0 44 6/1/2024
0.11.0 41 5/30/2024
0.10.0 49 5/30/2024