Athenex.Whimclean.Application 2.0.0

Prefix Reserved
dotnet add package Athenex.Whimclean.Application --version 2.0.0
                    
NuGet\Install-Package Athenex.Whimclean.Application -Version 2.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Athenex.Whimclean.Application" Version="2.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Athenex.Whimclean.Application" Version="2.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Athenex.Whimclean.Application" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Athenex.Whimclean.Application --version 2.0.0
                    
#r "nuget: Athenex.Whimclean.Application, 2.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Athenex.Whimclean.Application@2.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Athenex.Whimclean.Application&version=2.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Athenex.Whimclean.Application&version=2.0.0
                    
Install as a Cake Tool

Athenex.Whimclean.Application

ภาษาไทย

Application-layer contracts and validated request models for .NET 10 clean-architecture applications.

Install

dotnet add package Athenex.Whimclean.Application

The package depends only on Athenex.Whimclean.Domain.

Current user

Application and infrastructure services can depend on ICurrentUser<TUserId> without referencing ASP.NET Core Identity:

using Athenex.Whimclean.Application.Context;

public sealed class CreateOrderHandler(ICurrentUser<Guid> currentUser)
{
    public void Handle()
    {
        // Throws CurrentUserRequiredException when no principal is available.
        var userId = currentUser.GetRequiredUserId();
    }
}

The interface exposes one member, TryGetUserId(out TUserId userId); GetRequiredUserId() is an extension method in CurrentUserExtensions. The API or host implements this interface from claims, a system-user identity, or another trusted execution context. StaticCurrentUser<TUserId> is a ready-made implementation that always answers with one fixed user id, for background jobs and tests.

Unit of work

Use IUnitOfWork at application write boundaries:

await unitOfWork.CommitAsync(cancellationToken);

The EF Core infrastructure package registers its business context as this contract. When the database reports a concurrency conflict, that package throws PersistenceConcurrencyException (in Athenex.Whimclean.Application.Persistence) so application code never depends on EF Core exception types.

Validated list queries

ListQueryOptions normalizes search text, materializes sort/filter collections, and enforces bounded paging:

using Athenex.Whimclean.Application.Queries;

var options = new ListQueryOptions(
    searchTerm: "pending",
    sort: [new SortTerm("createdAt", SortDirection.Descending)],
    filters: [new FilterTerm("status", "Pending")],
    page: 1,
    size: 20);

The limits are constants on ListQueryOptions: the page defaults to 1 and the size to 10, the size may not exceed 100, the search term is trimmed and capped at 200 characters, and a query carries at most 5 sort terms and 10 filters. Offset is precomputed from page and size.

Infrastructure should translate only application-approved field names and operators into database expressions. Do not dynamically execute arbitrary client field names.

FacetQueryOptions provides the equivalent bounded input for distinct-value or facet queries; its limit caps how many values a facet may return (100 by default, 1000 at most). FilterTerm also supports NotEqual, Contains, StartsWith, EndsWith, and multi-value In comparisons (up to 25 values); filter values are passed through verbatim so whitespace-significant data stays matchable.

Pagination results

Use OffsetPagedResult<T> for numbered pages and KeysetPagedResult<T, TKey> for cursor-based navigation.

Email boundary

Application code creates EmailMessage and depends on IEmailSender:

await emailSender.SendAsync(
    new EmailMessage(
        "member@example.com",
        "Welcome",
        "Your account is ready."),
    cancellationToken);

The full constructor accepts multiple recipients, CC/BCC lists, from/replyTo overrides, and EmailAttachment files:

var invoice = new EmailMessage(
    recipients: ["owner@example.com", "billing@example.com"],
    subject: "Invoice 2026-08",
    textBody: "Your invoice is attached.",
    bcc: ["audit@example.com"],
    replyTo: "support@example.com",
    attachments: [new EmailAttachment("invoice.pdf", pdfBytes, "application/pdf")]);

A message needs at least one recipient and either a textBody or an htmlBody; addresses and the subject are trimmed. EmailAttachment takes a file name, the content as ReadOnlyMemory<byte>, and a content type that defaults to application/octet-stream.

The consuming infrastructure project owns SMTP or provider-specific delivery.

This package does not depend on EF Core, ASP.NET Core Identity, a database provider, or multitenancy.

Query-string parsing lives in the API package

The field:operator:value filter syntax and the -field sort syntax belong to the HTTP edge, so ListQueryParser is in Athenex.Whimclean.Api.AspNetCore.Queries (moved there in 2.0). This package holds the parsed model only: ListQueryOptions, SortTerm, FilterTerm, FilterOperator, SortDirection and FacetQueryOptions.

EnumFilter (in Athenex.Whimclean.Application.Queries) parses filter values into enum members case-insensitively and rejects undefined values: TryParse<TEnum> handles one value and Parse<TEnum> keeps the valid members of a list. The API validator (AllowEnumFilterField<TEnum> in Athenex.Whimclean.Api.AspNetCore) and the persistence filter therefore agree on which names are valid.

WhereActive() in ActivatableQueryExtensions filters an IQueryable<T> or IEnumerable<T> of IActivatable entities down to the active ones.

The Map extension in OffsetPagedResultExtensions projects a page's items while keeping its page number, size and totals, for turning persistence projections into response models:

using Athenex.Whimclean.Application.Pagination;

OffsetPagedResult<OrderResponse> response = page.Map(order => new OrderResponse(order.Id));

Set the current user outside a request

ICurrentUserInitializer<TUserId> lets startup bootstrap and seeders name the user their writes are attributed to through SetUserId. The ASP.NET Core package implements it together with a request-scoped ICurrentUser<TUserId> (RequestCurrentUser<TUserId>, registered by AddLocalUserResolution<TUserId>).

Repository and full architecture guide: https://github.com/athene-x/Whimclean

Product Compatible and additional computed target framework versions.
.NET 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (6)

Showing the top 5 NuGet packages that depend on Athenex.Whimclean.Application:

Package Downloads
Athenex.Whimclean.Infrastructure.EntityFrameworkCore

Provider-neutral EF Core infrastructure for Whimclean applications, including required current-user writes, shadow-property audit stamps and soft deletion (HasAuditStamps, HasSoftDelete), concurrency handling, unit-of-work registration, list query helpers, and domain-event dispatch.

Athenex.Whimclean.Api.AspNetCore

Primary ASP.NET Core Minimal API package for Whimclean applications: Minimal API registration with OpenAPI, FluentValidation request validation and the list query contract, consistent exception, status-code, validation, and result error responses, plus claims-based current-user resolution for any authentication scheme. The FastEndpoints package adapts these conventions to FastEndpoints.

Athenex.Whimclean.Auditing

Audit log for Whimclean applications: an audit entry entity, a Mediator pipeline behavior that records every audited command's outcome outside its unit of work, and a change collector fed by domain events.

Athenex.Whimclean.Mediator

Optional Mediator (martinothamar/Mediator) integration: a command unit-of-work pipeline behavior and domain-event delivery as mediator notifications.

Athenex.Whimclean.Infrastructure.Email.Smtp

SMTP implementation of the Whimclean IEmailSender contract over System.Net.Mail, with validated options for host, port, credentials, TLS and sender.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.0 233 11/17/2026

2.0.0: ListQueryParser moves to Athenex.Whimclean.Api.AspNetCore.Queries, where the query string is received; ListQueryOptions, FilterTerm, SortTerm and EnumFilter stay here. See https://github.com/athene-x/Whimclean/blob/main/docs/upgrading-to-2.0.md.