Phymnary.SugarPot.AspNetCore.Application
1.2.2
dotnet add package Phymnary.SugarPot.AspNetCore.Application --version 1.2.2
NuGet\Install-Package Phymnary.SugarPot.AspNetCore.Application -Version 1.2.2
<PackageReference Include="Phymnary.SugarPot.AspNetCore.Application" Version="1.2.2" />
<PackageVersion Include="Phymnary.SugarPot.AspNetCore.Application" Version="1.2.2" />
<PackageReference Include="Phymnary.SugarPot.AspNetCore.Application" />
paket add Phymnary.SugarPot.AspNetCore.Application --version 1.2.2
#r "nuget: Phymnary.SugarPot.AspNetCore.Application, 1.2.2"
#:package Phymnary.SugarPot.AspNetCore.Application@1.2.2
#addin nuget:?package=Phymnary.SugarPot.AspNetCore.Application&version=1.2.2
#tool nuget:?package=Phymnary.SugarPot.AspNetCore.Application&version=1.2.2
Phymnary.SugarPot.AspNetCore.Application
Application-layer runtime helpers and HTTP-aware exception types for SugarPot ASP.NET Core solutions.
This package adds a small runtime service registration (IRunAt) and a set of application exception types that expose HTTP status semantics through IBusinessException.
Package scope
Root namespace:
Phymnary.SugarPot.AspNetCore
Primary areas:
- DI extension for application services
- Scoped runtime timestamp provider
- Application exception types for common HTTP outcomes
Public API
Service registration
ServiceCollectionExtensions.AddApplicationServices(IServiceCollection)- Registers
IRunAtas scoped.
- Registers
Runtime service
IRunAt(from Domain package)DateTimeOffset Value { get; }- Implementation (
RunAt) is internal and returnsDateTimeOffset.UtcNowat resolution time.
Because IRunAt is scoped, the same Value is reused within the same DI scope.
Exception types
All exception types below:
- Derive from
Exception - Implement
IBusinessException(through an internalIApplicationExceptionmarker) - Expose
HttpStatusCode StatusCode - Support optional
ErrorCodeviaWithErrorCode(string code)
Mappings:
AspBadRequestException→400 BadRequestAspUnauthorizedException→401 UnauthorizedAspForbiddenEndpointException→403 ForbiddenAspInvalidOperationException→422 UnprocessableEntityInternalServiceUnavailableException→503 ServiceUnavailable
Installation
NuGet:
dotnet add package Phymnary.SugarPot.AspNetCore.Application
Usage
Register application services
using Phymnary.SugarPot.AspNetCore.Extensions;
builder.Services.AddApplicationServices();
Consume IRunAt
using Phymnary.SugarPot.AspNetCore;
public sealed class RequestAuditService(IRunAt runAt)
{
public DateTimeOffset RequestedAt => runAt.Value;
}
Throw standardized application exceptions
using Phymnary.SugarPot.AspNetCore.Exceptions;
if (string.IsNullOrWhiteSpace(name))
{
throw new AspBadRequestException("Name is required")
.WithErrorCode("APP_VALIDATION_NAME_REQUIRED");
}
if (!hasPermission)
{
throw new AspForbiddenEndpointException("Permission denied")
.WithErrorCode("APP_AUTH_FORBIDDEN");
}
Error handling guidance
These exception types are intended to be translated by API middleware or exception handlers into HTTP responses. A common response payload includes:
statusfromStatusCodemessagefromException.Message- optional
errorCodefromErrorCode
Target frameworks
Frameworks are inherited from the repository build configuration:
net8.0net9.0net10.0
Dependencies
- Project reference:
Phymnary.SugarPot.AspNetCore.Domain - Framework reference:
Microsoft.AspNetCore.App
Build metadata
Package version is sourced from $(AspPackedVersion).
License
See repository root for license details.
| 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
- Phymnary.SugarPot.AspNetCore.Domain (>= 1.2.2)
-
net8.0
- Phymnary.SugarPot.AspNetCore.Domain (>= 1.2.2)
-
net9.0
- Phymnary.SugarPot.AspNetCore.Domain (>= 1.2.2)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Phymnary.SugarPot.AspNetCore.Application:
| Package | Downloads |
|---|---|
|
Phymnary.SugarPot.AspNetCore.Api
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.