Vorn.EntityManagement.Client 5.0.0-rc4

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

Vorn.EntityManagement.Client

Vorn.EntityManagement.Client contains a Blazor component base that wraps an IEntityClient<TDto, TDescriptorDto> implementation. Use it to build real-time CRUD experiences with minimal plumbing—the base class manages SignalR connection lifetime, loading/error state, CRUD helpers, and server notifications so your UI code can focus on rendering.

Why use it?

  • Lifecycle aware – automatically starts the underlying SignalR client during OnInitializedAsync (configurable via AutoConnect) and tears it down when the component is disposed.
  • Ready-made commands – exposes async helpers such as AddAsync, UpdateAsync, RemoveAsync, and GetListAsync that call the injected client, manage busy indicators, and bubble errors through an EventCallback<Exception>.
  • Notification friendly – subscribes to EntityNotificationReceived and exposes an overridable OnNotificationAsync hook so derived components can refresh state, show toasts, or sync caches when other users make changes.
  • Interception support – forwards the optional EntityInterceptionConfig to the SignalR client, ensuring user/time context flows to the server for audit logging and authorization behaviors.

Getting started

1. Install the packages

dotnet add package Vorn.EntityManagement.SignalR.Client
dotnet add package Vorn.EntityManagement.Client

Bring in Vorn.EntityManagement and Vorn.EntityManagement.Server if you have not already configured the backend service and hub.

2. Provide a connection factory and interception provider

Implement IEntityConnectionFactory to centralize the HubConnection configuration for your DTO type and register the ambient interception provider so user/time context can flow through AsyncLocal storage.

using Microsoft.AspNetCore.SignalR.Client;
using Vorn.EntityManagement.Common;
using Vorn.EntityManagement.SignalR.Client;

public sealed class DocumentConnectionFactory(Uri hubUri) : IEntityConnectionFactory
{
    public Task<HubConnection> CreateConnection<TDto>()
        where TDto : EntityDto
    {
        HubConnection connection = new HubConnectionBuilder()
            .WithUrl(hubUri)
            .WithAutomaticReconnect()
            .Build();

        return Task.FromResult(connection);
    }
}

builder.Services.AddScoped<IEntityConnectionFactory, DocumentConnectionFactory>();
builder.Services.AddScoped<IEntityInterceptionProvider, AmbientEntityInterceptionProvider>();

3. Register a typed SignalR client

Create a concrete client that inherits from EntityClient<TDto, TDescriptorDto> and forwards constructor dependencies to the base class. Register it with dependency injection so the Blazor component can request it.

using Vorn.EntityManagement.SignalR.Client;

public sealed class DocumentClient(
    IEntityConnectionFactory connectionFactory,
    IEntityInterceptionProvider interceptionProvider)
    : EntityClient<DocumentDto, DocumentDescriptorDto>(connectionFactory, interceptionProvider)
{ }

builder.Services.AddScoped<DocumentClient>();

4. Derive a component

Inherit from EntityClientComponentBase<TClient, TDto, TDescriptorDto> to build a Blazor component with minimal code. The base class exposes the current descriptor, busy/error state, and CRUD helpers that wrap the injected DocumentClient.

@inherits DocumentListBase

@if (IsBusy)
{
    <p>Loading documents...</p>
}
else if (!string.IsNullOrEmpty(ErrorMessage))
{
    <p class="text-danger">@ErrorMessage</p>
}
else
{
    <ul>
        @foreach (var document in Documents)
        {
            <li>@document.Title</li>
        }
    </ul>
}

@code {
    public sealed class DocumentListBase
        : EntityClientComponentBase<DocumentClient, DocumentDto, DocumentDescriptorDto>
    {
        protected List<DocumentDto> Documents { get; } = new();

        protected override async Task OnInitializedAsync()
        {
            await base.OnInitializedAsync();
            Documents.AddRange(await Client.GetListAsync(Descriptor));
        }

        protected override async Task OnNotificationAsync(EntityNotification notification)
        {
            Documents.Clear();
            Documents.AddRange(await Client.GetListAsync(Descriptor));
        }
    }
}

5. Configure parameters

  • Set AutoConnect="false" when you want to defer connection startup (for example, until after authentication completes).
  • Provide an EntityInterceptionConfig to scope all calls made while the component is alive.
  • Toggle StopClientOnDispose="true" if the client should be stopped and disposed when the component is removed from the render tree.
  • Handle the Error callback to report exceptions through your preferred UI mechanism.

6. Call CRUD helpers

EntityClientComponentBase exposes async helpers (AddAsync, RemoveByIdAsync, GetListAsync, and more) that handle mutual exclusion, update IsBusy, and capture exceptions into ErrorMessage. Combine them with your UI events:

await AddAsync(new DocumentDto { Title = NewTitle });
Documents = (await Client.GetListAsync(Descriptor)).ToList();
StateHasChanged();

Additional tips

  • Use the provided SafeRunAsync helper when performing read operations that should update IsBusy and emit errors without rethrowing.
  • Override DisposeAsync in your derived component if you need to release additional resources; remember to call await base.DisposeAsync() so the hub connection is cleaned up.
  • Pair the component base with source-generated DTOs/descriptors from Vorn.EntityManagement.Generators to keep type definitions consistent across server and client projects.

With Vorn.EntityManagement.Client, building real-time Blazor pages that talk to your SignalR-backed entity services becomes a matter of composing UI rather than rewriting plumbing.

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 was computed.  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 was computed.  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 (2)

Showing the top 2 NuGet packages that depend on Vorn.EntityManagement.Client:

Package Downloads
Vorn.EntityManagement.Interface

This library is designed to provide some basic interface services and components plus enabling entity management usage.

Vorn.Common.Interface.EntityManagement

This library is designed to provide some basic interface services and components plus enabling entity management usage.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
5.0.0-rc5 270 10/7/2025
5.0.0-rc4 209 10/7/2025
5.0.0-rc3 195 10/7/2025
5.0.0-rc2 218 10/6/2025
5.0.0-rc1 205 10/5/2025
4.6.0 198 10/5/2025
4.5.0 166 10/3/2025