CoreConcerns.Validation
1.0.0
See the version list below for details.
dotnet add package CoreConcerns.Validation --version 1.0.0
NuGet\Install-Package CoreConcerns.Validation -Version 1.0.0
<PackageReference Include="CoreConcerns.Validation" Version="1.0.0" />
paket add CoreConcerns.Validation --version 1.0.0
#r "nuget: CoreConcerns.Validation, 1.0.0"
// Install CoreConcerns.Validation as a Cake Addin
#addin nuget:?package=CoreConcerns.Validation&version=1.0.0
// Install CoreConcerns.Validation as a Cake Tool
#tool nuget:?package=CoreConcerns.Validation&version=1.0.0
Certainly! Below is a README template that you can use for both GitHub and NuGet.org for your CoreConcerns.Validation
library. It provides an overview, installation instructions, examples of usage, and contribution guidelines. Make sure to fill in or adjust any sections with <>
to include the actual content that is relevant to your project.
CoreConcerns.Validation
Overview
CoreConcerns.Validation
is a comprehensive validation library for .NET, built on top of FluentValidation, designed to simplify the addition of complex validation logic to your applications. It extends FluentValidation with custom validation rules, making it easy to validate phone numbers, email addresses, and other common data formats.
Features
- Validate phone numbers with country-specific formats.
- Enforce email addresses to conform to specific domains.
- Extend FluentValidation with more complex custom rules.
Installation
Install CoreConcerns.Validation
using NuGet:
dotnet add package CoreConcerns.Validation
Or via the NuGet package manager console:
Install-Package CoreConcerns.Validation
Usage
Here's how to implement custom validation for unique country phone numbers and emails with a specified domain:
public class MyValidator : AbstractValidator<MyModel>
{
public MyValidator()
{
RuleFor(x => x.PhoneNumber).NigerianPhoneNumber();
RuleFor(x => x.Email).ValidEmailAddress("example.com");
// Additional rules...
}
}
Examples
Validate a Nigerian Phone Number
public class UserValidator : AbstractValidator<User>
{
public UserValidator()
{
RuleFor(user => user.PhoneNumber).NigerianPhoneNumber();
}
}
Validate an Email Address with a Specific Domain
public class CustomerValidator : AbstractValidator<Customer>
{
public CustomerValidator()
{
RuleFor(customer => customer.Email).ValidEmailAddress("mydomain.com");
}
}
Contributing
Contributions to CoreConcerns.Validation
are welcome! If you have suggestions or improvements, please submit an issue or pull request on GitHub.
License
CoreConcerns.Validation
is licensed under the MIT License. See the LICENSE
file in the GitHub repository for more details.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. 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. |
-
net6.0
- FluentValidation.AspNetCore (>= 11.3.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.