OrionGuard 6.7.0
dotnet add package OrionGuard --version 6.7.0
NuGet\Install-Package OrionGuard -Version 6.7.0
<PackageReference Include="OrionGuard" Version="6.7.0" />
<PackageVersion Include="OrionGuard" Version="6.7.0" />
<PackageReference Include="OrionGuard" />
paket add OrionGuard --version 6.7.0
#r "nuget: OrionGuard, 6.7.0"
#:package OrionGuard@6.7.0
#addin nuget:?package=OrionGuard&version=6.7.0
#tool nuget:?package=OrionGuard&version=6.7.0
OrionGuard
A modern, fluent, and extensible guard clause & validation library for .NET 8/9/10.
Features
- Fluent API —
Ensure.That(email).NotNull().Email() - Security Guards — SQL injection, XSS, path traversal, command injection, LDAP, XXE
- Format Guards — Coordinates, MAC, CIDR, JWT, country codes, time zones, Base64
- FastGuard — Span-based zero-allocation validation with ThrowHelper optimization
- Result Pattern — Collect all errors with
GuardResult.Combine() - Async Validation — Database lookups, API calls
- Object Validation — Property expressions, cross-property rules, compiled caching
- Business Guards — Money, SKU, coupon, scheduling, status transitions
- Attribute-Based —
[NotNull],[Email],[Range]on model properties - DI Support —
services.AddOrionGuard() - Localization — 9 languages, thread-safe per-request culture
Quick Start
using Moongazing.OrionGuard.Core;
using Moongazing.OrionGuard.Extensions;
Ensure.That(email).NotNull().NotEmpty().Email();
FastGuard.NotNullOrEmpty(name, nameof(name));
userInput.AgainstInjection(nameof(userInput));
"US".AgainstInvalidCountryCode(nameof(country));
Links
License
MIT
| Product | Versions 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. 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 is compatible. 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. |
-
net10.0
-
net8.0
-
net9.0
NuGet packages (17)
Showing the top 5 NuGet packages that depend on OrionGuard:
| Package | Downloads |
|---|---|
|
OrionGuard.EntityFrameworkCore
EF Core integration for OrionGuard. Provides a SaveChanges interceptor that dispatches domain events from AggregateRoot<TId> instances after commit (Inline mode) or via a transactional outbox (Outbox mode) consumed by a hosted background worker. Includes W3C trace context propagation across the outbox boundary. |
|
|
OrionGuard.AspNetCore
ASP.NET Core integration for OrionGuard validation library. Provides middleware, Minimal API endpoint filters, MVC action filters, and RFC 9457 ProblemDetails support. |
|
|
OrionGuard.Swagger
Swagger/OpenAPI integration for OrionGuard. Auto-generates OpenAPI constraints from OrionGuard validation attributes. |
|
|
OrionGuard.Blazor
Blazor integration for OrionGuard validation library. Provides EditForm validation, custom validation components, and data annotations interop. |
|
|
OrionGuard.OpenTelemetry
OpenTelemetry integration for OrionGuard validation library. Provides validation metrics (success/failure rates, latency) and distributed tracing spans. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 6.7.0 | 449 | 7/20/2026 |
| 6.6.2 | 1,282 | 6/20/2026 |
| 6.6.1 | 1,221 | 6/20/2026 |
| 6.6.0 | 1,222 | 6/19/2026 |
| 6.5.30 | 1,711 | 6/17/2026 |
| 6.5.29 | 1,970 | 6/15/2026 |
| 6.5.28 | 1,972 | 6/15/2026 |
| 6.5.27 | 1,969 | 6/15/2026 |
| 6.5.26 | 1,971 | 6/13/2026 |
| 6.5.25 | 1,969 | 6/13/2026 |
| 6.5.24 | 1,963 | 6/12/2026 |
| 6.5.23 | 1,981 | 6/12/2026 |
| 6.5.22 | 1,965 | 6/11/2026 |
| 6.5.21 | 1,973 | 6/11/2026 |
| 6.5.20 | 1,961 | 6/11/2026 |
| 6.5.19 | 1,965 | 6/11/2026 |
| 6.5.18 | 1,964 | 6/11/2026 |
| 6.5.16 | 1,960 | 6/11/2026 |
| 6.5.15 | 1,966 | 6/11/2026 |
| 6.5.14 | 1,955 | 6/11/2026 |
v6.5.5 - Outbox operator mutation surface
NEW: POST /_orion/outbox/{id}/replay clears RetryCount + Error + ProcessedOnUtc so the next dispatcher pass re-attempts the row; returns 404 if the id is unknown.
NEW: POST /_orion/outbox/{id}/discard stamps ProcessedOnUtc=UtcNow without re-dispatch; Error and RetryCount stay intact so later operators see the history. Idempotent for already-processed rows (returns 200 with note).
NEW: OutboxDashboardOptions.OnMutation Func<OutboxMutationEvent, Task> audit hook fires after a successful replay/discard; consumers stamp User.Identity.Name and store wherever they want. Hook does NOT roll back the commit.
NEW: OutboxDashboardOptions.EnableMutations (default true) - set false for read-only mounts; the POST endpoints are simply not registered.
Full changelog: https://github.com/tunahanaliozturk/OrionGuard/blob/master/CHANGELOG.md
---
v6.5.4 - Outbox operator read surface
NEW: Moongazing.OrionGuard.Outbox.Dashboard add-on package. MapOutboxDashboard<TDbContext>() registers a route group; GET /_orion/outbox/failed?page=N&size=M returns paginated failed-message metadata (RetryCount >= threshold AND Error != null - covers both still-failing and dispatcher-dead-lettered rows). Payload deliberately excluded from the projection; error text truncated to ErrorTruncationLength.
CHANGED: Default authorization wiring on the dashboard group falls through to the host's AuthorizationOptions.FallbackPolicy when no AuthorizationPolicyName is supplied, instead of calling RequireAuthorization() unconditionally (which would shadow a stricter fallback policy).
DEFERRED: Replay / discard mutation actions on the dashboard group -> v6.5.5.
Full changelog: https://github.com/tunahanaliozturk/OrionGuard/blob/master/CHANGELOG.md
---
v6.5.1 - Push-Dispatch Contract
NEW: IOutboxWakeSignal abstraction in Moongazing.OrionGuard.EntityFrameworkCore.Outbox.Push. Lets consumers swap the dispatcher's between-batch wait from polling to push without touching the rest of the dispatch loop. Two methods: WaitForNextTickAsync(pollingInterval, ct) and SignalAsync(ct).
NEW: NullOutboxWakeSignal default - polling-only, byte-for-byte v6.5.0 behaviour. ChannelOutboxWakeSignal in-process Channel-backed implementation for single-process deployments and unit tests; repeated SignalAsync calls coalesce into one wake.
CHANGED: DomainEventSaveChangesInterceptor fires SignalAsync on the registered IOutboxWakeSignal after every SaveChanges that runs in Outbox mode, so an opted-in consumer sees mid-poll wakes automatically. Polling interval still upper-bounds wake latency.
CHANGED: OutboxDispatcherHostedService gains an optional 8th IOutboxWakeSignal parameter; positional callers using the previous 6-argument constructor with logger last continue to compile.
DEFERRED: Moongazing.OrionGuard.Outbox.PostgresNotify add-on (Postgres LISTEN/NOTIFY) -> v6.5.2. Moongazing.OrionGuard.Outbox.SqlServerBroker (SQL Server Service Broker) -> v6.5.3. Outbox dead-letter UI -> v6.5.4.
MIGRATION: Source-compatible. No DI changes are required to stay on polling. Opt in to in-process push by registering ChannelOutboxWakeSignal as IOutboxWakeSignal before AddOrionGuardEfCore.
v6.5.0 - Family Integration
NEW PACKAGE: Moongazing.OrionGuard.Locks.Redis - bridges OrionGuard's IDistributedLock primitive to the standalone OrionLock.Redis backend.
Full changelog: https://github.com/tunahanaliozturk/OrionGuard/blob/master/CHANGELOG.md
PRIOR RELEASES (kept for NuGet history readers)
v6.3.0 - Release Notes
NEW: Domain event dispatcher — IDomainEventDispatcher and IDomainEventHandler<TEvent> abstractions. Default ServiceProviderDomainEventDispatcher resolves handlers from IServiceProvider; supports SequentialFailFast (default), SequentialContinueOnError, and Parallel dispatch modes. DI: services.AddOrionGuardDomainEvents() + services.AddOrionGuardDomainEventHandlers(assembly).
NEW: MediatR bridge (OrionGuard.MediatR) — MediatRDomainEventDispatcher delegates to MediatR's IPublisher. Consumer events opt in by adding ': INotification' to their record declaration; the bridge throws InvalidOperationException for events that don't. No wrapper types — handlers stay as natural INotificationHandler<TEvent>. DI: services.AddOrionGuardMediatRDomainEvents() swaps the registered dispatcher.
NEW PACKAGE: OrionGuard.EntityFrameworkCore — DomainEventSaveChangesInterceptor pulls events from tracked IAggregateRoot instances at SavingChangesAsync. Two modes: Inline (default — dispatches post-commit) and Outbox (persists to OutboxMessage rows in the same transaction, dispatched by a hosted background worker). OutboxOptions configures PollingInterval / BatchSize / MaxRetries / TableName. Worker increments RetryCount on failure and dead-letters after MaxRetries. W3C trace context (TraceParent / TraceState) propagates across the outbox boundary so end-to-end traces span the worker. DI: services.AddOrionGuardEfCore<TDbContext>(o => o.UseInline() | o.UseOutbox()).
NEW PACKAGE: OrionGuard.Testing — DomainEventCapture and DomainEventAssertions for fluent unit-test assertions over aggregate-raised events. InMemoryDomainEventDispatcher for integration tests. Framework-agnostic — no xUnit / NUnit / FluentAssertions dependency. Throws DomainEventAssertionException, which any test runner treats as a failure.
NEW: OrionGuard.OpenTelemetry domain-event instrumentation — OrionGuardDomainEventTelemetry exposes ActivitySource and Meter under 'Moongazing.OrionGuard.DomainEvents', with counters orionguard.domain_events.dispatched / failed / outbox.processed / outbox.retries plus the orionguard.domain_events.duration histogram. InstrumentedDomainEventDispatcher decorator opens a span per dispatch and sets ActivityStatusCode.Error on exception. DI: services.WithOpenTelemetryDomainEvents() (call after AddOrionGuardDomainEvents()).
MIGRATION: No breaking changes from v6.2.0. Existing aggregates raise events the same way; nothing dispatches until AddOrionGuardDomainEvents() is wired. MediatR consumers add ', INotification' to their event records (one-line per event). Outbox consumers add an EF Core migration for the OrionGuard_Outbox table.
ROADMAP: v6.4.0 = BusinessRule base class + Guard.Against.BrokenRule + ASP.NET Core ProblemDetails mapping; distributed locking for multi-instance outbox workers; OutboxTypeMapRegistry (alias system for safe type renames); archival job. v6.5+ = push-based outbox dispatch (LISTEN/NOTIFY, SqlDependency); event sourcing primitives.
Full changelog: https://github.com/tunahanaliozturk/OrionGuard/blob/master/CHANGELOG.md
v6.2.0 — Release Notes
NEW: IStronglyTypedId<TValue> marker interface — implemented by both the StronglyTypedId<TValue> abstract record (manual style) AND source-generated readonly partial struct ids. The AgainstDefaultStronglyTypedId guard now accepts this interface as its receiver, so both id styles work with the same guard.
NEW: DomainEventBase abstract record — consumers can write `public sealed record OrderPlaced(OrderId Id) : DomainEventBase;` instead of hand-rolling EventId and OccurredOnUtc. Both properties use init accessors so tests can pin them via `with` expressions.
NEW: Generated strongly-typed ids implement IParsable<TSelf> and ISpanParsable<TSelf> — ASP.NET Core minimal APIs bind them from route/query/form parameters without a custom TypeConverter hop. Standard .NET FormatException semantics on Parse failure.
IMPROVED: The StronglyTypedId source generator now detects whether the consumer project references EF Core and skips emitting the ValueConverter companion when it does not — console apps, Blazor WASM, and class libraries no longer need a spurious EF Core PackageReference just to build.
PACKAGE RENAME: Sub-package NuGet PackageIds drop the 'Moongazing.' brand prefix — install as OrionGuard.AspNetCore, OrionGuard.Blazor, OrionGuard.Generators, OrionGuard.Grpc, OrionGuard.MediatR, OrionGuard.OpenTelemetry, OrionGuard.SignalR, OrionGuard.Swagger. The old Moongazing.OrionGuard.* package IDs remain on NuGet.org for v6.1.0 and earlier; v6.2.0 ships under the new names. C# namespaces are unchanged (using Moongazing.OrionGuard.AspNetCore; still works) so source code does not break.
MIGRATION: Source-compatible with v6.1.0 — no user code change required. Receiver and return type of AgainstDefaultStronglyTypedId widened to IStronglyTypedId<TValue> (manual records still implement this interface). Recompile recommended. Consumers should update their package references from Moongazing.OrionGuard.* to OrionGuard.* (same assemblies, same namespaces, new package IDs).
ROADMAP: v6.3.0 = domain event dispatcher + MediatR bridge + EF Core SaveChanges interceptor. v6.4.0 = full BusinessRule base class + Guard.Against.BrokenRule + AspNetCore ProblemDetails mapping.
Full changelog: https://github.com/tunahanaliozturk/OrionGuard/blob/master/CHANGELOG.md
v6.1.0 — Release Notes
NEW: DDD Domain Primitives — ValueObject (hybrid: abstract base + IValueObject marker for records), Entity<TId> with identity equality and CheckRule / CheckRuleAsync helpers, AggregateRoot<TId> with IAggregateRoot marker and PullDomainEvents() dispatching buffer.
NEW: StronglyTypedId<TValue> — abstract record base for manual ids, plus [StronglyTypedId<TValue>] incremental source generator (Moongazing.OrionGuard.Generators) that emits the partial struct body, EF Core ValueConverter, System.Text.Json JsonConverter, and TypeConverter for Guid, int, long, string, and Ulid (net9.0+).
NEW: AgainstDefaultStronglyTypedId — extension method that throws when a strongly-typed id is null or wraps the default of its underlying type.
NEW: services.AddOrionGuardStronglyTypedIds() — scans assemblies for generated EF Core converters and registers them.
NEW: IDomainEvent, IBusinessRule, IAsyncBusinessRule, BusinessRuleValidationException, DomainInvariantException — abstractions landing in v6.1.0 so primitives are immediately usable; full base classes and dispatcher arrive in v6.2.0 and v6.3.0.
NEW: Localization — DefaultStronglyTypedId, BusinessRuleBroken, DomainInvariantViolated keys added for all 14 bundled languages.
Full changelog: https://github.com/tunahanaliozturk/OrionGuard/blob/master/CHANGELOG.md
v6.0.0 — Release Notes
NEW: GeneratedRegex Migration — All 20+ regex patterns migrated to .NET 8+ [GeneratedRegex] source-generated code. Zero runtime compilation, NativeAOT compatible.
NEW: 14-Language Localization — Added Chinese (zh), Korean (ko), Russian (ru), Dutch (nl), Polish (pl). Completed all 30 message keys for German, French, Spanish, Portuguese, Arabic, Japanese.
NEW: Rate Limit Guards — AgainstRateLimitExceeded(), AgainstTooManyRequests(), AgainstSlidingWindowExceeded(), AgainstConcurrentLimitExceeded(), AgainstDailyQuotaExceeded().
NEW: IRequestValidator interface — Pipeline-ready validator interface for ASP.NET Core and MediatR integration.
NEW: GuardResult.SuggestedHttpStatusCode — HTTP status code hints for ProblemDetails responses.
NEW PACKAGE: Moongazing.OrionGuard.AspNetCore — Middleware, Minimal API endpoint filters (.WithValidation), MVC filters, RFC 9457 ProblemDetails, IExceptionHandler.
NEW PACKAGE: Moongazing.OrionGuard.MediatR — ValidationBehavior pipeline behavior for automatic CQRS request validation.
NEW PACKAGE: Moongazing.OrionGuard.Generators — Compile-time source generator for reflection-free NativeAOT validation. Roslyn analyzers included.
NEW PACKAGE: Moongazing.OrionGuard.Swagger — Auto-generate OpenAPI constraints from OrionGuard validation attributes.
NEW PACKAGE: Moongazing.OrionGuard.OpenTelemetry — Validation metrics and distributed tracing spans.
DEPRECATED: RegexPatterns class — Use GeneratedRegexPatterns instead.
Full changelog: https://github.com/tunahanaliozturk/OrionGuard/blob/master/CHANGELOG.md
v5.0.1 — Previous Release Notes
NEW: Security Guards — SQL injection, XSS, path traversal, command injection, LDAP injection, XXE detection, unsafe filename, and open redirect validation. All patterns use FrozenSet for O(1) lookups.
NEW: Format Guards (replaces TurkishGuards) — Geographic coordinates, MAC address, hostname (RFC 1123), CIDR notation, ISO 3166-1 country codes, IANA time zones, BCP 47 language tags, JWT structure, connection strings, and Base64 validation.
NEW: ThrowHelper Pattern — All hot-path guards delegate throwing to a centralized ThrowHelper with [DoesNotReturn] and [StackTraceHidden] for smaller JIT-compiled method bodies and cleaner stack traces.
NEW: Span-Based FastGuard — Email, ASCII, AlphaNumeric, NumericString, MaxLength, ValidGuid, and Finite validators using ReadOnlySpan with zero allocations.
IMPROVED: Thread-Safe Localization — Rewritten with ConcurrentDictionary and AsyncLocal. Now supports 8 languages: EN, TR, DE, FR, ES, PT, AR, JA. Per-request culture scoping via SetCultureForCurrentScope.
IMPROVED: ObjectValidator — Compiled expression caching, CrossProperty validation, conditional When() blocks.
IMPROVED: FluentGuard — Transform() and Default() pipeline methods. All date comparisons use DateTime.UtcNow.
IMPROVED: All exceptions are sealed with ErrorCode and ParameterName properties.
IMPROVED: RegexCache with bounded size (1000), FrozenSet for BusinessGuards currency codes, ICollection.Count optimization in CollectionGuards.
FIXED: AgainstNotAllLowercase was comparing string to itself (always passed).
FIXED: AgainstEmptyCollection was throwing EmptyStringException instead of NullValueException.
FIXED: GuardBuilderExtensions was passing .Value instead of .ParameterName.
BREAKING: Validate.Object renamed to Validate.For. FastGuard.Guid renamed to FastGuard.ValidGuid. TurkishGuards removed.
Full changelog: https://github.com/tunahanaliozturk/OrionGuard/blob/master/CHANGELOG.md