Bikiran.Validation
1.0.9
dotnet add package Bikiran.Validation --version 1.0.9
NuGet\Install-Package Bikiran.Validation -Version 1.0.9
<PackageReference Include="Bikiran.Validation" Version="1.0.9" />
<PackageVersion Include="Bikiran.Validation" Version="1.0.9" />
<PackageReference Include="Bikiran.Validation" />
paket add Bikiran.Validation --version 1.0.9
#r "nuget: Bikiran.Validation, 1.0.9"
#:package Bikiran.Validation@1.0.9
#addin nuget:?package=Bikiran.Validation&version=1.0.9
#tool nuget:?package=Bikiran.Validation&version=1.0.9
Bikiran.Validation
A comprehensive validation library for .NET applications providing robust validation utilities for common data types and formats including emails, URLs, IP addresses, user credentials, files, phone numbers, server names, and more.
Features
- 15+ Validation Types (Email, Date, IP, URL, File formats, Phone, Server names, etc.)
- Extensible Validation Framework
- Customizable Error Messages
- Regex-Powered Validation
- Null Safety Handling
- Optional Field Support
- Batch Validation for collections
- Cross-Platform .NET Standard 2.0+ Support
Installation
dotnet add package Bikiran.Validation
Quick Start
using Bikiran.Validation;
// Validate an email
var emailResult = ValEmail.IsValidEmailFormat("user@example.com", "Email Address");
if (emailResult.Error)
{
Console.WriteLine(emailResult.Message); // Display error
}
// Validate a password
var passwordResult = ValUser.IsValidPasswordFormat("SecurePass123!", "Password");
if (!passwordResult.Error)
{
Console.WriteLine("Password is valid!");
}
// Validate a server name
var serverResult = ValServer.IsValidServerNameFormat("web-server-01", "Server Name");
if (!serverResult.Error)
{
Console.WriteLine("Server name is valid!");
}
Available Validators
| Validator Class | Description | Key Methods |
|---|---|---|
| ValEmail | Email validation | IsValidEmailFormat, IsValidEmailFormatAll |
| ValDate | Date formatting | IsValidDateFormat |
| ValUser | User credentials | IsCleanUserNameFormat, IsValidUserNameFormat, IsValidPasswordFormat |
| ValFile | File validation | IsValidImageFile, IsValidDocFormat, IsValidXlsxFormat |
| ValIP | IP Address validation | IsValidIpFormat, IsValidIpFormatAll |
| ValURL | URL validation | IsValidUrlFormat |
| ValString | String validation | IsValidString, IsValidLongString |
| ValNumber | Numeric validation | IsValidateInt, IsValidateNumber |
| ValBoolean | Boolean checks | IsEqual, IsTrue, IsFalse |
| ValOptions | Option validation | IsValidateOptions, IsValidateOptionsAll |
| ValPath | Path validation | IsValidPath |
| ValDomain | Domain validation | IsValidDomainFormat, IsValidDomainFormatAll |
| ValGit | Git URL validation | IsValidGitRepoSsh |
| ValPhone | Phone validation | IsValidPhoneNumberFormat |
| ValServer | Server validation | IsValidServerNameFormat |
Advanced Usage
Custom Error Messages
// Customize the field name in error messages
var result = ValEmail.IsValidEmailFormat(email, "Work Email Address");
// Error message will be: "Please enter valid Work Email Address"
Optional Fields
// Use isOptional parameter for optional fields
var phoneResult = ValPhone.IsValidPhoneNumberFormat(phoneNumber, "Phone Number", isOptional: true);
if (!phoneResult.Error || phoneResult.Message == "Optional")
{
// Field is either valid or empty (which is acceptable)
}
Customizable Length Constraints
// Customize min/max lengths
var usernameResult = ValUser.IsValidUserNameFormat(username, "Username", min: 3, max: 30);
var serverResult = ValServer.IsValidServerNameFormat(serverName, "Server", min: 3, max: 50, specialCharacter: "-_.");
Validation Rules Details
Password Requirements
- 8-32 characters
- 1 uppercase letter
- 1 lowercase letter
- 1 number
- 1 special character
Username Requirements
IsCleanUserNameFormat (Strict alphanumeric):
- 5-20 characters (customizable)
- Only alphanumeric characters (a-z, A-Z, 0-9)
- Must start with a letter or digit
- Must end with a letter or digit
IsValidUserNameFormat (Allows special characters):
- 5-20 characters (customizable)
- Alphanumeric with .-@ allowed
- Must start with a letter or digit
- Must end with a letter or digit
Server Name Requirements
IsValidServerNameFormat:
- 5-32 characters (customizable)
- Alphanumeric (a-z, A-Z, 0-9) with customizable special characters (default: -_)
- Must start with a letter or digit
- Must end with a letter or digit
- Special characters allowed only in the middle
File Validation
- Images: JPEG, PNG, SVG (max 1MB)
- Documents: PDF, DOC, DOCX (max 1MB)
- Media Files: MP4, AVI, MP3, WAV (max 100MB)
Contribution
- Fork the repository
- Create feature branch (
git checkout -b feature/AmazingFeature) - Commit changes (
git commit -m 'Add AmazingFeature') - Push to branch (
git push origin feature/AmazingFeature) - Open Pull Request
License
Distributed under the MIT License. See LICENSE for more information.
Support
Found a bug? Please open an issue.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net9.0
- Microsoft.AspNetCore.Http (>= 2.3.0)
- Newtonsoft.Json (>= 13.0.3)
- NuGet.Protocol (>= 6.13.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version 1.0.9: Added server name validation (IsValidServerNameFormat) with customizable special characters support.