ServiceComposer.AspNetCore
5.2.0
dotnet add package ServiceComposer.AspNetCore --version 5.2.0
NuGet\Install-Package ServiceComposer.AspNetCore -Version 5.2.0
<PackageReference Include="ServiceComposer.AspNetCore" Version="5.2.0" />
<PackageVersion Include="ServiceComposer.AspNetCore" Version="5.2.0" />
<PackageReference Include="ServiceComposer.AspNetCore" />
paket add ServiceComposer.AspNetCore --version 5.2.0
#r "nuget: ServiceComposer.AspNetCore, 5.2.0"
#:package ServiceComposer.AspNetCore@5.2.0
#addin nuget:?package=ServiceComposer.AspNetCore&version=5.2.0
#tool nuget:?package=ServiceComposer.AspNetCore&version=5.2.0
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.0 | 678 | 3/12/2026 |
| 5.1.0 | 466 | 2/24/2026 |
| 5.0.0 | 821 | 2/20/2026 |
| 4.3.0 | 108 | 2/20/2026 |
| 4.2.0 | 103 | 2/20/2026 |
| 4.1.3 | 11,950 | 2/19/2025 |
| 4.1.2 | 1,737 | 1/30/2025 |
| 4.1.1 | 7,195 | 1/24/2025 |
| 4.1.0 | 931 | 1/3/2025 |
| 4.0.0 | 1,739 | 12/8/2024 |
| 3.1.0 | 700 | 11/22/2024 |
| 3.0.0 | 600 | 11/15/2024 |
| 2.2.0 | 4,403 | 5/1/2024 |
| 2.1.0 | 1,345 | 4/16/2024 |
| 2.0.1 | 8,084 | 6/14/2023 |
| 2.0.0 | 2,568 | 1/2/2023 |
| 1.13.0 | 4,085 | 4/8/2022 |
| 1.12.0 | 805 | 2/17/2022 |
| 1.11.0 | 1,006 | 10/16/2021 |