Dosaic.Plugins.Validations.AttributeValidation
1.1.9
See the version list below for details.
dotnet add package Dosaic.Plugins.Validations.AttributeValidation --version 1.1.9
NuGet\Install-Package Dosaic.Plugins.Validations.AttributeValidation -Version 1.1.9
<PackageReference Include="Dosaic.Plugins.Validations.AttributeValidation" Version="1.1.9" />
<PackageVersion Include="Dosaic.Plugins.Validations.AttributeValidation" Version="1.1.9" />
<PackageReference Include="Dosaic.Plugins.Validations.AttributeValidation" />
paket add Dosaic.Plugins.Validations.AttributeValidation --version 1.1.9
#r "nuget: Dosaic.Plugins.Validations.AttributeValidation, 1.1.9"
#:package Dosaic.Plugins.Validations.AttributeValidation@1.1.9
#addin nuget:?package=Dosaic.Plugins.Validations.AttributeValidation&version=1.1.9
#tool nuget:?package=Dosaic.Plugins.Validations.AttributeValidation&version=1.1.9
Dosaic.Plugins.Validations.AttributeValidation
Dosaic.Plugins.Validations.AttributeValidation is a plugin that allows other Dosaic components to validate object using attributes.
Installation
To install the nuget package follow these steps:
dotnet add package Dosaic.Plugins.Validations.AttributeValidation
or add as package reference to your .csproj
<PackageReference Include="Dosaic.Plugins.Validations.AttributeValidation" Version="" />
Appsettings.yml
You do not need to configure anything, because the implementation resolver, does this automatically at startup.
Usage
The validator is auto-registered using the Plugin technology. You can use it by adding the Validations attribute to your model and inject the IValidator in your usage.
However, there are following Validations attibutes:
- Required
- Expression
- Array
- Length
- MinLength
- MaxLength
- Bool
- True
- False
- Date
- Before
- After
- Age
- MinAge
- MaxAge
- Int
- Range
- Min
- Max
- Positive
- Negative
- String
- Length
- MinLength
- MaxLength
- Url
- Regex
Example:
```csharp
internal class DbModel {
[Validations.Required]
public string Id {get;set;}
[Validations.String.MinLength(5), Validations.String.MaxLength(10), Validations.String.Regex(@"^[a-zA-Z]+$")]
public string LongName {get;set;}
[Validations.Expression("Value % 2 == 0")]
public int SomeNumber {get;set;}
}
// USAGE:
IServiceProvider sp;
var validator = sp.GetRequiredService<IValidator>();
var dbModel = new DbModel { Id = "1", LongName = "LongName", SomeNumber = 2 };
var result = await validator.ValidateAsync(dbModel);
Console.WriteLine(result.IsValid); // true
var failModel = new DbModel { Id = "", LongName = "..", SomeNumber = 3 };
var result = await validator.ValidateAsync(dbModel);
Console.WriteLine(result.IsValid); // false
Console.WriteLine(result.Errors); // List of errors
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net9.0
- Dosaic.Hosting.Abstractions (>= 1.1.9)
- Dosaic.Plugins.Validations.Abstractions (>= 1.1.9)
- DynamicExpresso.Core (>= 2.19.2)
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 |
|---|---|---|
| 1.2.6 | 89 | 2/19/2026 |
| 1.2.5 | 84 | 2/17/2026 |
| 1.2.4 | 107 | 2/13/2026 |
| 1.2.3 | 101 | 1/27/2026 |
| 1.2.2 | 292 | 12/16/2025 |
| 1.2.1 | 272 | 12/16/2025 |
| 1.2.0 | 430 | 12/11/2025 |
| 1.1.21 | 450 | 12/10/2025 |
| 1.1.20 | 417 | 11/18/2025 |
| 1.1.19 | 309 | 11/11/2025 |
| 1.1.18 | 205 | 10/14/2025 |
| 1.1.17 | 201 | 10/1/2025 |
| 1.1.16 | 210 | 9/25/2025 |
| 1.1.15 | 186 | 9/24/2025 |
| 1.1.14 | 188 | 9/24/2025 |
| 1.1.13 | 197 | 9/24/2025 |
| 1.1.12 | 333 | 9/16/2025 |
| 1.1.11 | 164 | 7/18/2025 |
| 1.1.10 | 167 | 7/18/2025 |
| 1.1.9 | 221 | 7/8/2025 |