LoomKit.Requests.Crud.Abstractions 10.0.1

dotnet add package LoomKit.Requests.Crud.Abstractions --version 10.0.1
                    
NuGet\Install-Package LoomKit.Requests.Crud.Abstractions -Version 10.0.1
                    
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="LoomKit.Requests.Crud.Abstractions" Version="10.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="LoomKit.Requests.Crud.Abstractions" Version="10.0.1" />
                    
Directory.Packages.props
<PackageReference Include="LoomKit.Requests.Crud.Abstractions" />
                    
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 LoomKit.Requests.Crud.Abstractions --version 10.0.1
                    
#r "nuget: LoomKit.Requests.Crud.Abstractions, 10.0.1"
                    
#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 LoomKit.Requests.Crud.Abstractions@10.0.1
                    
#: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=LoomKit.Requests.Crud.Abstractions&version=10.0.1
                    
Install as a Cake Addin
#tool nuget:?package=LoomKit.Requests.Crud.Abstractions&version=10.0.1
                    
Install as a Cake Tool

LoomKit.Requests.Crud.Abstractions

Contracts for LoomKit.Requests.Crud: a single interface, IProjectable<TEntity, TDto>, that lets a DTO declare its own EF-Core-translatable projection expression.

Status: early stage. The public API may still change between versions — pin a commit/tag if you depend on it.

Why a separate package

IProjectable<TEntity, TDto> is implemented on your DTOs, not on your handlers. DTOs commonly live in a shared "contracts" project that is also referenced by client code (a Blazor WASM app, a mobile client, ...). That project has no business depending on LoomKit.Requests.Crud itself — the server-side CRUD handler base classes, LoomKit.Requests.Abstractions, LoomKit.Esits, and everything else that comes with it.

Referencing LoomKit.Requests.Crud.Abstractions alone gets you IProjectable with no further dependencies.

Installation

dotnet add package LoomKit.Requests.Crud.Abstractions

Usage

Implement IProjectable<TEntity, TDto> on a DTO to declare how it's built from its source entity:

using System.Linq.Expressions;
using LoomKit.Requests.Crud.Contracts;

public record ProductDto : IProjectable<Product, ProductDto>
{
    public int Id { get; init; }
    public string Name { get; init; }
    public UserDto? User { get; init; }

    // EF Core translates this into an optimized SQL SELECT.
    // Use property-initializer syntax, not a positional record constructor.
    public static Expression<Func<Product, ProductDto>> Projection =>
        e => new ProductDto
        {
            Id = e.Id,
            Name = e.Name,
            User = new UserDto
            {
                Email = e.User.Email,
                Roles = e.User.Roles.Select(r => new RoleDto
                {
                    Id = r.Id,
                    Name = r.Name
                }).ToList()
            }
        };

    // Fields included by default when the caller doesn't request specific ones.
    // Omit (or return []) to always include every field.
    public static string[] DefaultSelects => ["Id", "Name"];
}

A server-side project using LoomKit.Requests.Crud's BaseGetByIdHandler/BaseListHandler reads Projection/DefaultSelects off the DTO to build a pruned, SQL-translatable query — see that package's README for the full Selects syntax and how the projection gets pruned at request time.

License

MIT

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

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
10.0.1 147 8/25/2026