DynamicVNET 1.4.0-beta

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 Fluent API in runtime, wrapped over DataAnnotation attributes and supports a cross-platform environment.

This is a prerelease version of DynamicVNET.
Install-Package DynamicVNET -Version 1.4.0-beta
dotnet add package DynamicVNET --version 1.4.0-beta
<PackageReference Include="DynamicVNET" Version="1.4.0-beta" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DynamicVNET --version 1.4.0-beta
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: DynamicVNET, 1.4.0-beta"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// 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
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

DynamicVNET - Overview

NuGet

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.

DynamicVNET - Overview

NuGet

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.

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 History

Version Downloads Last updated
1.4.0-beta 173 12/31/2020
1.3.1-alpha 203 7/30/2020
1.2.6 440 12/24/2018
1.2.5 367 12/20/2018
1.2.3 376 10/28/2018
1.2.2 406 9/23/2018
1.2.1 412 9/10/2018
1.2.0 417 9/7/2018
1.2.0-alpha 399 8/29/2018
1.1.1 410 8/23/2018
1.1.0 426 8/13/2018
1.0.3 445 8/7/2018