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
                    
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="Phymnary.SugarPot.AspNetCore.Application" Version="1.2.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Phymnary.SugarPot.AspNetCore.Application" Version="1.2.2" />
                    
Directory.Packages.props
<PackageReference Include="Phymnary.SugarPot.AspNetCore.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 Phymnary.SugarPot.AspNetCore.Application --version 1.2.2
                    
#r "nuget: Phymnary.SugarPot.AspNetCore.Application, 1.2.2"
                    
#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 Phymnary.SugarPot.AspNetCore.Application@1.2.2
                    
#: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=Phymnary.SugarPot.AspNetCore.Application&version=1.2.2
                    
Install as a Cake Addin
#tool nuget:?package=Phymnary.SugarPot.AspNetCore.Application&version=1.2.2
                    
Install as a Cake Tool

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 IRunAt as scoped.

Runtime service

  • IRunAt (from Domain package)
    • DateTimeOffset Value { get; }
    • Implementation (RunAt) is internal and returns DateTimeOffset.UtcNow at 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 internal IApplicationException marker)
  • Expose HttpStatusCode StatusCode
  • Support optional ErrorCode via WithErrorCode(string code)

Mappings:

  • AspBadRequestException → 400 BadRequest
  • AspUnauthorizedException → 401 Unauthorized
  • AspForbiddenEndpointException → 403 Forbidden
  • AspInvalidOperationException → 422 UnprocessableEntity
  • InternalServiceUnavailableException → 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:

  • status from StatusCode
  • message from Exception.Message
  • optional errorCode from ErrorCode

Target frameworks

Frameworks are inherited from the repository build configuration:

  • net8.0
  • net9.0
  • net10.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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.

Version Downloads Last Updated
1.2.2 109 9/18/2026
1.2.1 160 7/27/2026
1.2.0 243 6/15/2026
1.1.0 159 6/7/2026
1.0.0 159 6/5/2026