Fluens.Kernel 0.3.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package Fluens.Kernel --version 0.3.2
                    
NuGet\Install-Package Fluens.Kernel -Version 0.3.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="Fluens.Kernel" Version="0.3.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Fluens.Kernel" Version="0.3.2" />
                    
Directory.Packages.props
<PackageReference Include="Fluens.Kernel" />
                    
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 Fluens.Kernel --version 0.3.2
                    
#r "nuget: Fluens.Kernel, 0.3.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 Fluens.Kernel@0.3.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=Fluens.Kernel&version=0.3.2
                    
Install as a Cake Addin
#tool nuget:?package=Fluens.Kernel&version=0.3.2
                    
Install as a Cake Tool

Fluens.Kernel

DDD building blocks and Result pattern. Zero dependencies.

Installation

dotnet add package Fluens.Kernel

Usage

Result Pattern

// Result without value
Result result = Result.Success();
Result failure = Result.Failure(new NotFoundError("User not found"));

// Result with value
Result<int> result = Result.Success(42);
Result<int> failure = Result.Failure<int>(new ValidationError("Invalid input"));

// Pattern matching
string message = result.Match(
    onSuccess: value => $"Got: {value}",
    onFailure: error => $"Error: {error.Message}"
);

Both Result and Result<T> are readonly struct types — zero heap allocations, default(Result) is a valid success.

Conversions
// Implicit: value → Result<T>
Result<int> result = 42;

// Explicit: Result<T> → Result (discards value)
Result plain = (Result)result;

// As<T>(): failure Result → Result<T>
Result failure = Result.Failure(new NotFoundError("Missing"));
Result<int> typed = failure.As<int>(); // preserves error

// As<T>() on success throws InvalidOperationException

Built-in error types: NotFoundError, ValidationError, ConflictError, ForbiddenError.

Error Codes

Standard error codes are centralized in the ErrorCodes static class:

ErrorCodes.NotFound    // "NOT_FOUND"
ErrorCodes.Validation  // "VALIDATION"
ErrorCodes.Conflict    // "CONFLICT"
ErrorCodes.Forbidden   // "FORBIDDEN"

Use these constants instead of hardcoded strings when comparing error codes:

if (result.Error.Code == ErrorCodes.NotFound)
{
    // handle not found
}

DDD Building Blocks

// Strongly-typed identifiers
public readonly record struct OrderId(int Value) : ITypedIdentifier<int>;

// Entities with identity-based equality
public class Order : AggregateRoot<OrderId>
{
    public string Number { get; private set; } = "";

    public void Place()
    {
        AddEvent(new OrderPlacedEvent(ID));
    }
}

// Value objects with structural equality
public sealed record Money(decimal Amount, string Currency) : ValueObject
{
    protected override IEnumerable<object?> GetAtomicValues()
    {
        yield return Amount;
        yield return Currency;
    }
}

Marker interfaces: IAuditable (CreatedAtUtc, UpdatedAtUtc), IDeletable (DeletedAtUtc).

DeletableExtensions

Filter out soft-deleted entities from IQueryable<T> sources:

IQueryable<Order> activeOrders = dbContext.Orders.WithoutDeleted();

WithoutDeleted() returns only entities where DeletedAtUtc is null.

License

This project is licensed under the MIT License.

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.
  • net10.0

    • No dependencies.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on Fluens.Kernel:

Package Downloads
Fluens.Web

ASP.NET Core base types for Fluens web libraries: Result-to-HTTP mapping, global exception handler, and paged responses.

Fluens.Messaging

Inbox/outbox messaging pattern for modular applications.

Fluens.Cqrs

CQRS pattern implementation with command/query dispatchers, handler interfaces, and logging/tracing decorators.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.6.6 66 3/11/2026
0.6.5 155 3/4/2026
0.6.4 149 3/4/2026
0.6.3 159 3/3/2026
0.6.2 162 3/2/2026
0.6.1 163 3/2/2026
0.6.0 152 3/1/2026
0.5.7 155 3/1/2026
0.5.6 154 3/1/2026
0.5.5 158 2/28/2026
0.5.4 157 2/28/2026
0.5.3 161 2/27/2026
0.5.2 151 2/27/2026
0.5.1 158 2/27/2026
0.5.0 160 2/26/2026
0.3.2 159 2/26/2026
0.3.1 155 2/26/2026
0.3.0 159 2/24/2026
0.2.5 166 2/24/2026
0.2.4 158 2/24/2026
Loading failed