OrionGuard 3.0.0
dotnet add package OrionGuard --version 3.0.0
NuGet\Install-Package OrionGuard -Version 3.0.0
<PackageReference Include="OrionGuard" Version="3.0.0" />
<PackageVersion Include="OrionGuard" Version="3.0.0" />
<PackageReference Include="OrionGuard" />
paket add OrionGuard --version 3.0.0
#r "nuget: OrionGuard, 3.0.0"
#:package OrionGuard@3.0.0
#addin nuget:?package=OrionGuard&version=3.0.0
#tool nuget:?package=OrionGuard&version=3.0.0
OrionGuard
OrionGuard is a lightweight and extensible library for guarding your application's parameters, ensuring input validation, and throwing meaningful exceptions. This library is ideal for developers who want to improve code quality and enforce input validation consistently.
Features
- 🛡️ Guard Clauses for common scenarios:
- Null and Empty String Validation
- Range Checks for Numeric Values
- Enum Value Validation
- Regex Pattern Matching
- Date Validation (Future/Past Dates)
- Email Address Validation
- 🚀 Easy to use and highly extensible.
- ✅ Fully unit-tested and ready for production.
Installation
OrionGuard is available as a NuGet package. You can install it using the .NET CLI or Package Manager in Visual Studio.
Using .NET CLI
dotnet add package OrionGuard
Using Package Manager
Install-Package OrionGuard
Getting Started
- Null Check
Guard.AgainstNull(testObject, nameof(testObject)); // Throws NullValueException if testObject is null.
- Range Check
Guard.AgainstOutOfRange(5, 1, 10, nameof(value)); // Throws OutOfRangeException if value is outside the range.
- Regex Validation
"abc123".AgainstRegexMismatch(@"^\d+$", nameof(value)); // Throws RegexMismatchException if value does not match the pattern.
- Email Validation
"example.com".AgainstInvalidEmail(nameof(email)); // Throws InvalidEmailException if the email is invalid.
Extensibility
You can define custom guard clauses by implementing the IGuardClause interface:
public class MyCustomGuard : IGuardClause { public void Validate() { // Custom validation logic } }
Contributing
We welcome contributions! To contribute:
Fork the repository on GitHub.
Create a new branch for your feature or bug fix.
Submit a pull request.
License
OrionGuard is licensed under the MIT License. You are free to use, modify, and distribute this library under the terms of the license.
Support
If you encounter any issues or have questions, please visit the GitHub Issues page or contact us at tunahan.ali.ozturk@outlook.com.
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
- 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.