ServiceComposer.AspNetCore
5.2.2
dotnet add package ServiceComposer.AspNetCore --version 5.2.2
NuGet\Install-Package ServiceComposer.AspNetCore -Version 5.2.2
<PackageReference Include="ServiceComposer.AspNetCore" Version="5.2.2" />
<PackageVersion Include="ServiceComposer.AspNetCore" Version="5.2.2" />
<PackageReference Include="ServiceComposer.AspNetCore" />
paket add ServiceComposer.AspNetCore --version 5.2.2
#r "nuget: ServiceComposer.AspNetCore, 5.2.2"
#:package ServiceComposer.AspNetCore@5.2.2
#addin nuget:?package=ServiceComposer.AspNetCore&version=5.2.2
#tool nuget:?package=ServiceComposer.AspNetCore&version=5.2.2
ServiceComposer
ServiceComposer is a ViewModel Composition Gateway for ASP.NET Core.
Designing a UI when the back-end system consists of multiple autonomous services is challenging. ViewModel Composition solves this at the API gateway layer: each service contributes its own slice of data through an independent handler, all handlers run in parallel, and the gateway returns a single merged response to the caller.
Getting started
Install the package in your ASP.NET Core gateway project:
dotnet add package ServiceComposer.AspNetCore
Configure the gateway in Program.cs:
var builder = WebApplication.CreateBuilder();
builder.Services.AddRouting();
builder.Services.AddViewModelComposition();
var app = builder.Build();
app.MapCompositionHandlers();
app.Run();
Each service defines a composition handler that contributes its slice of data to the shared view model:
// In Sales.ViewModelComposition
public class SalesProductInfo : ICompositionRequestsHandler
{
[HttpGet("/product/{id}")]
public Task Handle(HttpRequest request)
{
var vm = request.GetComposedResponseModel();
vm.ProductId = request.HttpContext.GetRouteValue("id").ToString();
vm.ProductPrice = 100;
return Task.CompletedTask;
}
}
// In Marketing.ViewModelComposition
public class MarketingProductInfo : ICompositionRequestsHandler
{
[HttpGet("/product/{id}")]
public Task Handle(HttpRequest request)
{
var vm = request.GetComposedResponseModel();
vm.ProductName = "Sample product";
vm.ProductDescription = "This is a sample product";
return Task.CompletedTask;
}
}
Both handlers target the same route and run in parallel. Neither knows about the other. A GET to /product/1 returns a single merged JSON response:
{
"productId": "1",
"productPrice": 100,
"productName": "Sample product",
"productDescription": "This is a sample product"
}
Documentation
| Product | Versions 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. |
-
net10.0
- Microsoft.Extensions.DependencyModel (>= 10.0.3 && < 11.0.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on ServiceComposer.AspNetCore:
| Package | Downloads |
|---|---|
|
ServiceComposer.AspNetCore.Mvc
Services ViewModel Composition for Asp.Net Core Mvc |
GitHub repositories (2)
Showing the top 2 popular GitHub repositories that depend on ServiceComposer.AspNetCore:
| Repository | Stars |
|---|---|
|
Particular/Workshop
SOA Done Right
|
|
|
mauroservienti/all-our-aggregates-are-wrong-demos
A microservices powered e-commerce shopping cart sample - based on SOA principles. Demos and sample for my "All our Aggregates are Wrong" talk
|
| Version | Downloads | Last Updated |
|---|---|---|
| 5.2.2 | 292 | 9/4/2026 |
| 5.2.1 | 4,010 | 5/12/2026 |
| 5.2.0 | 2,411 | 3/12/2026 |
| 5.1.0 | 533 | 2/24/2026 |
| 5.0.0 | 906 | 2/20/2026 |
| 4.3.2 | 93 | 9/4/2026 |
| 4.3.1 | 131 | 5/12/2026 |
| 4.3.0 | 371 | 2/20/2026 |
| 4.2.0 | 175 | 2/20/2026 |
| 4.1.3 | 12,193 | 2/19/2025 |
| 4.1.2 | 1,785 | 1/30/2025 |
| 4.1.1 | 8,420 | 1/24/2025 |
| 4.1.0 | 1,012 | 1/3/2025 |
| 4.0.0 | 1,783 | 12/8/2024 |
| 3.1.0 | 752 | 11/22/2024 |
| 3.0.0 | 639 | 11/15/2024 |
| 2.2.0 | 4,473 | 5/1/2024 |
| 2.1.0 | 1,415 | 4/16/2024 |
| 2.0.1 | 8,112 | 6/14/2023 |