O2YO.FluentValidation 0.0.2

dotnet add package O2YO.FluentValidation --version 0.0.2
NuGet\Install-Package O2YO.FluentValidation -Version 0.0.2
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="O2YO.FluentValidation" Version="0.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add O2YO.FluentValidation --version 0.0.2
#r "nuget: O2YO.FluentValidation, 0.0.2"
#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 O2YO.FluentValidation as a Cake Addin
#addin nuget:?package=O2YO.FluentValidation&version=0.0.2

// Install O2YO.FluentValidation as a Cake Tool
#tool nuget:?package=O2YO.FluentValidation&version=0.0.2

O2YO.FluentValidation

Overview

O2YO.FluentValidation is a powerful and flexible validation library for C# applications, allowing developers to define and execute validation rules in a fluent and intuitive manner. With support for asynchronous operations and a wide range of validation methods, O2YO.FluentValidation simplifies the task of validating data in .NET projects.

Features

  • Fluent Validation: Define validation rules using fluent syntax for cleaner and more readable code.
  • Asynchronous Support: All validation methods support asynchronous operations, ensuring improved performance and responsiveness in applications.
  • Comprehensive Validation Rules: Includes a wide range of validation methods for common scenarios, such as checking for null, emptiness, equality, length constraints, numeric comparisons, credit card numbers, mobile numbers, special characters, spaces, alphabetic characters, and email addresses.
  • Compatibility: Compatible with .NET Standard and .NET Core environments, ensuring seamless integration into existing projects.

Benefits

  • Simplicity: Simplifies the task of implementing validation logic with an intuitive API and fluent syntax.
  • Performance: Asynchronous support ensures efficient validation operations, especially in scenarios involving I/O-bound tasks.
  • Consistency: Enforces consistent validation practices across projects, ensuring data integrity and reliability.
  • Flexibility: Offers a wide range of validation methods to accommodate various validation requirements without the need for custom implementations.
  • Maintainability: Clean and readable codebase enhances maintainability and reduces the likelihood of errors.

Author

O2YO.FluentValidation is developed and maintained by Shafi Hussain, a seasoned software developer with over 20 years of experience in the industry. With a proven track record of delivering high-quality software solutions, Shafi brings a wealth of expertise to the development of O2YO.FluentValidation.

Available Methods

The following validation methods are available in O2YO.FluentValidation:

  • NotEmptyAsync: Validates that a property is not null or empty.
  • NotNullAsync: Validates that a property is not null.
  • NotEqualToAsync: Validates that a property is not equal to a specified value.
  • EqualToAsync: Validates that a property is equal to a specified value.
  • LengthInRangeAsync: Validates that the length of a string property or the count of a collection property falls within a specified range.
  • MaxLengthAsync: Validates that the length of a string property or the count of a collection property does not exceed a specified maximum.
  • MinLengthAsync: Validates that the length of a string property or the count of a collection property meets or exceeds a specified minimum.
  • LessThanAsync: Validates that a numeric property is less than a specified threshold.
  • LessThanOrEqualToAsync: Validates that a numeric property is less than or equal to a specified threshold.
  • GreaterThanAsync: Validates that a numeric property is greater than a specified threshold.
  • GreaterThanOrEqualToAsync: Validates that a numeric property is greater than or equal to a specified threshold.
  • CreditCardAsync: Validates that a string property represents a valid credit card number.
  • MobileNumberAsync: Validates that a string property represents a valid 10-digit mobile number.
  • SpecialCharacterAsync: Validates that a string property does not contain any special characters.
  • SpaceOnlyAsync: Validates that a string property contains only spaces.
  • NoSpaceAsync: Validates that a string property does not contain any spaces.
  • IsAlphabateAsync: Validates that a string property contains only alphabetic characters and spaces.
  • EmailAsync: Validates that a string property represents a valid email address.

Usage

// Example usage of validation rules
var validator = new O2YOValidate<UserModel>(user, new List<string>());
await validator.NotEmptyAsync(x => x.Name);
await validator.EmailAsync(x => x.Email);
// Add more validation rules as needed

```csharp
// Example usage of validation rules with chained methods
var validator = new O2YOValidation<UserModel>(user, new List<string>());
await validator.NotEmptyAsync(x => x.Name)
    .NotNullAsync(x => x.Email)
    .NotEqualToAsync(x => x.Role, UserRole.Admin)
    .EqualToAsync(x => x.Status, UserStatus.Active)
    .LengthInRangeAsync(x => x.Address, 5, 100)
    .MaxLengthAsync(x => x.Description, 500)
    .MinLengthAsync(x => x.Password, 8)
    .LessThanAsync(x => x.Price, 100.00)
    .LessThanOrEqualToAsync(x => x.Quantity, 10)
    .GreaterThanAsync(x => x.Score, 75)
    .GreaterThanOrEqualToAsync(x => x.Age, 18)
    .CreditCardAsync(x => x.CreditCardNumber)
    .MobileNumberAsync(x => x.PhoneNumber)
    .SpecialCharacterAsync(x => x.SpecialField)
    .SpaceOnlyAsync(x => x.SpaceField)
    .NoSpaceAsync(x => x.NoSpaceField)
    .IsAlphabateAsync(x => x.AlphabateField)
    .EmailAsync(x => x.EmailField);
// Add more validation rules as needed


### Contributions

Contributions to O2YO.FluentValidation are welcome! If you encounter any issues, have suggestions for improvements, or would like to contribute to the project, please feel free to open GitHub issues or submit pull requests.

### License

This project is licensed under the MIT License - see the LICENSE file for details.

Thank you for choosing O2YO.FluentValidation! We hope this library helps simplify and streamline your validation processes in C# projects. If you have any questions or feedback, please don't hesitate to reach out to us.
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.
  • net8.0

    • No dependencies.

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.0.2 152 2/24/2024
0.0.1 159 2/24/2024
0.0.0.2 121 2/24/2024

Release Notes - O2YO.FluentValidation
Version 0.0.2

Features:
Implemented fluent validation methods for common validation scenarios, including checking for null, emptiness, equality, length constraints, numeric comparisons, credit card numbers, mobile numbers, special characters, spaces, alphabetic characters, and email addresses.
Support for asynchronous validation operations for improved performance and responsiveness.
Compatibility with .NET Standard and .NET Core environments.

Contributions:
Contributions to this release include the development of the core validation logic, documentation, and testing.

Bug Fixes:
No bug fixes in this release as it is the initial version.

Known Issues:
No known issues at the time of release.

Future Plans:
Future releases may include additional validation rules, optimizations, and enhancements based on user feedback and community contributions.

Feedback:
We welcome feedback from users regarding any issues encountered, feature requests, or suggestions for improvement. Please feel free to open GitHub issues for any such feedback.