DynamicVNET 1.4.0-beta
See the version list below for details.
dotnet add package DynamicVNET --version 1.4.0-beta
NuGet\Install-Package DynamicVNET -Version 1.4.0-beta
<PackageReference Include="DynamicVNET" Version="1.4.0-beta" />
paket add DynamicVNET --version 1.4.0-beta
#r "nuget: DynamicVNET, 1.4.0-beta"
// Install DynamicVNET as a Cake Addin #addin nuget:?package=DynamicVNET&version=1.4.0-beta&prerelease // Install DynamicVNET as a Cake Tool #tool nuget:?package=DynamicVNET&version=1.4.0-beta&prerelease
DynamicVNET - Overview
DynamicVNET is .NET Standard library that was created help to develop reuse dynamic validation. It helps to build some rules on POCO and own blackbox libs. It has rich conveniences and features as a <strong>Fluent API</strong> in runtime, wrapped over <strong>DataAnnotation</strong> attributes and supports a cross-platform environment.
Support
- Branching & Nested Branching [synonim logical tree].
- Nested Members.
- Value Types & Single Primitive.
- Reference Types (class).
- Automatic ignoring of repeated validation.
- Strongly Self Validator via Inheritance.
Where is using ?
- POCO Validation.
- Dynamic validation for private libraries (third party libraries 'dll').
Validation methods
- Predicate (Custom)
- StringLen
- EmailAddress
- PhoneNumber
- Url (for GET)
- Required
- MaxLen
- RegularExp
- Range
- Null (Only reference type)
- NotNull (Only reference type)
Example
POCO Models.
public class Employee
{
public string Name { get; set; }
public Token TokenNumber { get; set; }
public string Email { get; set; }
}
public class Token
{
public string Number { get; set; }
}
Validation.
Employee emp = new Employee()
{
Name = "Jhon",
TokenNumber = new Token() { Number = "2312412312341" },
Email = "jhon.sim@gmail.com"
};
var validator = ValidatorFacade.Create<Employee>(builder => {
builder.Marker
.StringLen(x => x.Name, 4)
.EmailAddress(x => x.Email)
.Predicate(x => x.Email.Contains("@simple.com"))
.Required(x => x.TokenNumber.Number) // nested member
.Required(x => x.TokenNumber.Number); // automatic ignored
});
bool result = validator.IsValid(emp);
Detailed Result.
IEnumerable<ValidationMarkerResult> results = validator.Validate(emp);
Branch Example
var validator = ValidatorFacade.Create<Model>(builder => {
builder.Marker
.Required(x => x.Token.TokenNumber)
.Branch(x => x.Name.Contains("resul"), x =>
{
x.Required(y => y.Email)
.StringLen(y => y.Email, 2)
.Branch(n => n.Name.Length >= 4,n => {
n.MaxLen(s => s.Token.TokenNumber, length: 4);
});
}).Branch(x => x.Email.Contains("aa"), x =>
{
x.Required(y => y.Name)
.StringLen(y => y.Name, 5)
.StringLen(y => y.Token.TokenNumber, 9);
});
});
Example Strongly Self Validator
public class EmployeeValidator : BaseValidator<Employee>
{
public EmployeeValidator()
{
Setup(builder =>
{
builder.Marker
.For(x => x.Name)
.Required();
builder.Marker
.Branch(x => x.Name.Contains("jhon"), x =>
{
x.MaxLen(m => m.TokenNumber.Number, 15);
})
.For(x => x.Email)
.Required()
.EmailAddress();
builder.Marker
.Required(x => x.TokenNumber.Number);
});
}
}
Employee emp = new Employee()
{
Name = "selman:okkes",
TokenNumber = new Token() { Number = "adasd123123asd" },
Email = "jhon.sim@jhona.com"
};
var empValidator = new EmployeeValidator();
bool result = empValidator.IsValid(emp);
Where can I get it?
Install DynamicVNET from the package manager console:
PM> Install-Package DynamicVNET -Version 1.4.0-beta
License & Copyright
DynamicVNET is Copyright © 2018-2021 Rasul Huseynov and lincensed under the MIT license.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- System.ComponentModel.Annotations (>= 4.5.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on DynamicVNET:
Package | Downloads |
---|---|
DynamicVNET.Lib.AspNetCore
DynamicVNET.Lib extension for asp.net core. Extensible AOP (interceptor filter). Also allows to reuse marker validation. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.4.1 | 78 | 10/31/2024 |
1.4.0 | 77 | 10/31/2024 |
1.4.0-beta | 326 | 12/31/2020 |
1.3.1-alpha | 332 | 7/30/2020 |
1.2.6 | 842 | 12/24/2018 |
1.2.5 | 662 | 12/20/2018 |
1.2.3 | 673 | 10/28/2018 |
1.2.2 | 742 | 9/23/2018 |
1.2.1 | 766 | 9/10/2018 |
1.2.0 | 793 | 9/7/2018 |
1.2.0-alpha | 626 | 8/29/2018 |
1.1.1 | 745 | 8/23/2018 |
1.1.0 | 761 | 8/13/2018 |
1.0.3 | 775 | 8/7/2018 |