O2YO.FluentValidation Developed by: Shafi Hussain Description: The O2YO.FluentValidation package provides a powerful and flexible way to perform fluent validation on objects in C#. With this package, you can easily define validation rules for your models using fluent syntax, making your validation logic clean, concise, and easy to understand. Features and Functionalities: Async Support: All validation methods support asynchronous operations, allowing you to validate your models asynchronously for improved performance and responsiveness. Validation Rules: 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 Compatibility: This package is compatible with .NET Standard and .NET Core, ensuring seamless integration into your existing projects. Contributions: Contributions to this package are welcome! If you encounter any issues or have suggestions for improvements, please feel free to contribute to the GitHub repository. License: This package is distributed under the MIT License, allowing for both personal and commercial use with minimal restrictions. With O2YO.FluentValidation, validating your C# models has never been easier. Ensure the integrity and consistency of your data with confidence. Get started with O2YO.FluentValidation today!
$ dotnet add package O2YO.FluentValidationO2YO.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.
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.
The following validation methods are available in O2YO.FluentValidation:
// 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.