Search Results for

    Show / Hide Table of Contents

    ZhEaIsNsAaBn.LayerResponse

    The result type for any .NET app — LayerResponse / LayerResponse<T> with coded, localizable Error records. Every fallible call returns one: never a bare value, never null, never an exception for an expected failure. No dependencies but .NET itself.

    Install

    dotnet add package ZhEaIsNsAaBn.LayerResponse --version 0.9.0
    

    Targets net8.0 and net10.0.

    Quick start

    using ZhEaIsNsAaBn.Utilities;
    
    LayerResponse<Order> GetOrder(int id)
    {
        if (id <= 0)
            return LayerResponse<Order>.Failure(CommonErrors.NotFound("order"));
    
        return LayerResponse<Order>.Success(new Order(id));
    }
    
    var result = GetOrder(42);
    if (result.IsSuccess)
        Console.WriteLine(result.Result!.Id);
    

    What to read next

    • API reference — every public type, generated from the XML docs
    • Changelog
    • NuGet
    • Source

    JSON

    Severity serializes as a plain string — "Severity":"High", not an object. Unknown writes as "Unknown" and reads back from "Unknown" or "". Exception and AdditionalData on an Error are never serialized; they are logs only.

    • Edit this page
    In this article
    Back to top Generated by DocFX