From 1b36f9157e1f4d985af84f33ce46117bdff14ca8 Mon Sep 17 00:00:00 2001 From: David Boike Date: Thu, 31 Oct 2024 10:07:12 -0500 Subject: [PATCH 1/9] net8.0 --- README.md | 2 +- .../Divergent.CompositionGateway.csproj | 2 +- .../asp-net-core/Divergent.Sales.API/Divergent.Sales.API.csproj | 2 +- .../Divergent.Sales.Data/Divergent.Sales.Data.csproj | 2 +- .../Divergent.Sales.ViewModelComposition.Events.csproj | 2 +- .../Divergent.Sales.ViewModelComposition.csproj | 2 +- .../Divergent.Shipping.API/Divergent.Shipping.API.csproj | 2 +- .../Divergent.Shipping.Data/Divergent.Shipping.Data.csproj | 2 +- .../Divergent.Shipping.ViewModelComposition.csproj | 2 +- demos/asp-net-core/Divergent.Website/Divergent.Website.csproj | 2 +- demos/asp-net-core/ITOps.Data/ITOps.Data.csproj | 2 +- demos/asp-net-core/ITOps.Json/ITOps.Json.csproj | 2 +- .../Divergent.CompositionGateway.csproj | 2 +- .../Divergent.Customers.API/Divergent.Customers.API.csproj | 2 +- .../Divergent.Customers.Data/Divergent.Customers.Data.csproj | 2 +- .../Divergent.Customers.ViewModelComposition.csproj | 2 +- .../after/Divergent.Finance.API/Divergent.Finance.API.csproj | 2 +- .../after/Divergent.Finance.Data/Divergent.Finance.Data.csproj | 2 +- .../Divergent.Finance.ViewModelComposition.csproj | 2 +- .../after/Divergent.Frontend/Divergent.Frontend.csproj | 2 +- .../after/Divergent.Sales.API/Divergent.Sales.API.csproj | 2 +- .../after/Divergent.Sales.Data/Divergent.Sales.Data.csproj | 2 +- .../Divergent.Sales.ViewModelComposition.csproj | 2 +- .../Divergent.CompositionGateway.csproj | 2 +- .../Divergent.Customers.API/Divergent.Customers.API.csproj | 2 +- .../Divergent.Customers.Data/Divergent.Customers.Data.csproj | 2 +- .../Divergent.Customers.ViewModelComposition.csproj | 2 +- .../before/Divergent.Finance.API/Divergent.Finance.API.csproj | 2 +- .../before/Divergent.Finance.Data/Divergent.Finance.Data.csproj | 2 +- .../Divergent.Finance.ViewModelComposition.csproj | 2 +- .../before/Divergent.Frontend/Divergent.Frontend.csproj | 2 +- .../before/Divergent.Sales.API/Divergent.Sales.API.csproj | 2 +- .../before/Divergent.Sales.Data/Divergent.Sales.Data.csproj | 2 +- .../Divergent.Sales.ViewModelComposition.csproj | 2 +- .../Divergent.CompositionGateway.csproj | 2 +- .../Divergent.Customers.API/Divergent.Customers.API.csproj | 2 +- .../Divergent.Customers.Data/Divergent.Customers.Data.csproj | 2 +- .../Divergent.Customers.ViewModelComposition.csproj | 2 +- .../after/Divergent.Customers/Divergent.Customers.csproj | 2 +- .../after/Divergent.Finance.API/Divergent.Finance.API.csproj | 2 +- .../after/Divergent.Finance.Data/Divergent.Finance.Data.csproj | 2 +- .../Divergent.Finance.ViewModelComposition.csproj | 2 +- .../after/Divergent.Finance/Divergent.Finance.csproj | 2 +- .../after/Divergent.Frontend/Divergent.Frontend.csproj | 2 +- .../after/Divergent.Sales.API/Divergent.Sales.API.csproj | 2 +- .../after/Divergent.Sales.Data/Divergent.Sales.Data.csproj | 2 +- .../Divergent.Sales.ViewModelComposition.csproj | 2 +- .../after/Divergent.Sales/Divergent.Sales.csproj | 2 +- .../after/Divergent.Shipping/Divergent.Shipping.csproj | 2 +- .../MastercardPaymentProvider/PaymentProviders.csproj | 2 +- .../Divergent.CompositionGateway.csproj | 2 +- .../Divergent.Customers.API/Divergent.Customers.API.csproj | 2 +- .../Divergent.Customers.Data/Divergent.Customers.Data.csproj | 2 +- .../Divergent.Customers.ViewModelComposition.csproj | 2 +- .../before/Divergent.Customers/Divergent.Customers.csproj | 2 +- .../before/Divergent.Finance.API/Divergent.Finance.API.csproj | 2 +- .../before/Divergent.Finance.Data/Divergent.Finance.Data.csproj | 2 +- .../Divergent.Finance.ViewModelComposition.csproj | 2 +- .../before/Divergent.Finance/Divergent.Finance.csproj | 2 +- .../before/Divergent.Frontend/Divergent.Frontend.csproj | 2 +- .../before/Divergent.Sales.API/Divergent.Sales.API.csproj | 2 +- .../before/Divergent.Sales.Data/Divergent.Sales.Data.csproj | 2 +- .../Divergent.Sales.ViewModelComposition.csproj | 2 +- .../before/Divergent.Sales/Divergent.Sales.csproj | 2 +- .../before/Divergent.Shipping/Divergent.Shipping.csproj | 2 +- .../MastercardPaymentProvider/PaymentProviders.csproj | 2 +- .../Divergent.CompositionGateway.csproj | 2 +- .../Divergent.Customers.API/Divergent.Customers.API.csproj | 2 +- .../Divergent.Customers.Data/Divergent.Customers.Data.csproj | 2 +- .../Divergent.Customers.ViewModelComposition.csproj | 2 +- .../after/Divergent.Customers/Divergent.Customers.csproj | 2 +- .../after/Divergent.Finance.API/Divergent.Finance.API.csproj | 2 +- .../after/Divergent.Finance.Data/Divergent.Finance.Data.csproj | 2 +- .../Divergent.Finance.ViewModelComposition.csproj | 2 +- .../03-sagas/after/Divergent.Finance/Divergent.Finance.csproj | 2 +- .../03-sagas/after/Divergent.Frontend/Divergent.Frontend.csproj | 2 +- .../after/Divergent.Sales.API/Divergent.Sales.API.csproj | 2 +- .../after/Divergent.Sales.Data/Divergent.Sales.Data.csproj | 2 +- .../Divergent.Sales.ViewModelComposition.csproj | 2 +- exercises/03-sagas/after/Divergent.Sales/Divergent.Sales.csproj | 2 +- .../03-sagas/after/Divergent.Shipping/Divergent.Shipping.csproj | 2 +- .../MastercardPaymentProvider/PaymentProviders.csproj | 2 +- .../Divergent.CompositionGateway.csproj | 2 +- .../Divergent.Customers.API/Divergent.Customers.API.csproj | 2 +- .../Divergent.Customers.Data/Divergent.Customers.Data.csproj | 2 +- .../Divergent.Customers.ViewModelComposition.csproj | 2 +- .../before/Divergent.Customers/Divergent.Customers.csproj | 2 +- .../before/Divergent.Finance.API/Divergent.Finance.API.csproj | 2 +- .../before/Divergent.Finance.Data/Divergent.Finance.Data.csproj | 2 +- .../Divergent.Finance.ViewModelComposition.csproj | 2 +- .../03-sagas/before/Divergent.Finance/Divergent.Finance.csproj | 2 +- .../before/Divergent.Frontend/Divergent.Frontend.csproj | 2 +- .../before/Divergent.Sales.API/Divergent.Sales.API.csproj | 2 +- .../before/Divergent.Sales.Data/Divergent.Sales.Data.csproj | 2 +- .../Divergent.Sales.ViewModelComposition.csproj | 2 +- .../03-sagas/before/Divergent.Sales/Divergent.Sales.csproj | 2 +- .../before/Divergent.Shipping/Divergent.Shipping.csproj | 2 +- .../MastercardPaymentProvider/PaymentProviders.csproj | 2 +- .../Divergent.CompositionGateway.csproj | 2 +- .../Divergent.Customers.API/Divergent.Customers.API.csproj | 2 +- .../Divergent.Customers.Data/Divergent.Customers.Data.csproj | 2 +- .../Divergent.Customers.ViewModelComposition.csproj | 2 +- .../after/Divergent.Customers/Divergent.Customers.csproj | 2 +- .../after/Divergent.Finance.API/Divergent.Finance.API.csproj | 2 +- .../after/Divergent.Finance.Data/Divergent.Finance.Data.csproj | 2 +- .../Divergent.Finance.ViewModelComposition.csproj | 2 +- .../after/Divergent.Finance/Divergent.Finance.csproj | 2 +- .../after/Divergent.Frontend/Divergent.Frontend.csproj | 2 +- .../04-integration/after/Divergent.ITOps/Divergent.ITOps.csproj | 2 +- .../after/Divergent.Sales.API/Divergent.Sales.API.csproj | 2 +- .../after/Divergent.Sales.Data/Divergent.Sales.Data.csproj | 2 +- .../Divergent.Sales.ViewModelComposition.csproj | 2 +- .../04-integration/after/Divergent.Sales/Divergent.Sales.csproj | 2 +- .../after/Divergent.Shipping/Divergent.Shipping.csproj | 2 +- .../MastercardPaymentProvider/PaymentProviders.csproj | 2 +- .../Divergent.CompositionGateway.csproj | 2 +- .../Divergent.Customers.API/Divergent.Customers.API.csproj | 2 +- .../Divergent.Customers.Data/Divergent.Customers.Data.csproj | 2 +- .../Divergent.Customers.ViewModelComposition.csproj | 2 +- .../before/Divergent.Customers/Divergent.Customers.csproj | 2 +- .../before/Divergent.Finance.API/Divergent.Finance.API.csproj | 2 +- .../before/Divergent.Finance.Data/Divergent.Finance.Data.csproj | 2 +- .../Divergent.Finance.ViewModelComposition.csproj | 2 +- .../before/Divergent.Finance/Divergent.Finance.csproj | 2 +- .../before/Divergent.Frontend/Divergent.Frontend.csproj | 2 +- .../before/Divergent.ITOps/Divergent.ITOps.csproj | 2 +- .../before/Divergent.Sales.API/Divergent.Sales.API.csproj | 2 +- .../before/Divergent.Sales.Data/Divergent.Sales.Data.csproj | 2 +- .../Divergent.Sales.ViewModelComposition.csproj | 2 +- .../before/Divergent.Sales/Divergent.Sales.csproj | 2 +- .../before/Divergent.Shipping/Divergent.Shipping.csproj | 2 +- .../MastercardPaymentProvider/PaymentProviders.csproj | 2 +- exercises/shared-api-gateway/ITOps.Json/ITOps.Json.csproj | 2 +- .../ITOps.SharedConfiguration/ITOps.SharedConfiguration.csproj | 2 +- .../ITOps.ViewModelComposition.Gateway.csproj | 2 +- .../ITOps.ViewModelComposition.csproj | 2 +- 136 files changed, 136 insertions(+), 136 deletions(-) diff --git a/README.md b/README.md index 53609e3d..82aad1a0 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Welcome to the workshop. ## Prerequisites - Windows -- .NET 7.0 or newer +- .NET 8.0 or newer - A .NET IDE for the exercises - Visual Studio 2022 ([version 17.4](https://github.com/dotnet/core/blob/main/release-notes/7.0/7.0.0/7.0.0.md#visual-studio-compatibility)) or later - [SwitchStartupProject](https://marketplace.visualstudio.com/items?itemName=vs-publisher-141975.SwitchStartupProjectForVS2022) diff --git a/demos/asp-net-core/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj b/demos/asp-net-core/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj index 277f3709..21ecb139 100644 --- a/demos/asp-net-core/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj +++ b/demos/asp-net-core/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 Exe diff --git a/demos/asp-net-core/Divergent.Sales.API/Divergent.Sales.API.csproj b/demos/asp-net-core/Divergent.Sales.API/Divergent.Sales.API.csproj index 99e01151..cbd90c10 100644 --- a/demos/asp-net-core/Divergent.Sales.API/Divergent.Sales.API.csproj +++ b/demos/asp-net-core/Divergent.Sales.API/Divergent.Sales.API.csproj @@ -2,7 +2,7 @@ Exe - net7.0 + net8.0 diff --git a/demos/asp-net-core/Divergent.Sales.Data/Divergent.Sales.Data.csproj b/demos/asp-net-core/Divergent.Sales.Data/Divergent.Sales.Data.csproj index f9332ab7..ddb5e497 100644 --- a/demos/asp-net-core/Divergent.Sales.Data/Divergent.Sales.Data.csproj +++ b/demos/asp-net-core/Divergent.Sales.Data/Divergent.Sales.Data.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 diff --git a/demos/asp-net-core/Divergent.Sales.ViewModelComposition.Events/Divergent.Sales.ViewModelComposition.Events.csproj b/demos/asp-net-core/Divergent.Sales.ViewModelComposition.Events/Divergent.Sales.ViewModelComposition.Events.csproj index 2460c80d..e940c627 100644 --- a/demos/asp-net-core/Divergent.Sales.ViewModelComposition.Events/Divergent.Sales.ViewModelComposition.Events.csproj +++ b/demos/asp-net-core/Divergent.Sales.ViewModelComposition.Events/Divergent.Sales.ViewModelComposition.Events.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 diff --git a/demos/asp-net-core/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj b/demos/asp-net-core/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj index a0d0ad35..125e4ac8 100644 --- a/demos/asp-net-core/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj +++ b/demos/asp-net-core/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 diff --git a/demos/asp-net-core/Divergent.Shipping.API/Divergent.Shipping.API.csproj b/demos/asp-net-core/Divergent.Shipping.API/Divergent.Shipping.API.csproj index 9250f005..8a9f533f 100644 --- a/demos/asp-net-core/Divergent.Shipping.API/Divergent.Shipping.API.csproj +++ b/demos/asp-net-core/Divergent.Shipping.API/Divergent.Shipping.API.csproj @@ -2,7 +2,7 @@ Exe - net7.0 + net8.0 diff --git a/demos/asp-net-core/Divergent.Shipping.Data/Divergent.Shipping.Data.csproj b/demos/asp-net-core/Divergent.Shipping.Data/Divergent.Shipping.Data.csproj index d3b68363..ed9815c9 100644 --- a/demos/asp-net-core/Divergent.Shipping.Data/Divergent.Shipping.Data.csproj +++ b/demos/asp-net-core/Divergent.Shipping.Data/Divergent.Shipping.Data.csproj @@ -1,6 +1,6 @@  - net7.0 + net8.0 diff --git a/demos/asp-net-core/Divergent.Shipping.ViewModelComposition/Divergent.Shipping.ViewModelComposition.csproj b/demos/asp-net-core/Divergent.Shipping.ViewModelComposition/Divergent.Shipping.ViewModelComposition.csproj index 38d767b0..956ea343 100644 --- a/demos/asp-net-core/Divergent.Shipping.ViewModelComposition/Divergent.Shipping.ViewModelComposition.csproj +++ b/demos/asp-net-core/Divergent.Shipping.ViewModelComposition/Divergent.Shipping.ViewModelComposition.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 diff --git a/demos/asp-net-core/Divergent.Website/Divergent.Website.csproj b/demos/asp-net-core/Divergent.Website/Divergent.Website.csproj index ab7b1eb7..51ed342b 100644 --- a/demos/asp-net-core/Divergent.Website/Divergent.Website.csproj +++ b/demos/asp-net-core/Divergent.Website/Divergent.Website.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 diff --git a/demos/asp-net-core/ITOps.Data/ITOps.Data.csproj b/demos/asp-net-core/ITOps.Data/ITOps.Data.csproj index 278cbcf8..1b59af71 100644 --- a/demos/asp-net-core/ITOps.Data/ITOps.Data.csproj +++ b/demos/asp-net-core/ITOps.Data/ITOps.Data.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 enable enable diff --git a/demos/asp-net-core/ITOps.Json/ITOps.Json.csproj b/demos/asp-net-core/ITOps.Json/ITOps.Json.csproj index b7ac7dab..53a87c50 100644 --- a/demos/asp-net-core/ITOps.Json/ITOps.Json.csproj +++ b/demos/asp-net-core/ITOps.Json/ITOps.Json.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 diff --git a/exercises/01-composite-ui/after/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj b/exercises/01-composite-ui/after/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj index 54e3c583..c30c220c 100644 --- a/exercises/01-composite-ui/after/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj +++ b/exercises/01-composite-ui/after/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 enable diff --git a/exercises/01-composite-ui/after/Divergent.Customers.API/Divergent.Customers.API.csproj b/exercises/01-composite-ui/after/Divergent.Customers.API/Divergent.Customers.API.csproj index 319dfad1..58b7bc1e 100644 --- a/exercises/01-composite-ui/after/Divergent.Customers.API/Divergent.Customers.API.csproj +++ b/exercises/01-composite-ui/after/Divergent.Customers.API/Divergent.Customers.API.csproj @@ -2,7 +2,7 @@ latest - net7.0 + net8.0 enable diff --git a/exercises/01-composite-ui/after/Divergent.Customers.Data/Divergent.Customers.Data.csproj b/exercises/01-composite-ui/after/Divergent.Customers.Data/Divergent.Customers.Data.csproj index c2a43e03..a366e349 100644 --- a/exercises/01-composite-ui/after/Divergent.Customers.Data/Divergent.Customers.Data.csproj +++ b/exercises/01-composite-ui/after/Divergent.Customers.Data/Divergent.Customers.Data.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 diff --git a/exercises/01-composite-ui/after/Divergent.Customers.ViewModelComposition/Divergent.Customers.ViewModelComposition.csproj b/exercises/01-composite-ui/after/Divergent.Customers.ViewModelComposition/Divergent.Customers.ViewModelComposition.csproj index 06647932..6ec89002 100644 --- a/exercises/01-composite-ui/after/Divergent.Customers.ViewModelComposition/Divergent.Customers.ViewModelComposition.csproj +++ b/exercises/01-composite-ui/after/Divergent.Customers.ViewModelComposition/Divergent.Customers.ViewModelComposition.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 diff --git a/exercises/01-composite-ui/after/Divergent.Finance.API/Divergent.Finance.API.csproj b/exercises/01-composite-ui/after/Divergent.Finance.API/Divergent.Finance.API.csproj index 4c0f2c11..f548dc27 100644 --- a/exercises/01-composite-ui/after/Divergent.Finance.API/Divergent.Finance.API.csproj +++ b/exercises/01-composite-ui/after/Divergent.Finance.API/Divergent.Finance.API.csproj @@ -2,7 +2,7 @@ latest - net7.0 + net8.0 enable diff --git a/exercises/01-composite-ui/after/Divergent.Finance.Data/Divergent.Finance.Data.csproj b/exercises/01-composite-ui/after/Divergent.Finance.Data/Divergent.Finance.Data.csproj index f731948f..ac125a56 100644 --- a/exercises/01-composite-ui/after/Divergent.Finance.Data/Divergent.Finance.Data.csproj +++ b/exercises/01-composite-ui/after/Divergent.Finance.Data/Divergent.Finance.Data.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 diff --git a/exercises/01-composite-ui/after/Divergent.Finance.ViewModelComposition/Divergent.Finance.ViewModelComposition.csproj b/exercises/01-composite-ui/after/Divergent.Finance.ViewModelComposition/Divergent.Finance.ViewModelComposition.csproj index 06647932..6ec89002 100644 --- a/exercises/01-composite-ui/after/Divergent.Finance.ViewModelComposition/Divergent.Finance.ViewModelComposition.csproj +++ b/exercises/01-composite-ui/after/Divergent.Finance.ViewModelComposition/Divergent.Finance.ViewModelComposition.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 diff --git a/exercises/01-composite-ui/after/Divergent.Frontend/Divergent.Frontend.csproj b/exercises/01-composite-ui/after/Divergent.Frontend/Divergent.Frontend.csproj index e33b3c88..855715e4 100644 --- a/exercises/01-composite-ui/after/Divergent.Frontend/Divergent.Frontend.csproj +++ b/exercises/01-composite-ui/after/Divergent.Frontend/Divergent.Frontend.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 enable diff --git a/exercises/01-composite-ui/after/Divergent.Sales.API/Divergent.Sales.API.csproj b/exercises/01-composite-ui/after/Divergent.Sales.API/Divergent.Sales.API.csproj index 700fd8a4..b057d8ae 100644 --- a/exercises/01-composite-ui/after/Divergent.Sales.API/Divergent.Sales.API.csproj +++ b/exercises/01-composite-ui/after/Divergent.Sales.API/Divergent.Sales.API.csproj @@ -2,7 +2,7 @@ latest - net7.0 + net8.0 enable diff --git a/exercises/01-composite-ui/after/Divergent.Sales.Data/Divergent.Sales.Data.csproj b/exercises/01-composite-ui/after/Divergent.Sales.Data/Divergent.Sales.Data.csproj index 3c845765..8080aff7 100644 --- a/exercises/01-composite-ui/after/Divergent.Sales.Data/Divergent.Sales.Data.csproj +++ b/exercises/01-composite-ui/after/Divergent.Sales.Data/Divergent.Sales.Data.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 diff --git a/exercises/01-composite-ui/after/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj b/exercises/01-composite-ui/after/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj index 31b11046..1a0c6ec8 100644 --- a/exercises/01-composite-ui/after/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj +++ b/exercises/01-composite-ui/after/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 diff --git a/exercises/01-composite-ui/before/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj b/exercises/01-composite-ui/before/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj index 54e3c583..c30c220c 100644 --- a/exercises/01-composite-ui/before/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj +++ b/exercises/01-composite-ui/before/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 enable diff --git a/exercises/01-composite-ui/before/Divergent.Customers.API/Divergent.Customers.API.csproj b/exercises/01-composite-ui/before/Divergent.Customers.API/Divergent.Customers.API.csproj index 319dfad1..58b7bc1e 100644 --- a/exercises/01-composite-ui/before/Divergent.Customers.API/Divergent.Customers.API.csproj +++ b/exercises/01-composite-ui/before/Divergent.Customers.API/Divergent.Customers.API.csproj @@ -2,7 +2,7 @@ latest - net7.0 + net8.0 enable diff --git a/exercises/01-composite-ui/before/Divergent.Customers.Data/Divergent.Customers.Data.csproj b/exercises/01-composite-ui/before/Divergent.Customers.Data/Divergent.Customers.Data.csproj index c2a43e03..a366e349 100644 --- a/exercises/01-composite-ui/before/Divergent.Customers.Data/Divergent.Customers.Data.csproj +++ b/exercises/01-composite-ui/before/Divergent.Customers.Data/Divergent.Customers.Data.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 diff --git a/exercises/01-composite-ui/before/Divergent.Customers.ViewModelComposition/Divergent.Customers.ViewModelComposition.csproj b/exercises/01-composite-ui/before/Divergent.Customers.ViewModelComposition/Divergent.Customers.ViewModelComposition.csproj index 06647932..6ec89002 100644 --- a/exercises/01-composite-ui/before/Divergent.Customers.ViewModelComposition/Divergent.Customers.ViewModelComposition.csproj +++ b/exercises/01-composite-ui/before/Divergent.Customers.ViewModelComposition/Divergent.Customers.ViewModelComposition.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 diff --git a/exercises/01-composite-ui/before/Divergent.Finance.API/Divergent.Finance.API.csproj b/exercises/01-composite-ui/before/Divergent.Finance.API/Divergent.Finance.API.csproj index 4c0f2c11..f548dc27 100644 --- a/exercises/01-composite-ui/before/Divergent.Finance.API/Divergent.Finance.API.csproj +++ b/exercises/01-composite-ui/before/Divergent.Finance.API/Divergent.Finance.API.csproj @@ -2,7 +2,7 @@ latest - net7.0 + net8.0 enable diff --git a/exercises/01-composite-ui/before/Divergent.Finance.Data/Divergent.Finance.Data.csproj b/exercises/01-composite-ui/before/Divergent.Finance.Data/Divergent.Finance.Data.csproj index f731948f..ac125a56 100644 --- a/exercises/01-composite-ui/before/Divergent.Finance.Data/Divergent.Finance.Data.csproj +++ b/exercises/01-composite-ui/before/Divergent.Finance.Data/Divergent.Finance.Data.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 diff --git a/exercises/01-composite-ui/before/Divergent.Finance.ViewModelComposition/Divergent.Finance.ViewModelComposition.csproj b/exercises/01-composite-ui/before/Divergent.Finance.ViewModelComposition/Divergent.Finance.ViewModelComposition.csproj index 06647932..6ec89002 100644 --- a/exercises/01-composite-ui/before/Divergent.Finance.ViewModelComposition/Divergent.Finance.ViewModelComposition.csproj +++ b/exercises/01-composite-ui/before/Divergent.Finance.ViewModelComposition/Divergent.Finance.ViewModelComposition.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 diff --git a/exercises/01-composite-ui/before/Divergent.Frontend/Divergent.Frontend.csproj b/exercises/01-composite-ui/before/Divergent.Frontend/Divergent.Frontend.csproj index e33b3c88..855715e4 100644 --- a/exercises/01-composite-ui/before/Divergent.Frontend/Divergent.Frontend.csproj +++ b/exercises/01-composite-ui/before/Divergent.Frontend/Divergent.Frontend.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 enable diff --git a/exercises/01-composite-ui/before/Divergent.Sales.API/Divergent.Sales.API.csproj b/exercises/01-composite-ui/before/Divergent.Sales.API/Divergent.Sales.API.csproj index 700fd8a4..b057d8ae 100644 --- a/exercises/01-composite-ui/before/Divergent.Sales.API/Divergent.Sales.API.csproj +++ b/exercises/01-composite-ui/before/Divergent.Sales.API/Divergent.Sales.API.csproj @@ -2,7 +2,7 @@ latest - net7.0 + net8.0 enable diff --git a/exercises/01-composite-ui/before/Divergent.Sales.Data/Divergent.Sales.Data.csproj b/exercises/01-composite-ui/before/Divergent.Sales.Data/Divergent.Sales.Data.csproj index 3c845765..8080aff7 100644 --- a/exercises/01-composite-ui/before/Divergent.Sales.Data/Divergent.Sales.Data.csproj +++ b/exercises/01-composite-ui/before/Divergent.Sales.Data/Divergent.Sales.Data.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 diff --git a/exercises/01-composite-ui/before/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj b/exercises/01-composite-ui/before/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj index 31b11046..1a0c6ec8 100644 --- a/exercises/01-composite-ui/before/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj +++ b/exercises/01-composite-ui/before/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 diff --git a/exercises/02-publish-subscribe/after/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj b/exercises/02-publish-subscribe/after/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj index 54e3c583..c30c220c 100644 --- a/exercises/02-publish-subscribe/after/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj +++ b/exercises/02-publish-subscribe/after/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 enable diff --git a/exercises/02-publish-subscribe/after/Divergent.Customers.API/Divergent.Customers.API.csproj b/exercises/02-publish-subscribe/after/Divergent.Customers.API/Divergent.Customers.API.csproj index 319dfad1..58b7bc1e 100644 --- a/exercises/02-publish-subscribe/after/Divergent.Customers.API/Divergent.Customers.API.csproj +++ b/exercises/02-publish-subscribe/after/Divergent.Customers.API/Divergent.Customers.API.csproj @@ -2,7 +2,7 @@ latest - net7.0 + net8.0 enable diff --git a/exercises/02-publish-subscribe/after/Divergent.Customers.Data/Divergent.Customers.Data.csproj b/exercises/02-publish-subscribe/after/Divergent.Customers.Data/Divergent.Customers.Data.csproj index c2a43e03..a366e349 100644 --- a/exercises/02-publish-subscribe/after/Divergent.Customers.Data/Divergent.Customers.Data.csproj +++ b/exercises/02-publish-subscribe/after/Divergent.Customers.Data/Divergent.Customers.Data.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 diff --git a/exercises/02-publish-subscribe/after/Divergent.Customers.ViewModelComposition/Divergent.Customers.ViewModelComposition.csproj b/exercises/02-publish-subscribe/after/Divergent.Customers.ViewModelComposition/Divergent.Customers.ViewModelComposition.csproj index 06647932..6ec89002 100644 --- a/exercises/02-publish-subscribe/after/Divergent.Customers.ViewModelComposition/Divergent.Customers.ViewModelComposition.csproj +++ b/exercises/02-publish-subscribe/after/Divergent.Customers.ViewModelComposition/Divergent.Customers.ViewModelComposition.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 diff --git a/exercises/02-publish-subscribe/after/Divergent.Customers/Divergent.Customers.csproj b/exercises/02-publish-subscribe/after/Divergent.Customers/Divergent.Customers.csproj index fde4e2b4..4d2dfd12 100644 --- a/exercises/02-publish-subscribe/after/Divergent.Customers/Divergent.Customers.csproj +++ b/exercises/02-publish-subscribe/after/Divergent.Customers/Divergent.Customers.csproj @@ -2,7 +2,7 @@ latest - net7.0 + net8.0 enable diff --git a/exercises/02-publish-subscribe/after/Divergent.Finance.API/Divergent.Finance.API.csproj b/exercises/02-publish-subscribe/after/Divergent.Finance.API/Divergent.Finance.API.csproj index 4c0f2c11..f548dc27 100644 --- a/exercises/02-publish-subscribe/after/Divergent.Finance.API/Divergent.Finance.API.csproj +++ b/exercises/02-publish-subscribe/after/Divergent.Finance.API/Divergent.Finance.API.csproj @@ -2,7 +2,7 @@ latest - net7.0 + net8.0 enable diff --git a/exercises/02-publish-subscribe/after/Divergent.Finance.Data/Divergent.Finance.Data.csproj b/exercises/02-publish-subscribe/after/Divergent.Finance.Data/Divergent.Finance.Data.csproj index f731948f..ac125a56 100644 --- a/exercises/02-publish-subscribe/after/Divergent.Finance.Data/Divergent.Finance.Data.csproj +++ b/exercises/02-publish-subscribe/after/Divergent.Finance.Data/Divergent.Finance.Data.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 diff --git a/exercises/02-publish-subscribe/after/Divergent.Finance.ViewModelComposition/Divergent.Finance.ViewModelComposition.csproj b/exercises/02-publish-subscribe/after/Divergent.Finance.ViewModelComposition/Divergent.Finance.ViewModelComposition.csproj index 06647932..6ec89002 100644 --- a/exercises/02-publish-subscribe/after/Divergent.Finance.ViewModelComposition/Divergent.Finance.ViewModelComposition.csproj +++ b/exercises/02-publish-subscribe/after/Divergent.Finance.ViewModelComposition/Divergent.Finance.ViewModelComposition.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 diff --git a/exercises/02-publish-subscribe/after/Divergent.Finance/Divergent.Finance.csproj b/exercises/02-publish-subscribe/after/Divergent.Finance/Divergent.Finance.csproj index 2d0a2d0c..390f91e0 100644 --- a/exercises/02-publish-subscribe/after/Divergent.Finance/Divergent.Finance.csproj +++ b/exercises/02-publish-subscribe/after/Divergent.Finance/Divergent.Finance.csproj @@ -2,7 +2,7 @@ latest - net7.0 + net8.0 enable diff --git a/exercises/02-publish-subscribe/after/Divergent.Frontend/Divergent.Frontend.csproj b/exercises/02-publish-subscribe/after/Divergent.Frontend/Divergent.Frontend.csproj index e33b3c88..855715e4 100644 --- a/exercises/02-publish-subscribe/after/Divergent.Frontend/Divergent.Frontend.csproj +++ b/exercises/02-publish-subscribe/after/Divergent.Frontend/Divergent.Frontend.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 enable diff --git a/exercises/02-publish-subscribe/after/Divergent.Sales.API/Divergent.Sales.API.csproj b/exercises/02-publish-subscribe/after/Divergent.Sales.API/Divergent.Sales.API.csproj index f4f5da2e..07ddfb46 100644 --- a/exercises/02-publish-subscribe/after/Divergent.Sales.API/Divergent.Sales.API.csproj +++ b/exercises/02-publish-subscribe/after/Divergent.Sales.API/Divergent.Sales.API.csproj @@ -2,7 +2,7 @@ latest - net7.0 + net8.0 enable diff --git a/exercises/02-publish-subscribe/after/Divergent.Sales.Data/Divergent.Sales.Data.csproj b/exercises/02-publish-subscribe/after/Divergent.Sales.Data/Divergent.Sales.Data.csproj index 3c845765..8080aff7 100644 --- a/exercises/02-publish-subscribe/after/Divergent.Sales.Data/Divergent.Sales.Data.csproj +++ b/exercises/02-publish-subscribe/after/Divergent.Sales.Data/Divergent.Sales.Data.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 diff --git a/exercises/02-publish-subscribe/after/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj b/exercises/02-publish-subscribe/after/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj index 31b11046..1a0c6ec8 100644 --- a/exercises/02-publish-subscribe/after/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj +++ b/exercises/02-publish-subscribe/after/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 diff --git a/exercises/02-publish-subscribe/after/Divergent.Sales/Divergent.Sales.csproj b/exercises/02-publish-subscribe/after/Divergent.Sales/Divergent.Sales.csproj index 9ea9a075..25c3099a 100644 --- a/exercises/02-publish-subscribe/after/Divergent.Sales/Divergent.Sales.csproj +++ b/exercises/02-publish-subscribe/after/Divergent.Sales/Divergent.Sales.csproj @@ -2,7 +2,7 @@ latest - net7.0 + net8.0 enable diff --git a/exercises/02-publish-subscribe/after/Divergent.Shipping/Divergent.Shipping.csproj b/exercises/02-publish-subscribe/after/Divergent.Shipping/Divergent.Shipping.csproj index 4a4df565..e109bddb 100644 --- a/exercises/02-publish-subscribe/after/Divergent.Shipping/Divergent.Shipping.csproj +++ b/exercises/02-publish-subscribe/after/Divergent.Shipping/Divergent.Shipping.csproj @@ -2,7 +2,7 @@ latest - net7.0 + net8.0 enable diff --git a/exercises/02-publish-subscribe/after/externalsystems/MastercardPaymentProvider/PaymentProviders.csproj b/exercises/02-publish-subscribe/after/externalsystems/MastercardPaymentProvider/PaymentProviders.csproj index d4421016..696531d6 100644 --- a/exercises/02-publish-subscribe/after/externalsystems/MastercardPaymentProvider/PaymentProviders.csproj +++ b/exercises/02-publish-subscribe/after/externalsystems/MastercardPaymentProvider/PaymentProviders.csproj @@ -3,7 +3,7 @@ latest Exe - net7.0 + net8.0 enable diff --git a/exercises/02-publish-subscribe/before/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj b/exercises/02-publish-subscribe/before/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj index 54e3c583..c30c220c 100644 --- a/exercises/02-publish-subscribe/before/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj +++ b/exercises/02-publish-subscribe/before/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 enable diff --git a/exercises/02-publish-subscribe/before/Divergent.Customers.API/Divergent.Customers.API.csproj b/exercises/02-publish-subscribe/before/Divergent.Customers.API/Divergent.Customers.API.csproj index 319dfad1..58b7bc1e 100644 --- a/exercises/02-publish-subscribe/before/Divergent.Customers.API/Divergent.Customers.API.csproj +++ b/exercises/02-publish-subscribe/before/Divergent.Customers.API/Divergent.Customers.API.csproj @@ -2,7 +2,7 @@ latest - net7.0 + net8.0 enable diff --git a/exercises/02-publish-subscribe/before/Divergent.Customers.Data/Divergent.Customers.Data.csproj b/exercises/02-publish-subscribe/before/Divergent.Customers.Data/Divergent.Customers.Data.csproj index c2a43e03..a366e349 100644 --- a/exercises/02-publish-subscribe/before/Divergent.Customers.Data/Divergent.Customers.Data.csproj +++ b/exercises/02-publish-subscribe/before/Divergent.Customers.Data/Divergent.Customers.Data.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 diff --git a/exercises/02-publish-subscribe/before/Divergent.Customers.ViewModelComposition/Divergent.Customers.ViewModelComposition.csproj b/exercises/02-publish-subscribe/before/Divergent.Customers.ViewModelComposition/Divergent.Customers.ViewModelComposition.csproj index 06647932..6ec89002 100644 --- a/exercises/02-publish-subscribe/before/Divergent.Customers.ViewModelComposition/Divergent.Customers.ViewModelComposition.csproj +++ b/exercises/02-publish-subscribe/before/Divergent.Customers.ViewModelComposition/Divergent.Customers.ViewModelComposition.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 diff --git a/exercises/02-publish-subscribe/before/Divergent.Customers/Divergent.Customers.csproj b/exercises/02-publish-subscribe/before/Divergent.Customers/Divergent.Customers.csproj index fde4e2b4..4d2dfd12 100644 --- a/exercises/02-publish-subscribe/before/Divergent.Customers/Divergent.Customers.csproj +++ b/exercises/02-publish-subscribe/before/Divergent.Customers/Divergent.Customers.csproj @@ -2,7 +2,7 @@ latest - net7.0 + net8.0 enable diff --git a/exercises/02-publish-subscribe/before/Divergent.Finance.API/Divergent.Finance.API.csproj b/exercises/02-publish-subscribe/before/Divergent.Finance.API/Divergent.Finance.API.csproj index 4c0f2c11..f548dc27 100644 --- a/exercises/02-publish-subscribe/before/Divergent.Finance.API/Divergent.Finance.API.csproj +++ b/exercises/02-publish-subscribe/before/Divergent.Finance.API/Divergent.Finance.API.csproj @@ -2,7 +2,7 @@ latest - net7.0 + net8.0 enable diff --git a/exercises/02-publish-subscribe/before/Divergent.Finance.Data/Divergent.Finance.Data.csproj b/exercises/02-publish-subscribe/before/Divergent.Finance.Data/Divergent.Finance.Data.csproj index f731948f..ac125a56 100644 --- a/exercises/02-publish-subscribe/before/Divergent.Finance.Data/Divergent.Finance.Data.csproj +++ b/exercises/02-publish-subscribe/before/Divergent.Finance.Data/Divergent.Finance.Data.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 diff --git a/exercises/02-publish-subscribe/before/Divergent.Finance.ViewModelComposition/Divergent.Finance.ViewModelComposition.csproj b/exercises/02-publish-subscribe/before/Divergent.Finance.ViewModelComposition/Divergent.Finance.ViewModelComposition.csproj index 06647932..6ec89002 100644 --- a/exercises/02-publish-subscribe/before/Divergent.Finance.ViewModelComposition/Divergent.Finance.ViewModelComposition.csproj +++ b/exercises/02-publish-subscribe/before/Divergent.Finance.ViewModelComposition/Divergent.Finance.ViewModelComposition.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 diff --git a/exercises/02-publish-subscribe/before/Divergent.Finance/Divergent.Finance.csproj b/exercises/02-publish-subscribe/before/Divergent.Finance/Divergent.Finance.csproj index 2d0a2d0c..390f91e0 100644 --- a/exercises/02-publish-subscribe/before/Divergent.Finance/Divergent.Finance.csproj +++ b/exercises/02-publish-subscribe/before/Divergent.Finance/Divergent.Finance.csproj @@ -2,7 +2,7 @@ latest - net7.0 + net8.0 enable diff --git a/exercises/02-publish-subscribe/before/Divergent.Frontend/Divergent.Frontend.csproj b/exercises/02-publish-subscribe/before/Divergent.Frontend/Divergent.Frontend.csproj index e33b3c88..855715e4 100644 --- a/exercises/02-publish-subscribe/before/Divergent.Frontend/Divergent.Frontend.csproj +++ b/exercises/02-publish-subscribe/before/Divergent.Frontend/Divergent.Frontend.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 enable diff --git a/exercises/02-publish-subscribe/before/Divergent.Sales.API/Divergent.Sales.API.csproj b/exercises/02-publish-subscribe/before/Divergent.Sales.API/Divergent.Sales.API.csproj index f4f5da2e..07ddfb46 100644 --- a/exercises/02-publish-subscribe/before/Divergent.Sales.API/Divergent.Sales.API.csproj +++ b/exercises/02-publish-subscribe/before/Divergent.Sales.API/Divergent.Sales.API.csproj @@ -2,7 +2,7 @@ latest - net7.0 + net8.0 enable diff --git a/exercises/02-publish-subscribe/before/Divergent.Sales.Data/Divergent.Sales.Data.csproj b/exercises/02-publish-subscribe/before/Divergent.Sales.Data/Divergent.Sales.Data.csproj index 3c845765..8080aff7 100644 --- a/exercises/02-publish-subscribe/before/Divergent.Sales.Data/Divergent.Sales.Data.csproj +++ b/exercises/02-publish-subscribe/before/Divergent.Sales.Data/Divergent.Sales.Data.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 diff --git a/exercises/02-publish-subscribe/before/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj b/exercises/02-publish-subscribe/before/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj index 31b11046..1a0c6ec8 100644 --- a/exercises/02-publish-subscribe/before/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj +++ b/exercises/02-publish-subscribe/before/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 diff --git a/exercises/02-publish-subscribe/before/Divergent.Sales/Divergent.Sales.csproj b/exercises/02-publish-subscribe/before/Divergent.Sales/Divergent.Sales.csproj index 9ea9a075..25c3099a 100644 --- a/exercises/02-publish-subscribe/before/Divergent.Sales/Divergent.Sales.csproj +++ b/exercises/02-publish-subscribe/before/Divergent.Sales/Divergent.Sales.csproj @@ -2,7 +2,7 @@ latest - net7.0 + net8.0 enable diff --git a/exercises/02-publish-subscribe/before/Divergent.Shipping/Divergent.Shipping.csproj b/exercises/02-publish-subscribe/before/Divergent.Shipping/Divergent.Shipping.csproj index 4a4df565..e109bddb 100644 --- a/exercises/02-publish-subscribe/before/Divergent.Shipping/Divergent.Shipping.csproj +++ b/exercises/02-publish-subscribe/before/Divergent.Shipping/Divergent.Shipping.csproj @@ -2,7 +2,7 @@ latest - net7.0 + net8.0 enable diff --git a/exercises/02-publish-subscribe/before/externalsystems/MastercardPaymentProvider/PaymentProviders.csproj b/exercises/02-publish-subscribe/before/externalsystems/MastercardPaymentProvider/PaymentProviders.csproj index d4421016..696531d6 100644 --- a/exercises/02-publish-subscribe/before/externalsystems/MastercardPaymentProvider/PaymentProviders.csproj +++ b/exercises/02-publish-subscribe/before/externalsystems/MastercardPaymentProvider/PaymentProviders.csproj @@ -3,7 +3,7 @@ latest Exe - net7.0 + net8.0 enable diff --git a/exercises/03-sagas/after/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj b/exercises/03-sagas/after/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj index 54e3c583..c30c220c 100644 --- a/exercises/03-sagas/after/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj +++ b/exercises/03-sagas/after/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 enable diff --git a/exercises/03-sagas/after/Divergent.Customers.API/Divergent.Customers.API.csproj b/exercises/03-sagas/after/Divergent.Customers.API/Divergent.Customers.API.csproj index 319dfad1..58b7bc1e 100644 --- a/exercises/03-sagas/after/Divergent.Customers.API/Divergent.Customers.API.csproj +++ b/exercises/03-sagas/after/Divergent.Customers.API/Divergent.Customers.API.csproj @@ -2,7 +2,7 @@ latest - net7.0 + net8.0 enable diff --git a/exercises/03-sagas/after/Divergent.Customers.Data/Divergent.Customers.Data.csproj b/exercises/03-sagas/after/Divergent.Customers.Data/Divergent.Customers.Data.csproj index c2a43e03..a366e349 100644 --- a/exercises/03-sagas/after/Divergent.Customers.Data/Divergent.Customers.Data.csproj +++ b/exercises/03-sagas/after/Divergent.Customers.Data/Divergent.Customers.Data.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 diff --git a/exercises/03-sagas/after/Divergent.Customers.ViewModelComposition/Divergent.Customers.ViewModelComposition.csproj b/exercises/03-sagas/after/Divergent.Customers.ViewModelComposition/Divergent.Customers.ViewModelComposition.csproj index 06647932..6ec89002 100644 --- a/exercises/03-sagas/after/Divergent.Customers.ViewModelComposition/Divergent.Customers.ViewModelComposition.csproj +++ b/exercises/03-sagas/after/Divergent.Customers.ViewModelComposition/Divergent.Customers.ViewModelComposition.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 diff --git a/exercises/03-sagas/after/Divergent.Customers/Divergent.Customers.csproj b/exercises/03-sagas/after/Divergent.Customers/Divergent.Customers.csproj index fde4e2b4..4d2dfd12 100644 --- a/exercises/03-sagas/after/Divergent.Customers/Divergent.Customers.csproj +++ b/exercises/03-sagas/after/Divergent.Customers/Divergent.Customers.csproj @@ -2,7 +2,7 @@ latest - net7.0 + net8.0 enable diff --git a/exercises/03-sagas/after/Divergent.Finance.API/Divergent.Finance.API.csproj b/exercises/03-sagas/after/Divergent.Finance.API/Divergent.Finance.API.csproj index 4c0f2c11..f548dc27 100644 --- a/exercises/03-sagas/after/Divergent.Finance.API/Divergent.Finance.API.csproj +++ b/exercises/03-sagas/after/Divergent.Finance.API/Divergent.Finance.API.csproj @@ -2,7 +2,7 @@ latest - net7.0 + net8.0 enable diff --git a/exercises/03-sagas/after/Divergent.Finance.Data/Divergent.Finance.Data.csproj b/exercises/03-sagas/after/Divergent.Finance.Data/Divergent.Finance.Data.csproj index f731948f..ac125a56 100644 --- a/exercises/03-sagas/after/Divergent.Finance.Data/Divergent.Finance.Data.csproj +++ b/exercises/03-sagas/after/Divergent.Finance.Data/Divergent.Finance.Data.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 diff --git a/exercises/03-sagas/after/Divergent.Finance.ViewModelComposition/Divergent.Finance.ViewModelComposition.csproj b/exercises/03-sagas/after/Divergent.Finance.ViewModelComposition/Divergent.Finance.ViewModelComposition.csproj index 06647932..6ec89002 100644 --- a/exercises/03-sagas/after/Divergent.Finance.ViewModelComposition/Divergent.Finance.ViewModelComposition.csproj +++ b/exercises/03-sagas/after/Divergent.Finance.ViewModelComposition/Divergent.Finance.ViewModelComposition.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 diff --git a/exercises/03-sagas/after/Divergent.Finance/Divergent.Finance.csproj b/exercises/03-sagas/after/Divergent.Finance/Divergent.Finance.csproj index 2d0a2d0c..390f91e0 100644 --- a/exercises/03-sagas/after/Divergent.Finance/Divergent.Finance.csproj +++ b/exercises/03-sagas/after/Divergent.Finance/Divergent.Finance.csproj @@ -2,7 +2,7 @@ latest - net7.0 + net8.0 enable diff --git a/exercises/03-sagas/after/Divergent.Frontend/Divergent.Frontend.csproj b/exercises/03-sagas/after/Divergent.Frontend/Divergent.Frontend.csproj index e33b3c88..855715e4 100644 --- a/exercises/03-sagas/after/Divergent.Frontend/Divergent.Frontend.csproj +++ b/exercises/03-sagas/after/Divergent.Frontend/Divergent.Frontend.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 enable diff --git a/exercises/03-sagas/after/Divergent.Sales.API/Divergent.Sales.API.csproj b/exercises/03-sagas/after/Divergent.Sales.API/Divergent.Sales.API.csproj index f4f5da2e..07ddfb46 100644 --- a/exercises/03-sagas/after/Divergent.Sales.API/Divergent.Sales.API.csproj +++ b/exercises/03-sagas/after/Divergent.Sales.API/Divergent.Sales.API.csproj @@ -2,7 +2,7 @@ latest - net7.0 + net8.0 enable diff --git a/exercises/03-sagas/after/Divergent.Sales.Data/Divergent.Sales.Data.csproj b/exercises/03-sagas/after/Divergent.Sales.Data/Divergent.Sales.Data.csproj index 3c845765..8080aff7 100644 --- a/exercises/03-sagas/after/Divergent.Sales.Data/Divergent.Sales.Data.csproj +++ b/exercises/03-sagas/after/Divergent.Sales.Data/Divergent.Sales.Data.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 diff --git a/exercises/03-sagas/after/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj b/exercises/03-sagas/after/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj index 31b11046..1a0c6ec8 100644 --- a/exercises/03-sagas/after/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj +++ b/exercises/03-sagas/after/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 diff --git a/exercises/03-sagas/after/Divergent.Sales/Divergent.Sales.csproj b/exercises/03-sagas/after/Divergent.Sales/Divergent.Sales.csproj index 9ea9a075..25c3099a 100644 --- a/exercises/03-sagas/after/Divergent.Sales/Divergent.Sales.csproj +++ b/exercises/03-sagas/after/Divergent.Sales/Divergent.Sales.csproj @@ -2,7 +2,7 @@ latest - net7.0 + net8.0 enable diff --git a/exercises/03-sagas/after/Divergent.Shipping/Divergent.Shipping.csproj b/exercises/03-sagas/after/Divergent.Shipping/Divergent.Shipping.csproj index 4a4df565..e109bddb 100644 --- a/exercises/03-sagas/after/Divergent.Shipping/Divergent.Shipping.csproj +++ b/exercises/03-sagas/after/Divergent.Shipping/Divergent.Shipping.csproj @@ -2,7 +2,7 @@ latest - net7.0 + net8.0 enable diff --git a/exercises/03-sagas/after/externalsystems/MastercardPaymentProvider/PaymentProviders.csproj b/exercises/03-sagas/after/externalsystems/MastercardPaymentProvider/PaymentProviders.csproj index d4421016..696531d6 100644 --- a/exercises/03-sagas/after/externalsystems/MastercardPaymentProvider/PaymentProviders.csproj +++ b/exercises/03-sagas/after/externalsystems/MastercardPaymentProvider/PaymentProviders.csproj @@ -3,7 +3,7 @@ latest Exe - net7.0 + net8.0 enable diff --git a/exercises/03-sagas/before/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj b/exercises/03-sagas/before/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj index 54e3c583..c30c220c 100644 --- a/exercises/03-sagas/before/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj +++ b/exercises/03-sagas/before/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 enable diff --git a/exercises/03-sagas/before/Divergent.Customers.API/Divergent.Customers.API.csproj b/exercises/03-sagas/before/Divergent.Customers.API/Divergent.Customers.API.csproj index 319dfad1..58b7bc1e 100644 --- a/exercises/03-sagas/before/Divergent.Customers.API/Divergent.Customers.API.csproj +++ b/exercises/03-sagas/before/Divergent.Customers.API/Divergent.Customers.API.csproj @@ -2,7 +2,7 @@ latest - net7.0 + net8.0 enable diff --git a/exercises/03-sagas/before/Divergent.Customers.Data/Divergent.Customers.Data.csproj b/exercises/03-sagas/before/Divergent.Customers.Data/Divergent.Customers.Data.csproj index c2a43e03..a366e349 100644 --- a/exercises/03-sagas/before/Divergent.Customers.Data/Divergent.Customers.Data.csproj +++ b/exercises/03-sagas/before/Divergent.Customers.Data/Divergent.Customers.Data.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 diff --git a/exercises/03-sagas/before/Divergent.Customers.ViewModelComposition/Divergent.Customers.ViewModelComposition.csproj b/exercises/03-sagas/before/Divergent.Customers.ViewModelComposition/Divergent.Customers.ViewModelComposition.csproj index 06647932..6ec89002 100644 --- a/exercises/03-sagas/before/Divergent.Customers.ViewModelComposition/Divergent.Customers.ViewModelComposition.csproj +++ b/exercises/03-sagas/before/Divergent.Customers.ViewModelComposition/Divergent.Customers.ViewModelComposition.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 diff --git a/exercises/03-sagas/before/Divergent.Customers/Divergent.Customers.csproj b/exercises/03-sagas/before/Divergent.Customers/Divergent.Customers.csproj index fde4e2b4..4d2dfd12 100644 --- a/exercises/03-sagas/before/Divergent.Customers/Divergent.Customers.csproj +++ b/exercises/03-sagas/before/Divergent.Customers/Divergent.Customers.csproj @@ -2,7 +2,7 @@ latest - net7.0 + net8.0 enable diff --git a/exercises/03-sagas/before/Divergent.Finance.API/Divergent.Finance.API.csproj b/exercises/03-sagas/before/Divergent.Finance.API/Divergent.Finance.API.csproj index 4c0f2c11..f548dc27 100644 --- a/exercises/03-sagas/before/Divergent.Finance.API/Divergent.Finance.API.csproj +++ b/exercises/03-sagas/before/Divergent.Finance.API/Divergent.Finance.API.csproj @@ -2,7 +2,7 @@ latest - net7.0 + net8.0 enable diff --git a/exercises/03-sagas/before/Divergent.Finance.Data/Divergent.Finance.Data.csproj b/exercises/03-sagas/before/Divergent.Finance.Data/Divergent.Finance.Data.csproj index f731948f..ac125a56 100644 --- a/exercises/03-sagas/before/Divergent.Finance.Data/Divergent.Finance.Data.csproj +++ b/exercises/03-sagas/before/Divergent.Finance.Data/Divergent.Finance.Data.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 diff --git a/exercises/03-sagas/before/Divergent.Finance.ViewModelComposition/Divergent.Finance.ViewModelComposition.csproj b/exercises/03-sagas/before/Divergent.Finance.ViewModelComposition/Divergent.Finance.ViewModelComposition.csproj index 06647932..6ec89002 100644 --- a/exercises/03-sagas/before/Divergent.Finance.ViewModelComposition/Divergent.Finance.ViewModelComposition.csproj +++ b/exercises/03-sagas/before/Divergent.Finance.ViewModelComposition/Divergent.Finance.ViewModelComposition.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 diff --git a/exercises/03-sagas/before/Divergent.Finance/Divergent.Finance.csproj b/exercises/03-sagas/before/Divergent.Finance/Divergent.Finance.csproj index 2d0a2d0c..390f91e0 100644 --- a/exercises/03-sagas/before/Divergent.Finance/Divergent.Finance.csproj +++ b/exercises/03-sagas/before/Divergent.Finance/Divergent.Finance.csproj @@ -2,7 +2,7 @@ latest - net7.0 + net8.0 enable diff --git a/exercises/03-sagas/before/Divergent.Frontend/Divergent.Frontend.csproj b/exercises/03-sagas/before/Divergent.Frontend/Divergent.Frontend.csproj index e33b3c88..855715e4 100644 --- a/exercises/03-sagas/before/Divergent.Frontend/Divergent.Frontend.csproj +++ b/exercises/03-sagas/before/Divergent.Frontend/Divergent.Frontend.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 enable diff --git a/exercises/03-sagas/before/Divergent.Sales.API/Divergent.Sales.API.csproj b/exercises/03-sagas/before/Divergent.Sales.API/Divergent.Sales.API.csproj index f4f5da2e..07ddfb46 100644 --- a/exercises/03-sagas/before/Divergent.Sales.API/Divergent.Sales.API.csproj +++ b/exercises/03-sagas/before/Divergent.Sales.API/Divergent.Sales.API.csproj @@ -2,7 +2,7 @@ latest - net7.0 + net8.0 enable diff --git a/exercises/03-sagas/before/Divergent.Sales.Data/Divergent.Sales.Data.csproj b/exercises/03-sagas/before/Divergent.Sales.Data/Divergent.Sales.Data.csproj index 3c845765..8080aff7 100644 --- a/exercises/03-sagas/before/Divergent.Sales.Data/Divergent.Sales.Data.csproj +++ b/exercises/03-sagas/before/Divergent.Sales.Data/Divergent.Sales.Data.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 diff --git a/exercises/03-sagas/before/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj b/exercises/03-sagas/before/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj index 31b11046..1a0c6ec8 100644 --- a/exercises/03-sagas/before/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj +++ b/exercises/03-sagas/before/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 diff --git a/exercises/03-sagas/before/Divergent.Sales/Divergent.Sales.csproj b/exercises/03-sagas/before/Divergent.Sales/Divergent.Sales.csproj index 9ea9a075..25c3099a 100644 --- a/exercises/03-sagas/before/Divergent.Sales/Divergent.Sales.csproj +++ b/exercises/03-sagas/before/Divergent.Sales/Divergent.Sales.csproj @@ -2,7 +2,7 @@ latest - net7.0 + net8.0 enable diff --git a/exercises/03-sagas/before/Divergent.Shipping/Divergent.Shipping.csproj b/exercises/03-sagas/before/Divergent.Shipping/Divergent.Shipping.csproj index 4a4df565..e109bddb 100644 --- a/exercises/03-sagas/before/Divergent.Shipping/Divergent.Shipping.csproj +++ b/exercises/03-sagas/before/Divergent.Shipping/Divergent.Shipping.csproj @@ -2,7 +2,7 @@ latest - net7.0 + net8.0 enable diff --git a/exercises/03-sagas/before/externalsystems/MastercardPaymentProvider/PaymentProviders.csproj b/exercises/03-sagas/before/externalsystems/MastercardPaymentProvider/PaymentProviders.csproj index d4421016..696531d6 100644 --- a/exercises/03-sagas/before/externalsystems/MastercardPaymentProvider/PaymentProviders.csproj +++ b/exercises/03-sagas/before/externalsystems/MastercardPaymentProvider/PaymentProviders.csproj @@ -3,7 +3,7 @@ latest Exe - net7.0 + net8.0 enable diff --git a/exercises/04-integration/after/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj b/exercises/04-integration/after/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj index 54e3c583..c30c220c 100644 --- a/exercises/04-integration/after/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj +++ b/exercises/04-integration/after/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 enable diff --git a/exercises/04-integration/after/Divergent.Customers.API/Divergent.Customers.API.csproj b/exercises/04-integration/after/Divergent.Customers.API/Divergent.Customers.API.csproj index 319dfad1..58b7bc1e 100644 --- a/exercises/04-integration/after/Divergent.Customers.API/Divergent.Customers.API.csproj +++ b/exercises/04-integration/after/Divergent.Customers.API/Divergent.Customers.API.csproj @@ -2,7 +2,7 @@ latest - net7.0 + net8.0 enable diff --git a/exercises/04-integration/after/Divergent.Customers.Data/Divergent.Customers.Data.csproj b/exercises/04-integration/after/Divergent.Customers.Data/Divergent.Customers.Data.csproj index 4ade2685..c9002a8a 100644 --- a/exercises/04-integration/after/Divergent.Customers.Data/Divergent.Customers.Data.csproj +++ b/exercises/04-integration/after/Divergent.Customers.Data/Divergent.Customers.Data.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 diff --git a/exercises/04-integration/after/Divergent.Customers.ViewModelComposition/Divergent.Customers.ViewModelComposition.csproj b/exercises/04-integration/after/Divergent.Customers.ViewModelComposition/Divergent.Customers.ViewModelComposition.csproj index 06647932..6ec89002 100644 --- a/exercises/04-integration/after/Divergent.Customers.ViewModelComposition/Divergent.Customers.ViewModelComposition.csproj +++ b/exercises/04-integration/after/Divergent.Customers.ViewModelComposition/Divergent.Customers.ViewModelComposition.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 diff --git a/exercises/04-integration/after/Divergent.Customers/Divergent.Customers.csproj b/exercises/04-integration/after/Divergent.Customers/Divergent.Customers.csproj index fde4e2b4..4d2dfd12 100644 --- a/exercises/04-integration/after/Divergent.Customers/Divergent.Customers.csproj +++ b/exercises/04-integration/after/Divergent.Customers/Divergent.Customers.csproj @@ -2,7 +2,7 @@ latest - net7.0 + net8.0 enable diff --git a/exercises/04-integration/after/Divergent.Finance.API/Divergent.Finance.API.csproj b/exercises/04-integration/after/Divergent.Finance.API/Divergent.Finance.API.csproj index 4c0f2c11..f548dc27 100644 --- a/exercises/04-integration/after/Divergent.Finance.API/Divergent.Finance.API.csproj +++ b/exercises/04-integration/after/Divergent.Finance.API/Divergent.Finance.API.csproj @@ -2,7 +2,7 @@ latest - net7.0 + net8.0 enable diff --git a/exercises/04-integration/after/Divergent.Finance.Data/Divergent.Finance.Data.csproj b/exercises/04-integration/after/Divergent.Finance.Data/Divergent.Finance.Data.csproj index f731948f..ac125a56 100644 --- a/exercises/04-integration/after/Divergent.Finance.Data/Divergent.Finance.Data.csproj +++ b/exercises/04-integration/after/Divergent.Finance.Data/Divergent.Finance.Data.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 diff --git a/exercises/04-integration/after/Divergent.Finance.ViewModelComposition/Divergent.Finance.ViewModelComposition.csproj b/exercises/04-integration/after/Divergent.Finance.ViewModelComposition/Divergent.Finance.ViewModelComposition.csproj index 06647932..6ec89002 100644 --- a/exercises/04-integration/after/Divergent.Finance.ViewModelComposition/Divergent.Finance.ViewModelComposition.csproj +++ b/exercises/04-integration/after/Divergent.Finance.ViewModelComposition/Divergent.Finance.ViewModelComposition.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 diff --git a/exercises/04-integration/after/Divergent.Finance/Divergent.Finance.csproj b/exercises/04-integration/after/Divergent.Finance/Divergent.Finance.csproj index 2d0a2d0c..390f91e0 100644 --- a/exercises/04-integration/after/Divergent.Finance/Divergent.Finance.csproj +++ b/exercises/04-integration/after/Divergent.Finance/Divergent.Finance.csproj @@ -2,7 +2,7 @@ latest - net7.0 + net8.0 enable diff --git a/exercises/04-integration/after/Divergent.Frontend/Divergent.Frontend.csproj b/exercises/04-integration/after/Divergent.Frontend/Divergent.Frontend.csproj index e33b3c88..855715e4 100644 --- a/exercises/04-integration/after/Divergent.Frontend/Divergent.Frontend.csproj +++ b/exercises/04-integration/after/Divergent.Frontend/Divergent.Frontend.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 enable diff --git a/exercises/04-integration/after/Divergent.ITOps/Divergent.ITOps.csproj b/exercises/04-integration/after/Divergent.ITOps/Divergent.ITOps.csproj index 81e48833..28201bab 100644 --- a/exercises/04-integration/after/Divergent.ITOps/Divergent.ITOps.csproj +++ b/exercises/04-integration/after/Divergent.ITOps/Divergent.ITOps.csproj @@ -2,7 +2,7 @@ latest - net7.0 + net8.0 enable diff --git a/exercises/04-integration/after/Divergent.Sales.API/Divergent.Sales.API.csproj b/exercises/04-integration/after/Divergent.Sales.API/Divergent.Sales.API.csproj index f4f5da2e..07ddfb46 100644 --- a/exercises/04-integration/after/Divergent.Sales.API/Divergent.Sales.API.csproj +++ b/exercises/04-integration/after/Divergent.Sales.API/Divergent.Sales.API.csproj @@ -2,7 +2,7 @@ latest - net7.0 + net8.0 enable diff --git a/exercises/04-integration/after/Divergent.Sales.Data/Divergent.Sales.Data.csproj b/exercises/04-integration/after/Divergent.Sales.Data/Divergent.Sales.Data.csproj index 3c845765..8080aff7 100644 --- a/exercises/04-integration/after/Divergent.Sales.Data/Divergent.Sales.Data.csproj +++ b/exercises/04-integration/after/Divergent.Sales.Data/Divergent.Sales.Data.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 diff --git a/exercises/04-integration/after/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj b/exercises/04-integration/after/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj index 31b11046..1a0c6ec8 100644 --- a/exercises/04-integration/after/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj +++ b/exercises/04-integration/after/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 diff --git a/exercises/04-integration/after/Divergent.Sales/Divergent.Sales.csproj b/exercises/04-integration/after/Divergent.Sales/Divergent.Sales.csproj index 9ea9a075..25c3099a 100644 --- a/exercises/04-integration/after/Divergent.Sales/Divergent.Sales.csproj +++ b/exercises/04-integration/after/Divergent.Sales/Divergent.Sales.csproj @@ -2,7 +2,7 @@ latest - net7.0 + net8.0 enable diff --git a/exercises/04-integration/after/Divergent.Shipping/Divergent.Shipping.csproj b/exercises/04-integration/after/Divergent.Shipping/Divergent.Shipping.csproj index d9c35a7a..f89f1f25 100644 --- a/exercises/04-integration/after/Divergent.Shipping/Divergent.Shipping.csproj +++ b/exercises/04-integration/after/Divergent.Shipping/Divergent.Shipping.csproj @@ -2,7 +2,7 @@ latest - net7.0 + net8.0 enable diff --git a/exercises/04-integration/after/externalsystems/MastercardPaymentProvider/PaymentProviders.csproj b/exercises/04-integration/after/externalsystems/MastercardPaymentProvider/PaymentProviders.csproj index d4421016..696531d6 100644 --- a/exercises/04-integration/after/externalsystems/MastercardPaymentProvider/PaymentProviders.csproj +++ b/exercises/04-integration/after/externalsystems/MastercardPaymentProvider/PaymentProviders.csproj @@ -3,7 +3,7 @@ latest Exe - net7.0 + net8.0 enable diff --git a/exercises/04-integration/before/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj b/exercises/04-integration/before/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj index 54e3c583..c30c220c 100644 --- a/exercises/04-integration/before/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj +++ b/exercises/04-integration/before/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 enable diff --git a/exercises/04-integration/before/Divergent.Customers.API/Divergent.Customers.API.csproj b/exercises/04-integration/before/Divergent.Customers.API/Divergent.Customers.API.csproj index 319dfad1..58b7bc1e 100644 --- a/exercises/04-integration/before/Divergent.Customers.API/Divergent.Customers.API.csproj +++ b/exercises/04-integration/before/Divergent.Customers.API/Divergent.Customers.API.csproj @@ -2,7 +2,7 @@ latest - net7.0 + net8.0 enable diff --git a/exercises/04-integration/before/Divergent.Customers.Data/Divergent.Customers.Data.csproj b/exercises/04-integration/before/Divergent.Customers.Data/Divergent.Customers.Data.csproj index 4ade2685..c9002a8a 100644 --- a/exercises/04-integration/before/Divergent.Customers.Data/Divergent.Customers.Data.csproj +++ b/exercises/04-integration/before/Divergent.Customers.Data/Divergent.Customers.Data.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 diff --git a/exercises/04-integration/before/Divergent.Customers.ViewModelComposition/Divergent.Customers.ViewModelComposition.csproj b/exercises/04-integration/before/Divergent.Customers.ViewModelComposition/Divergent.Customers.ViewModelComposition.csproj index 06647932..6ec89002 100644 --- a/exercises/04-integration/before/Divergent.Customers.ViewModelComposition/Divergent.Customers.ViewModelComposition.csproj +++ b/exercises/04-integration/before/Divergent.Customers.ViewModelComposition/Divergent.Customers.ViewModelComposition.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 diff --git a/exercises/04-integration/before/Divergent.Customers/Divergent.Customers.csproj b/exercises/04-integration/before/Divergent.Customers/Divergent.Customers.csproj index fde4e2b4..4d2dfd12 100644 --- a/exercises/04-integration/before/Divergent.Customers/Divergent.Customers.csproj +++ b/exercises/04-integration/before/Divergent.Customers/Divergent.Customers.csproj @@ -2,7 +2,7 @@ latest - net7.0 + net8.0 enable diff --git a/exercises/04-integration/before/Divergent.Finance.API/Divergent.Finance.API.csproj b/exercises/04-integration/before/Divergent.Finance.API/Divergent.Finance.API.csproj index 4c0f2c11..f548dc27 100644 --- a/exercises/04-integration/before/Divergent.Finance.API/Divergent.Finance.API.csproj +++ b/exercises/04-integration/before/Divergent.Finance.API/Divergent.Finance.API.csproj @@ -2,7 +2,7 @@ latest - net7.0 + net8.0 enable diff --git a/exercises/04-integration/before/Divergent.Finance.Data/Divergent.Finance.Data.csproj b/exercises/04-integration/before/Divergent.Finance.Data/Divergent.Finance.Data.csproj index f731948f..ac125a56 100644 --- a/exercises/04-integration/before/Divergent.Finance.Data/Divergent.Finance.Data.csproj +++ b/exercises/04-integration/before/Divergent.Finance.Data/Divergent.Finance.Data.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 diff --git a/exercises/04-integration/before/Divergent.Finance.ViewModelComposition/Divergent.Finance.ViewModelComposition.csproj b/exercises/04-integration/before/Divergent.Finance.ViewModelComposition/Divergent.Finance.ViewModelComposition.csproj index 06647932..6ec89002 100644 --- a/exercises/04-integration/before/Divergent.Finance.ViewModelComposition/Divergent.Finance.ViewModelComposition.csproj +++ b/exercises/04-integration/before/Divergent.Finance.ViewModelComposition/Divergent.Finance.ViewModelComposition.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 diff --git a/exercises/04-integration/before/Divergent.Finance/Divergent.Finance.csproj b/exercises/04-integration/before/Divergent.Finance/Divergent.Finance.csproj index 2d0a2d0c..390f91e0 100644 --- a/exercises/04-integration/before/Divergent.Finance/Divergent.Finance.csproj +++ b/exercises/04-integration/before/Divergent.Finance/Divergent.Finance.csproj @@ -2,7 +2,7 @@ latest - net7.0 + net8.0 enable diff --git a/exercises/04-integration/before/Divergent.Frontend/Divergent.Frontend.csproj b/exercises/04-integration/before/Divergent.Frontend/Divergent.Frontend.csproj index e33b3c88..855715e4 100644 --- a/exercises/04-integration/before/Divergent.Frontend/Divergent.Frontend.csproj +++ b/exercises/04-integration/before/Divergent.Frontend/Divergent.Frontend.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 enable diff --git a/exercises/04-integration/before/Divergent.ITOps/Divergent.ITOps.csproj b/exercises/04-integration/before/Divergent.ITOps/Divergent.ITOps.csproj index 81e48833..28201bab 100644 --- a/exercises/04-integration/before/Divergent.ITOps/Divergent.ITOps.csproj +++ b/exercises/04-integration/before/Divergent.ITOps/Divergent.ITOps.csproj @@ -2,7 +2,7 @@ latest - net7.0 + net8.0 enable diff --git a/exercises/04-integration/before/Divergent.Sales.API/Divergent.Sales.API.csproj b/exercises/04-integration/before/Divergent.Sales.API/Divergent.Sales.API.csproj index f4f5da2e..07ddfb46 100644 --- a/exercises/04-integration/before/Divergent.Sales.API/Divergent.Sales.API.csproj +++ b/exercises/04-integration/before/Divergent.Sales.API/Divergent.Sales.API.csproj @@ -2,7 +2,7 @@ latest - net7.0 + net8.0 enable diff --git a/exercises/04-integration/before/Divergent.Sales.Data/Divergent.Sales.Data.csproj b/exercises/04-integration/before/Divergent.Sales.Data/Divergent.Sales.Data.csproj index 3c845765..8080aff7 100644 --- a/exercises/04-integration/before/Divergent.Sales.Data/Divergent.Sales.Data.csproj +++ b/exercises/04-integration/before/Divergent.Sales.Data/Divergent.Sales.Data.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 diff --git a/exercises/04-integration/before/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj b/exercises/04-integration/before/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj index 31b11046..1a0c6ec8 100644 --- a/exercises/04-integration/before/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj +++ b/exercises/04-integration/before/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 diff --git a/exercises/04-integration/before/Divergent.Sales/Divergent.Sales.csproj b/exercises/04-integration/before/Divergent.Sales/Divergent.Sales.csproj index 9ea9a075..25c3099a 100644 --- a/exercises/04-integration/before/Divergent.Sales/Divergent.Sales.csproj +++ b/exercises/04-integration/before/Divergent.Sales/Divergent.Sales.csproj @@ -2,7 +2,7 @@ latest - net7.0 + net8.0 enable diff --git a/exercises/04-integration/before/Divergent.Shipping/Divergent.Shipping.csproj b/exercises/04-integration/before/Divergent.Shipping/Divergent.Shipping.csproj index d9c35a7a..f89f1f25 100644 --- a/exercises/04-integration/before/Divergent.Shipping/Divergent.Shipping.csproj +++ b/exercises/04-integration/before/Divergent.Shipping/Divergent.Shipping.csproj @@ -2,7 +2,7 @@ latest - net7.0 + net8.0 enable diff --git a/exercises/04-integration/before/externalsystems/MastercardPaymentProvider/PaymentProviders.csproj b/exercises/04-integration/before/externalsystems/MastercardPaymentProvider/PaymentProviders.csproj index d4421016..696531d6 100644 --- a/exercises/04-integration/before/externalsystems/MastercardPaymentProvider/PaymentProviders.csproj +++ b/exercises/04-integration/before/externalsystems/MastercardPaymentProvider/PaymentProviders.csproj @@ -3,7 +3,7 @@ latest Exe - net7.0 + net8.0 enable diff --git a/exercises/shared-api-gateway/ITOps.Json/ITOps.Json.csproj b/exercises/shared-api-gateway/ITOps.Json/ITOps.Json.csproj index 7960f1bd..5ac39513 100644 --- a/exercises/shared-api-gateway/ITOps.Json/ITOps.Json.csproj +++ b/exercises/shared-api-gateway/ITOps.Json/ITOps.Json.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 diff --git a/exercises/shared-api-gateway/ITOps.SharedConfiguration/ITOps.SharedConfiguration.csproj b/exercises/shared-api-gateway/ITOps.SharedConfiguration/ITOps.SharedConfiguration.csproj index c6e43500..a73b149c 100644 --- a/exercises/shared-api-gateway/ITOps.SharedConfiguration/ITOps.SharedConfiguration.csproj +++ b/exercises/shared-api-gateway/ITOps.SharedConfiguration/ITOps.SharedConfiguration.csproj @@ -1,6 +1,6 @@  - net7.0 + net8.0 ITOps.EndpointConfig diff --git a/exercises/shared-api-gateway/ITOps.ViewModelComposition.Gateway/ITOps.ViewModelComposition.Gateway.csproj b/exercises/shared-api-gateway/ITOps.ViewModelComposition.Gateway/ITOps.ViewModelComposition.Gateway.csproj index e02a7c56..44c4d520 100644 --- a/exercises/shared-api-gateway/ITOps.ViewModelComposition.Gateway/ITOps.ViewModelComposition.Gateway.csproj +++ b/exercises/shared-api-gateway/ITOps.ViewModelComposition.Gateway/ITOps.ViewModelComposition.Gateway.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 diff --git a/exercises/shared-api-gateway/ITOps.ViewModelComposition/ITOps.ViewModelComposition.csproj b/exercises/shared-api-gateway/ITOps.ViewModelComposition/ITOps.ViewModelComposition.csproj index 1db0a952..d6c7e5bc 100644 --- a/exercises/shared-api-gateway/ITOps.ViewModelComposition/ITOps.ViewModelComposition.csproj +++ b/exercises/shared-api-gateway/ITOps.ViewModelComposition/ITOps.ViewModelComposition.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 From c2d6be60b3128e7473cb8f99404db64756c9dff4 Mon Sep 17 00:00:00 2001 From: David Boike Date: Thu, 31 Oct 2024 11:11:21 -0500 Subject: [PATCH 2/9] Update exercise 1 before (breaking everything else) --- .../Divergent.CompositionGateway.csproj | 2 +- ...t.Sales.ViewModelComposition.Events.csproj | 2 +- ...ivergent.Sales.ViewModelComposition.csproj | 2 +- .../OrdersListViewModelAppender.cs | 4 +- ...rgent.Shipping.ViewModelComposition.csproj | 2 +- .../OrdersLoadedSubscriber.cs | 3 - .../Divergent.Website.csproj | 2 +- .../before/01-composite-ui-before.sln | 32 ++----- .../Divergent.CompositionGateway.csproj | 1 - .../Divergent.CompositionGateway/Startup.cs | 9 +- ...gent.Customers.ViewModelComposition.csproj | 5 +- .../OrdersLoadedSubscriber.cs | 19 ++-- ...ergent.Finance.ViewModelComposition.csproj | 5 +- ...ivergent.Sales.ViewModelComposition.csproj | 5 +- .../OrdersListViewModelAppender.cs | 18 ++-- .../ApplicationBuilderExtensions.cs | 29 ------- .../ComposableRouteHandler.cs | 43 ---------- .../ITOps.ViewModelComposition.Gateway.csproj | 16 ---- .../RouteBuilderExtensions.cs | 31 ------- .../AssemblyLoader.cs | 28 ------ .../CompositionHandler.cs | 54 ------------ .../DynamicViewModel.cs | 86 ------------------- .../EventHandler.cs | 7 -- .../IPublishCompositionEvents.cs | 6 -- .../IRouteInterceptor.cs | 8 -- .../ISubscribeToCompositionEvents.cs | 6 -- .../ITOps.ViewModelComposition.csproj | 12 --- .../IViewModelAppender.cs | 10 --- .../ServiceCollectionExtensions.cs | 33 ------- .../TaskExtensions.cs | 21 ----- 30 files changed, 48 insertions(+), 453 deletions(-) delete mode 100644 exercises/shared-api-gateway/ITOps.ViewModelComposition.Gateway/ApplicationBuilderExtensions.cs delete mode 100644 exercises/shared-api-gateway/ITOps.ViewModelComposition.Gateway/ComposableRouteHandler.cs delete mode 100644 exercises/shared-api-gateway/ITOps.ViewModelComposition.Gateway/ITOps.ViewModelComposition.Gateway.csproj delete mode 100644 exercises/shared-api-gateway/ITOps.ViewModelComposition.Gateway/RouteBuilderExtensions.cs delete mode 100644 exercises/shared-api-gateway/ITOps.ViewModelComposition/AssemblyLoader.cs delete mode 100644 exercises/shared-api-gateway/ITOps.ViewModelComposition/CompositionHandler.cs delete mode 100644 exercises/shared-api-gateway/ITOps.ViewModelComposition/DynamicViewModel.cs delete mode 100644 exercises/shared-api-gateway/ITOps.ViewModelComposition/EventHandler.cs delete mode 100644 exercises/shared-api-gateway/ITOps.ViewModelComposition/IPublishCompositionEvents.cs delete mode 100644 exercises/shared-api-gateway/ITOps.ViewModelComposition/IRouteInterceptor.cs delete mode 100644 exercises/shared-api-gateway/ITOps.ViewModelComposition/ISubscribeToCompositionEvents.cs delete mode 100644 exercises/shared-api-gateway/ITOps.ViewModelComposition/ITOps.ViewModelComposition.csproj delete mode 100644 exercises/shared-api-gateway/ITOps.ViewModelComposition/IViewModelAppender.cs delete mode 100644 exercises/shared-api-gateway/ITOps.ViewModelComposition/ServiceCollectionExtensions.cs delete mode 100644 exercises/shared-api-gateway/ITOps.ViewModelComposition/TaskExtensions.cs diff --git a/demos/asp-net-core/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj b/demos/asp-net-core/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj index 21ecb139..44442033 100644 --- a/demos/asp-net-core/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj +++ b/demos/asp-net-core/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj @@ -6,7 +6,7 @@ - + diff --git a/demos/asp-net-core/Divergent.Sales.ViewModelComposition.Events/Divergent.Sales.ViewModelComposition.Events.csproj b/demos/asp-net-core/Divergent.Sales.ViewModelComposition.Events/Divergent.Sales.ViewModelComposition.Events.csproj index e940c627..48cf7cff 100644 --- a/demos/asp-net-core/Divergent.Sales.ViewModelComposition.Events/Divergent.Sales.ViewModelComposition.Events.csproj +++ b/demos/asp-net-core/Divergent.Sales.ViewModelComposition.Events/Divergent.Sales.ViewModelComposition.Events.csproj @@ -5,7 +5,7 @@ - + \ No newline at end of file diff --git a/demos/asp-net-core/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj b/demos/asp-net-core/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj index 125e4ac8..6f646ec7 100644 --- a/demos/asp-net-core/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj +++ b/demos/asp-net-core/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj @@ -6,7 +6,7 @@ - + diff --git a/demos/asp-net-core/Divergent.Sales.ViewModelComposition/OrdersListViewModelAppender.cs b/demos/asp-net-core/Divergent.Sales.ViewModelComposition/OrdersListViewModelAppender.cs index b755d1b1..eaa934db 100644 --- a/demos/asp-net-core/Divergent.Sales.ViewModelComposition/OrdersListViewModelAppender.cs +++ b/demos/asp-net-core/Divergent.Sales.ViewModelComposition/OrdersListViewModelAppender.cs @@ -2,9 +2,7 @@ using ITOps.Json; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Routing; using ServiceComposer.AspNetCore; -using System; using System.Collections.Generic; using System.Dynamic; using System.Net.Http; @@ -47,7 +45,7 @@ public async Task Handle(HttpRequest request) var compositionContext = request.GetCompositionContext(); await compositionContext.RaiseEvent(new OrdersLoaded { OrderViewModelDictionary = orderViewModelDictionary }); - // Using dynamic to simplify the demo. The ViewModel can be strongly typed. + // Using dynamic to simplify the demo. The ViewModel can be strongly typed using GetComposedResponseModel() var vm = request.GetComposedResponseModel(); vm.Orders = orderViewModelDictionary.Values; } diff --git a/demos/asp-net-core/Divergent.Shipping.ViewModelComposition/Divergent.Shipping.ViewModelComposition.csproj b/demos/asp-net-core/Divergent.Shipping.ViewModelComposition/Divergent.Shipping.ViewModelComposition.csproj index 956ea343..a1c9e5ff 100644 --- a/demos/asp-net-core/Divergent.Shipping.ViewModelComposition/Divergent.Shipping.ViewModelComposition.csproj +++ b/demos/asp-net-core/Divergent.Shipping.ViewModelComposition/Divergent.Shipping.ViewModelComposition.csproj @@ -6,7 +6,7 @@ - + diff --git a/demos/asp-net-core/Divergent.Shipping.ViewModelComposition/OrdersLoadedSubscriber.cs b/demos/asp-net-core/Divergent.Shipping.ViewModelComposition/OrdersLoadedSubscriber.cs index 682ef841..465710df 100644 --- a/demos/asp-net-core/Divergent.Shipping.ViewModelComposition/OrdersLoadedSubscriber.cs +++ b/demos/asp-net-core/Divergent.Shipping.ViewModelComposition/OrdersLoadedSubscriber.cs @@ -1,9 +1,6 @@ using Divergent.Sales.ViewModelComposition.Events; using ITOps.Json; using ServiceComposer.AspNetCore; -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Routing; -using System; using System.Net.Http; using Microsoft.AspNetCore.Mvc; diff --git a/demos/asp-net-core/Divergent.Website/Divergent.Website.csproj b/demos/asp-net-core/Divergent.Website/Divergent.Website.csproj index 51ed342b..1ef8048b 100644 --- a/demos/asp-net-core/Divergent.Website/Divergent.Website.csproj +++ b/demos/asp-net-core/Divergent.Website/Divergent.Website.csproj @@ -5,7 +5,7 @@ - + diff --git a/exercises/01-composite-ui/before/01-composite-ui-before.sln b/exercises/01-composite-ui/before/01-composite-ui-before.sln index b51bb5f2..585bb14c 100644 --- a/exercises/01-composite-ui/before/01-composite-ui-before.sln +++ b/exercises/01-composite-ui/before/01-composite-ui-before.sln @@ -1,15 +1,15 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.27130.2010 +# Visual Studio Version 17 +VisualStudioVersion = 17.11.35327.3 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Website", "Website", "{120B20F8-E388-4973-8F67-8340EADED83B}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Customers.Data", "Divergent.Customers.Data\Divergent.Customers.Data.csproj", "{314AA28E-E5A9-40B3-AA9B-C2C0E5BAD059}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Customers.Data", "Divergent.Customers.Data\Divergent.Customers.Data.csproj", "{314AA28E-E5A9-40B3-AA9B-C2C0E5BAD059}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Finance.Data", "Divergent.Finance.Data\Divergent.Finance.Data.csproj", "{FEE53DC5-B52D-49DB-8F07-A8C835998283}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Finance.Data", "Divergent.Finance.Data\Divergent.Finance.Data.csproj", "{FEE53DC5-B52D-49DB-8F07-A8C835998283}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Sales.Data", "Divergent.Sales.Data\Divergent.Sales.Data.csproj", "{80F82F7D-3F0A-4316-87CD-49F19DBD5B85}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Sales.Data", "Divergent.Sales.Data\Divergent.Sales.Data.csproj", "{80F82F7D-3F0A-4316-87CD-49F19DBD5B85}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Customers", "Customers", "{808B901F-6EF7-49F0-B668-F54EEDB1F3F1}" EndProject @@ -19,20 +19,16 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Sales", "Sales", "{3F113598 EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ITOps", "ITOps", "{A9587680-24D6-475A-81E8-8699773B5ED9}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Customers.API", "Divergent.Customers.API\Divergent.Customers.API.csproj", "{222B8A52-4F51-4140-80B4-8AF531E293E4}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Customers.API", "Divergent.Customers.API\Divergent.Customers.API.csproj", "{222B8A52-4F51-4140-80B4-8AF531E293E4}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Finance.API", "Divergent.Finance.API\Divergent.Finance.API.csproj", "{BF4B517B-DBC4-4107-886F-9E246312E9AF}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Finance.API", "Divergent.Finance.API\Divergent.Finance.API.csproj", "{BF4B517B-DBC4-4107-886F-9E246312E9AF}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Sales.API", "Divergent.Sales.API\Divergent.Sales.API.csproj", "{C2FE4732-EA4E-49CC-BE34-46341FB32E09}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Sales.API", "Divergent.Sales.API\Divergent.Sales.API.csproj", "{C2FE4732-EA4E-49CC-BE34-46341FB32E09}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Frontend", "Divergent.Frontend\Divergent.Frontend.csproj", "{0EE90477-6D50-49A3-A557-3741F568E2ED}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ITOps.ViewModelComposition", "..\..\shared-api-gateway\ITOps.ViewModelComposition\ITOps.ViewModelComposition.csproj", "{888DB2A9-39D2-4B21-8620-8C2BD67AAF6F}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Frontend", "Divergent.Frontend\Divergent.Frontend.csproj", "{0EE90477-6D50-49A3-A557-3741F568E2ED}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ITOps.Json", "..\..\shared-api-gateway\ITOps.Json\ITOps.Json.csproj", "{416C923B-61E5-4182-909C-21651394C05F}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ITOps.ViewModelComposition.Gateway", "..\..\shared-api-gateway\ITOps.ViewModelComposition.Gateway\ITOps.ViewModelComposition.Gateway.csproj", "{A99F2A92-EE56-49FB-970C-5EA7935D1316}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.CompositionGateway", "Divergent.CompositionGateway\Divergent.CompositionGateway.csproj", "{4776CCE0-98E9-4E3A-9DDC-93278D63721E}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Sales.ViewModelComposition", "Divergent.Sales.ViewModelComposition\Divergent.Sales.ViewModelComposition.csproj", "{A476ADD9-1DA4-46E1-8555-6040C52B76D0}" @@ -79,18 +75,10 @@ Global {0EE90477-6D50-49A3-A557-3741F568E2ED}.Debug|Any CPU.Build.0 = Debug|Any CPU {0EE90477-6D50-49A3-A557-3741F568E2ED}.Release|Any CPU.ActiveCfg = Release|Any CPU {0EE90477-6D50-49A3-A557-3741F568E2ED}.Release|Any CPU.Build.0 = Release|Any CPU - {888DB2A9-39D2-4B21-8620-8C2BD67AAF6F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {888DB2A9-39D2-4B21-8620-8C2BD67AAF6F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {888DB2A9-39D2-4B21-8620-8C2BD67AAF6F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {888DB2A9-39D2-4B21-8620-8C2BD67AAF6F}.Release|Any CPU.Build.0 = Release|Any CPU {416C923B-61E5-4182-909C-21651394C05F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {416C923B-61E5-4182-909C-21651394C05F}.Debug|Any CPU.Build.0 = Debug|Any CPU {416C923B-61E5-4182-909C-21651394C05F}.Release|Any CPU.ActiveCfg = Release|Any CPU {416C923B-61E5-4182-909C-21651394C05F}.Release|Any CPU.Build.0 = Release|Any CPU - {A99F2A92-EE56-49FB-970C-5EA7935D1316}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A99F2A92-EE56-49FB-970C-5EA7935D1316}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A99F2A92-EE56-49FB-970C-5EA7935D1316}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A99F2A92-EE56-49FB-970C-5EA7935D1316}.Release|Any CPU.Build.0 = Release|Any CPU {4776CCE0-98E9-4E3A-9DDC-93278D63721E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {4776CCE0-98E9-4E3A-9DDC-93278D63721E}.Debug|Any CPU.Build.0 = Debug|Any CPU {4776CCE0-98E9-4E3A-9DDC-93278D63721E}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -127,9 +115,7 @@ Global {BF4B517B-DBC4-4107-886F-9E246312E9AF} = {65F37558-1C29-4247-BD01-4DFAFD452ECB} {C2FE4732-EA4E-49CC-BE34-46341FB32E09} = {3F113598-B240-4E06-B41A-6C684C208F2A} {0EE90477-6D50-49A3-A557-3741F568E2ED} = {120B20F8-E388-4973-8F67-8340EADED83B} - {888DB2A9-39D2-4B21-8620-8C2BD67AAF6F} = {A9587680-24D6-475A-81E8-8699773B5ED9} {416C923B-61E5-4182-909C-21651394C05F} = {A9587680-24D6-475A-81E8-8699773B5ED9} - {A99F2A92-EE56-49FB-970C-5EA7935D1316} = {A9587680-24D6-475A-81E8-8699773B5ED9} {4776CCE0-98E9-4E3A-9DDC-93278D63721E} = {120B20F8-E388-4973-8F67-8340EADED83B} {A476ADD9-1DA4-46E1-8555-6040C52B76D0} = {3F113598-B240-4E06-B41A-6C684C208F2A} {D4B3216E-6072-4B7A-97C5-A6FC4C2ABB05} = {3F113598-B240-4E06-B41A-6C684C208F2A} diff --git a/exercises/01-composite-ui/before/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj b/exercises/01-composite-ui/before/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj index c30c220c..9c02a1f0 100644 --- a/exercises/01-composite-ui/before/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj +++ b/exercises/01-composite-ui/before/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj @@ -10,7 +10,6 @@ - diff --git a/exercises/01-composite-ui/before/Divergent.CompositionGateway/Startup.cs b/exercises/01-composite-ui/before/Divergent.CompositionGateway/Startup.cs index 3f2bb613..cab786f1 100644 --- a/exercises/01-composite-ui/before/Divergent.CompositionGateway/Startup.cs +++ b/exercises/01-composite-ui/before/Divergent.CompositionGateway/Startup.cs @@ -1,5 +1,4 @@ -using ITOps.ViewModelComposition; -using ITOps.ViewModelComposition.Gateway; +using ServiceComposer.AspNetCore; namespace Divergent.CompositionGateway; @@ -21,6 +20,10 @@ public void Configure(IApplicationBuilder app) policyBuilder.AllowAnyHeader(); }); - app.RunCompositionGatewayWithDefaultRoutes(); + app.UseRouting(); + app.UseEndpoints(builder => + { + builder.MapCompositionHandlers(); + }); } } \ No newline at end of file diff --git a/exercises/01-composite-ui/before/Divergent.Customers.ViewModelComposition/Divergent.Customers.ViewModelComposition.csproj b/exercises/01-composite-ui/before/Divergent.Customers.ViewModelComposition/Divergent.Customers.ViewModelComposition.csproj index 6ec89002..b499a298 100644 --- a/exercises/01-composite-ui/before/Divergent.Customers.ViewModelComposition/Divergent.Customers.ViewModelComposition.csproj +++ b/exercises/01-composite-ui/before/Divergent.Customers.ViewModelComposition/Divergent.Customers.ViewModelComposition.csproj @@ -3,10 +3,13 @@ net8.0 + + + + - diff --git a/exercises/01-composite-ui/before/Divergent.Customers.ViewModelComposition/OrdersLoadedSubscriber.cs b/exercises/01-composite-ui/before/Divergent.Customers.ViewModelComposition/OrdersLoadedSubscriber.cs index 8ef5169e..b959df81 100644 --- a/exercises/01-composite-ui/before/Divergent.Customers.ViewModelComposition/OrdersLoadedSubscriber.cs +++ b/exercises/01-composite-ui/before/Divergent.Customers.ViewModelComposition/OrdersLoadedSubscriber.cs @@ -1,24 +1,17 @@ using Divergent.Sales.ViewModelComposition.Events; using ITOps.Json; -using ITOps.ViewModelComposition; -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Routing; -using System; using System.Net.Http; +using Microsoft.AspNetCore.Mvc; +using ServiceComposer.AspNetCore; namespace Divergent.Customers.ViewModelComposition; -public class OrdersLoadedSubscriber : ISubscribeToCompositionEvents +public class OrdersLoadedSubscriber : ICompositionEventsSubscriber { - // Very simple matching for the purpose of the exercise. - public bool Matches(RouteData routeData, string httpMethod) => - HttpMethods.IsGet(httpMethod) - && string.Equals((string)routeData.Values["controller"], "orders", StringComparison.OrdinalIgnoreCase) - && !routeData.Values.ContainsKey("id"); - - public void Subscribe(IPublishCompositionEvents publisher) + [HttpGet("/orders/{id}")] + public void Subscribe(ICompositionEventsPublisher publisher) { - publisher.Subscribe(async (pageViewModel, ordersLoaded, routeData, query) => + publisher.Subscribe(async (ordersLoaded, httpRequest) => { var orderIds = string.Join(",", ordersLoaded.OrderViewModelDictionary.Keys); diff --git a/exercises/01-composite-ui/before/Divergent.Finance.ViewModelComposition/Divergent.Finance.ViewModelComposition.csproj b/exercises/01-composite-ui/before/Divergent.Finance.ViewModelComposition/Divergent.Finance.ViewModelComposition.csproj index 6ec89002..78d59079 100644 --- a/exercises/01-composite-ui/before/Divergent.Finance.ViewModelComposition/Divergent.Finance.ViewModelComposition.csproj +++ b/exercises/01-composite-ui/before/Divergent.Finance.ViewModelComposition/Divergent.Finance.ViewModelComposition.csproj @@ -4,9 +4,12 @@ net8.0 + + + + - diff --git a/exercises/01-composite-ui/before/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj b/exercises/01-composite-ui/before/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj index 1a0c6ec8..df2602fe 100644 --- a/exercises/01-composite-ui/before/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj +++ b/exercises/01-composite-ui/before/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj @@ -3,11 +3,14 @@ net8.0 + + + + - \ No newline at end of file diff --git a/exercises/01-composite-ui/before/Divergent.Sales.ViewModelComposition/OrdersListViewModelAppender.cs b/exercises/01-composite-ui/before/Divergent.Sales.ViewModelComposition/OrdersListViewModelAppender.cs index d4dad8ba..36c4b37c 100644 --- a/exercises/01-composite-ui/before/Divergent.Sales.ViewModelComposition/OrdersListViewModelAppender.cs +++ b/exercises/01-composite-ui/before/Divergent.Sales.ViewModelComposition/OrdersListViewModelAppender.cs @@ -1,6 +1,5 @@ using Divergent.Sales.ViewModelComposition.Events; using ITOps.Json; -using ITOps.ViewModelComposition; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Routing; using System; @@ -8,17 +7,16 @@ using System.Dynamic; using System.Net.Http; using System.Threading.Tasks; +using ServiceComposer.AspNetCore; namespace Divergent.Sales.ViewModelComposition; -public class OrdersListViewModelAppender : IViewModelAppender -{ - public bool Matches(RouteData routeData, string httpMethod) => - HttpMethods.IsGet(httpMethod) - && string.Equals((string)routeData.Values["controller"], "orders", StringComparison.OrdinalIgnoreCase) - && !routeData.Values.ContainsKey("id"); +using Microsoft.AspNetCore.Mvc; - public async Task Append(dynamic viewModel, RouteData routeData, IQueryCollection query) +public class OrdersListViewModelAppender : ICompositionRequestsHandler +{ + [HttpGet("/orders")] + public async Task Handle(HttpRequest request) { // Hardcoded for simplicity. In a production app, a config object could be injected. var url = $"http://localhost:20185/api/orders"; @@ -28,8 +26,10 @@ public async Task Append(dynamic viewModel, RouteData routeData, IQueryCollectio var orderViewModelDictionary = MapToViewModelDictionary(orders); - await viewModel.RaiseEventAsync(new OrdersLoaded { OrderViewModelDictionary = orderViewModelDictionary }); + var compositionContext = request.GetCompositionContext(); + await compositionContext.RaiseEvent(new OrdersLoaded { OrderViewModelDictionary = orderViewModelDictionary }); + var viewModel = request.GetComposedResponseModel(); viewModel.Orders = orderViewModelDictionary.Values; } diff --git a/exercises/shared-api-gateway/ITOps.ViewModelComposition.Gateway/ApplicationBuilderExtensions.cs b/exercises/shared-api-gateway/ITOps.ViewModelComposition.Gateway/ApplicationBuilderExtensions.cs deleted file mode 100644 index 84cb7c73..00000000 --- a/exercises/shared-api-gateway/ITOps.ViewModelComposition.Gateway/ApplicationBuilderExtensions.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Routing; -using System; -using System.Threading.Tasks; - -namespace ITOps.ViewModelComposition.Gateway; - -public static class ApplicationBuilderExtensions -{ - public static void RunCompositionGateway(this IApplicationBuilder app, Action routes = null) - { - var routeBuilder = new RouteBuilder(app); - routes?.Invoke(routeBuilder); - - app.UseRouter(routeBuilder.Build()); - } - - public static void RunCompositionGatewayWithDefaultRoutes(this IApplicationBuilder app) => - app.RunCompositionGateway(routes => - { - routes.MapComposableGet(template: "{controller}/{id:int?}"); - routes.MapRoute("*", context => - { - context.Response.StatusCode = StatusCodes.Status404NotFound; - return Task.CompletedTask; - }); - }); -} \ No newline at end of file diff --git a/exercises/shared-api-gateway/ITOps.ViewModelComposition.Gateway/ComposableRouteHandler.cs b/exercises/shared-api-gateway/ITOps.ViewModelComposition.Gateway/ComposableRouteHandler.cs deleted file mode 100644 index f056f644..00000000 --- a/exercises/shared-api-gateway/ITOps.ViewModelComposition.Gateway/ComposableRouteHandler.cs +++ /dev/null @@ -1,43 +0,0 @@ -using Microsoft.AspNetCore.Http; -using Newtonsoft.Json; -using Newtonsoft.Json.Serialization; -using System.Threading.Tasks; - -namespace ITOps.ViewModelComposition.Gateway; - -class ComposableRouteHandler -{ - public static async Task HandleGetRequest(HttpContext context) - { - var result = await CompositionHandler.HandleGetRequest(context); - - if (result.StatusCode == StatusCodes.Status200OK) - { - // For the purposes of the exercise, we're not respecting the HTTP Accept header and assuming that a JSON response is OK. - context.Response.ContentType = "application/json; charset=utf-8"; - string json = JsonConvert.SerializeObject(result.ViewModel, GetSettings(context)); - await context.Response.WriteAsync(json); - } - else - { - context.Response.StatusCode = result.StatusCode; - } - } - - private static JsonSerializerSettings GetSettings(HttpContext context) - { - context.Request.Headers.TryGetValue("Accept-Casing", out var casing); - - switch (casing) - { - case "casing/pascal": - return new JsonSerializerSettings(); - - default: // camelCase - return new JsonSerializerSettings - { - ContractResolver = new CamelCasePropertyNamesContractResolver(), - }; - } - } -} \ No newline at end of file diff --git a/exercises/shared-api-gateway/ITOps.ViewModelComposition.Gateway/ITOps.ViewModelComposition.Gateway.csproj b/exercises/shared-api-gateway/ITOps.ViewModelComposition.Gateway/ITOps.ViewModelComposition.Gateway.csproj deleted file mode 100644 index 44c4d520..00000000 --- a/exercises/shared-api-gateway/ITOps.ViewModelComposition.Gateway/ITOps.ViewModelComposition.Gateway.csproj +++ /dev/null @@ -1,16 +0,0 @@ - - - - net8.0 - - - - - - - - - - - - \ No newline at end of file diff --git a/exercises/shared-api-gateway/ITOps.ViewModelComposition.Gateway/RouteBuilderExtensions.cs b/exercises/shared-api-gateway/ITOps.ViewModelComposition.Gateway/RouteBuilderExtensions.cs deleted file mode 100644 index 03aabbda..00000000 --- a/exercises/shared-api-gateway/ITOps.ViewModelComposition.Gateway/RouteBuilderExtensions.cs +++ /dev/null @@ -1,31 +0,0 @@ -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Routing; -using Microsoft.AspNetCore.Routing.Constraints; -using Microsoft.Extensions.DependencyInjection; - -namespace ITOps.ViewModelComposition.Gateway; - -public static class RouteBuilderExtensions -{ - public static IRouteBuilder MapComposableGet( - this IRouteBuilder routeBuilder, - string template, - RouteValueDictionary defaults = null, - RouteValueDictionary dataTokens = null) - { - var route = new Route( - target: new RouteHandler(ComposableRouteHandler.HandleGetRequest), - routeTemplate: template, - defaults: defaults, - constraints: new RouteValueDictionary(new - { - httpMethod = new HttpMethodRouteConstraint(HttpMethods.Get) - }), - dataTokens: dataTokens, - inlineConstraintResolver: routeBuilder.ServiceProvider.GetRequiredService()); - - routeBuilder.Routes.Add(route); - - return routeBuilder; - } -} \ No newline at end of file diff --git a/exercises/shared-api-gateway/ITOps.ViewModelComposition/AssemblyLoader.cs b/exercises/shared-api-gateway/ITOps.ViewModelComposition/AssemblyLoader.cs deleted file mode 100644 index 99e11e1f..00000000 --- a/exercises/shared-api-gateway/ITOps.ViewModelComposition/AssemblyLoader.cs +++ /dev/null @@ -1,28 +0,0 @@ -using Microsoft.Extensions.DependencyModel; -using System; -using System.IO; -using System.Linq; -using System.Reflection; -using System.Runtime.Loader; - -namespace ITOps.ViewModelComposition; - -internal static class AssemblyLoader -{ - public static Assembly Load(string path) - { - var assemblyName = Path.GetFileNameWithoutExtension(path); - - return IsCompileLibrary(assemblyName) || IsRuntimeLibrary(assemblyName) - ? Assembly.Load(new AssemblyName(assemblyName)) - : AssemblyLoadContext.Default.LoadFromAssemblyPath(path); - - bool IsCompileLibrary(string name) => - DependencyContext.Default.CompileLibraries - .Any(library => library.Name.Equals(name, StringComparison.OrdinalIgnoreCase)); - - bool IsRuntimeLibrary(string name) => - DependencyContext.Default.RuntimeLibraries - .Any(library => library.Name.Equals(name, StringComparison.OrdinalIgnoreCase)); - } -} \ No newline at end of file diff --git a/exercises/shared-api-gateway/ITOps.ViewModelComposition/CompositionHandler.cs b/exercises/shared-api-gateway/ITOps.ViewModelComposition/CompositionHandler.cs deleted file mode 100644 index 12243698..00000000 --- a/exercises/shared-api-gateway/ITOps.ViewModelComposition/CompositionHandler.cs +++ /dev/null @@ -1,54 +0,0 @@ -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Routing; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Logging; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace ITOps.ViewModelComposition; - -public class CompositionHandler -{ - public static async Task<(dynamic ViewModel, int StatusCode)> HandleGetRequest(HttpContext context) - { - var loggerFactory = context.RequestServices.GetService(); - var viewModel = new DynamicViewModel(context.GetRouteData(), context.Request.Query, loggerFactory); - var routeData = context.GetRouteData(); - - // matching interceptors could be cached by URL - var interceptors = context.RequestServices.GetServices() - .Where(interceptor => interceptor.Matches(context.GetRouteData(), HttpMethods.Get)) - .ToList(); - - try - { - foreach (var subscriber in interceptors.OfType()) - { - subscriber.Subscribe(viewModel); - } - - var pendingTasks = new List(); - - foreach (var appender in interceptors.OfType()) - { - pendingTasks.Add(appender.Append(viewModel, routeData, context.Request.Query).WithLogging(() => loggerFactory.CreateLogger(appender.GetType()))); - } - - if (!pendingTasks.Any()) - { - return (null, StatusCodes.Status404NotFound); - } - else - { - await Task.WhenAll(pendingTasks); - - return (viewModel, StatusCodes.Status200OK); - } - } - finally - { - viewModel.ClearSubscriptions(); - } - } -} \ No newline at end of file diff --git a/exercises/shared-api-gateway/ITOps.ViewModelComposition/DynamicViewModel.cs b/exercises/shared-api-gateway/ITOps.ViewModelComposition/DynamicViewModel.cs deleted file mode 100644 index 5573574f..00000000 --- a/exercises/shared-api-gateway/ITOps.ViewModelComposition/DynamicViewModel.cs +++ /dev/null @@ -1,86 +0,0 @@ -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Routing; -using Microsoft.Extensions.Logging; -using System; -using System.Collections.Generic; -using System.Dynamic; -using System.Threading.Tasks; - -namespace ITOps.ViewModelComposition; - -internal class DynamicViewModel : DynamicObject, IPublishCompositionEvents -{ - private readonly RouteData routeData; - private readonly IQueryCollection query; - private readonly ILoggerFactory loggerFactory; - - private IDictionary>> subscriptions = new Dictionary>>(); - private IDictionary properties = new Dictionary(); - - public DynamicViewModel(RouteData routeData, IQueryCollection query, ILoggerFactory loggerFactory) - { - this.routeData = routeData; - this.query = query; - this.loggerFactory = loggerFactory; - } - - public void Subscribe(EventHandler handler) - { - if (!subscriptions.TryGetValue(typeof(TEvent), out var handlers)) - { - handlers = new List>(); - subscriptions.Add(typeof(TEvent), handlers); - } - - handlers.Add((pageViewModel, @event, routeData, query) => handler(pageViewModel, (TEvent)@event, routeData, query)); - } - - public void ClearSubscriptions() => subscriptions.Clear(); - - public override bool TryGetMember(GetMemberBinder binder, out object result) => properties.TryGetValue(binder.Name, out result); - - public override bool TrySetMember(SetMemberBinder binder, object value) - { - properties[binder.Name] = value; - return true; - } - - public override bool TryInvokeMember(InvokeMemberBinder binder, object[] args, out object result) - { - result = null; - - if (binder.Name == nameof(RaiseEventAsync)) - { - result = RaiseEventAsync(args[0]); - return true; - } - - return false; - } - - public override IEnumerable GetDynamicMemberNames() - { - foreach (var propertyName in properties.Keys) - { - yield return propertyName; - } - - yield return nameof(RaiseEventAsync); - } - - private Task RaiseEventAsync(object @event) - { - if (subscriptions.TryGetValue(@event.GetType(), out var handlers)) - { - var tasks = new List(); - foreach (var handler in handlers) - { - tasks.Add(handler.Invoke(this, @event, routeData, query).WithLogging(() => loggerFactory.CreateLogger(handler.GetType()))); - } - - return Task.WhenAll(tasks); - } - - return Task.CompletedTask; - } -} \ No newline at end of file diff --git a/exercises/shared-api-gateway/ITOps.ViewModelComposition/EventHandler.cs b/exercises/shared-api-gateway/ITOps.ViewModelComposition/EventHandler.cs deleted file mode 100644 index 58cad13c..00000000 --- a/exercises/shared-api-gateway/ITOps.ViewModelComposition/EventHandler.cs +++ /dev/null @@ -1,7 +0,0 @@ -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Routing; -using System.Threading.Tasks; - -namespace ITOps.ViewModelComposition; - -public delegate Task EventHandler(dynamic pageViewModel, TEvent @event, RouteData routeData, IQueryCollection query); \ No newline at end of file diff --git a/exercises/shared-api-gateway/ITOps.ViewModelComposition/IPublishCompositionEvents.cs b/exercises/shared-api-gateway/ITOps.ViewModelComposition/IPublishCompositionEvents.cs deleted file mode 100644 index acc89004..00000000 --- a/exercises/shared-api-gateway/ITOps.ViewModelComposition/IPublishCompositionEvents.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace ITOps.ViewModelComposition; - -public interface IPublishCompositionEvents -{ - void Subscribe(EventHandler handler); -} \ No newline at end of file diff --git a/exercises/shared-api-gateway/ITOps.ViewModelComposition/IRouteInterceptor.cs b/exercises/shared-api-gateway/ITOps.ViewModelComposition/IRouteInterceptor.cs deleted file mode 100644 index ff2035a4..00000000 --- a/exercises/shared-api-gateway/ITOps.ViewModelComposition/IRouteInterceptor.cs +++ /dev/null @@ -1,8 +0,0 @@ -using Microsoft.AspNetCore.Routing; - -namespace ITOps.ViewModelComposition; - -public interface IRouteInterceptor -{ - bool Matches(RouteData routeData, string httpMethod); -} \ No newline at end of file diff --git a/exercises/shared-api-gateway/ITOps.ViewModelComposition/ISubscribeToCompositionEvents.cs b/exercises/shared-api-gateway/ITOps.ViewModelComposition/ISubscribeToCompositionEvents.cs deleted file mode 100644 index 097e7244..00000000 --- a/exercises/shared-api-gateway/ITOps.ViewModelComposition/ISubscribeToCompositionEvents.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace ITOps.ViewModelComposition; - -public interface ISubscribeToCompositionEvents : IRouteInterceptor -{ - void Subscribe(IPublishCompositionEvents publisher); -} \ No newline at end of file diff --git a/exercises/shared-api-gateway/ITOps.ViewModelComposition/ITOps.ViewModelComposition.csproj b/exercises/shared-api-gateway/ITOps.ViewModelComposition/ITOps.ViewModelComposition.csproj deleted file mode 100644 index d6c7e5bc..00000000 --- a/exercises/shared-api-gateway/ITOps.ViewModelComposition/ITOps.ViewModelComposition.csproj +++ /dev/null @@ -1,12 +0,0 @@ - - - - net8.0 - - - - - - - - \ No newline at end of file diff --git a/exercises/shared-api-gateway/ITOps.ViewModelComposition/IViewModelAppender.cs b/exercises/shared-api-gateway/ITOps.ViewModelComposition/IViewModelAppender.cs deleted file mode 100644 index 4ee25622..00000000 --- a/exercises/shared-api-gateway/ITOps.ViewModelComposition/IViewModelAppender.cs +++ /dev/null @@ -1,10 +0,0 @@ -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Routing; -using System.Threading.Tasks; - -namespace ITOps.ViewModelComposition; - -public interface IViewModelAppender : IRouteInterceptor -{ - Task Append(dynamic viewModel, RouteData routeData, IQueryCollection query); -} \ No newline at end of file diff --git a/exercises/shared-api-gateway/ITOps.ViewModelComposition/ServiceCollectionExtensions.cs b/exercises/shared-api-gateway/ITOps.ViewModelComposition/ServiceCollectionExtensions.cs deleted file mode 100644 index 6d75ffd2..00000000 --- a/exercises/shared-api-gateway/ITOps.ViewModelComposition/ServiceCollectionExtensions.cs +++ /dev/null @@ -1,33 +0,0 @@ -using Microsoft.Extensions.DependencyInjection; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Reflection; - -namespace ITOps.ViewModelComposition; - -public static class ServiceCollectionExtensions -{ - public static void AddViewModelComposition(this IServiceCollection services) => - AddViewModelComposition(services, "*ViewModelComposition*.dll"); - - public static void AddViewModelComposition(this IServiceCollection services, string assemblySearchPattern) - { - var types = new List(); - - foreach (var assemblyPath in Directory.GetFiles(AppContext.BaseDirectory, assemblySearchPattern)) - { - var assemblyTypes = AssemblyLoader.Load(assemblyPath) - .GetTypes() - .Where(type => !type.GetTypeInfo().IsAbstract && typeof(IRouteInterceptor).IsAssignableFrom(type)); - - types.AddRange(assemblyTypes); - } - - foreach (var type in types) - { - services.AddSingleton(typeof(IRouteInterceptor), type); - } - } -} \ No newline at end of file diff --git a/exercises/shared-api-gateway/ITOps.ViewModelComposition/TaskExtensions.cs b/exercises/shared-api-gateway/ITOps.ViewModelComposition/TaskExtensions.cs deleted file mode 100644 index 4631cac5..00000000 --- a/exercises/shared-api-gateway/ITOps.ViewModelComposition/TaskExtensions.cs +++ /dev/null @@ -1,21 +0,0 @@ -namespace ITOps.ViewModelComposition; - -using Microsoft.Extensions.Logging; -using System; -using System.Threading.Tasks; - -static class TaskExtensions -{ - public static async Task WithLogging(this Task task, Func createLogger) - { - try - { - await task; - } - catch (Exception ex) - { - createLogger().LogError(ex.ToString()); - throw; - } - } -} \ No newline at end of file From eeffdc8c0e20ffd3f3a3b35c2a7ef20650c0f554 Mon Sep 17 00:00:00 2001 From: David Boike Date: Thu, 31 Oct 2024 11:41:22 -0500 Subject: [PATCH 3/9] Exercise 1 after --- .../after/01-composite-ui-after.sln | 32 ++++++------------- .../Divergent.CompositionGateway.csproj | 1 - .../Divergent.CompositionGateway/Startup.cs | 9 ++++-- ...gent.Customers.ViewModelComposition.csproj | 5 ++- .../OrdersLoadedSubscriber.cs | 23 +++++-------- ...ergent.Finance.ViewModelComposition.csproj | 5 ++- .../OrdersLoadedSubscriber.cs | 23 +++++-------- .../Controllers/OrdersController.cs | 3 +- ...ivergent.Sales.ViewModelComposition.csproj | 5 ++- .../OrdersListViewModelAppender.cs | 27 +++++++--------- 10 files changed, 56 insertions(+), 77 deletions(-) diff --git a/exercises/01-composite-ui/after/01-composite-ui-after.sln b/exercises/01-composite-ui/after/01-composite-ui-after.sln index b51bb5f2..585bb14c 100644 --- a/exercises/01-composite-ui/after/01-composite-ui-after.sln +++ b/exercises/01-composite-ui/after/01-composite-ui-after.sln @@ -1,15 +1,15 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.27130.2010 +# Visual Studio Version 17 +VisualStudioVersion = 17.11.35327.3 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Website", "Website", "{120B20F8-E388-4973-8F67-8340EADED83B}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Customers.Data", "Divergent.Customers.Data\Divergent.Customers.Data.csproj", "{314AA28E-E5A9-40B3-AA9B-C2C0E5BAD059}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Customers.Data", "Divergent.Customers.Data\Divergent.Customers.Data.csproj", "{314AA28E-E5A9-40B3-AA9B-C2C0E5BAD059}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Finance.Data", "Divergent.Finance.Data\Divergent.Finance.Data.csproj", "{FEE53DC5-B52D-49DB-8F07-A8C835998283}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Finance.Data", "Divergent.Finance.Data\Divergent.Finance.Data.csproj", "{FEE53DC5-B52D-49DB-8F07-A8C835998283}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Sales.Data", "Divergent.Sales.Data\Divergent.Sales.Data.csproj", "{80F82F7D-3F0A-4316-87CD-49F19DBD5B85}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Sales.Data", "Divergent.Sales.Data\Divergent.Sales.Data.csproj", "{80F82F7D-3F0A-4316-87CD-49F19DBD5B85}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Customers", "Customers", "{808B901F-6EF7-49F0-B668-F54EEDB1F3F1}" EndProject @@ -19,20 +19,16 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Sales", "Sales", "{3F113598 EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ITOps", "ITOps", "{A9587680-24D6-475A-81E8-8699773B5ED9}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Customers.API", "Divergent.Customers.API\Divergent.Customers.API.csproj", "{222B8A52-4F51-4140-80B4-8AF531E293E4}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Customers.API", "Divergent.Customers.API\Divergent.Customers.API.csproj", "{222B8A52-4F51-4140-80B4-8AF531E293E4}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Finance.API", "Divergent.Finance.API\Divergent.Finance.API.csproj", "{BF4B517B-DBC4-4107-886F-9E246312E9AF}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Finance.API", "Divergent.Finance.API\Divergent.Finance.API.csproj", "{BF4B517B-DBC4-4107-886F-9E246312E9AF}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Sales.API", "Divergent.Sales.API\Divergent.Sales.API.csproj", "{C2FE4732-EA4E-49CC-BE34-46341FB32E09}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Sales.API", "Divergent.Sales.API\Divergent.Sales.API.csproj", "{C2FE4732-EA4E-49CC-BE34-46341FB32E09}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Frontend", "Divergent.Frontend\Divergent.Frontend.csproj", "{0EE90477-6D50-49A3-A557-3741F568E2ED}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ITOps.ViewModelComposition", "..\..\shared-api-gateway\ITOps.ViewModelComposition\ITOps.ViewModelComposition.csproj", "{888DB2A9-39D2-4B21-8620-8C2BD67AAF6F}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Frontend", "Divergent.Frontend\Divergent.Frontend.csproj", "{0EE90477-6D50-49A3-A557-3741F568E2ED}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ITOps.Json", "..\..\shared-api-gateway\ITOps.Json\ITOps.Json.csproj", "{416C923B-61E5-4182-909C-21651394C05F}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ITOps.ViewModelComposition.Gateway", "..\..\shared-api-gateway\ITOps.ViewModelComposition.Gateway\ITOps.ViewModelComposition.Gateway.csproj", "{A99F2A92-EE56-49FB-970C-5EA7935D1316}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.CompositionGateway", "Divergent.CompositionGateway\Divergent.CompositionGateway.csproj", "{4776CCE0-98E9-4E3A-9DDC-93278D63721E}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Sales.ViewModelComposition", "Divergent.Sales.ViewModelComposition\Divergent.Sales.ViewModelComposition.csproj", "{A476ADD9-1DA4-46E1-8555-6040C52B76D0}" @@ -79,18 +75,10 @@ Global {0EE90477-6D50-49A3-A557-3741F568E2ED}.Debug|Any CPU.Build.0 = Debug|Any CPU {0EE90477-6D50-49A3-A557-3741F568E2ED}.Release|Any CPU.ActiveCfg = Release|Any CPU {0EE90477-6D50-49A3-A557-3741F568E2ED}.Release|Any CPU.Build.0 = Release|Any CPU - {888DB2A9-39D2-4B21-8620-8C2BD67AAF6F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {888DB2A9-39D2-4B21-8620-8C2BD67AAF6F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {888DB2A9-39D2-4B21-8620-8C2BD67AAF6F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {888DB2A9-39D2-4B21-8620-8C2BD67AAF6F}.Release|Any CPU.Build.0 = Release|Any CPU {416C923B-61E5-4182-909C-21651394C05F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {416C923B-61E5-4182-909C-21651394C05F}.Debug|Any CPU.Build.0 = Debug|Any CPU {416C923B-61E5-4182-909C-21651394C05F}.Release|Any CPU.ActiveCfg = Release|Any CPU {416C923B-61E5-4182-909C-21651394C05F}.Release|Any CPU.Build.0 = Release|Any CPU - {A99F2A92-EE56-49FB-970C-5EA7935D1316}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A99F2A92-EE56-49FB-970C-5EA7935D1316}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A99F2A92-EE56-49FB-970C-5EA7935D1316}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A99F2A92-EE56-49FB-970C-5EA7935D1316}.Release|Any CPU.Build.0 = Release|Any CPU {4776CCE0-98E9-4E3A-9DDC-93278D63721E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {4776CCE0-98E9-4E3A-9DDC-93278D63721E}.Debug|Any CPU.Build.0 = Debug|Any CPU {4776CCE0-98E9-4E3A-9DDC-93278D63721E}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -127,9 +115,7 @@ Global {BF4B517B-DBC4-4107-886F-9E246312E9AF} = {65F37558-1C29-4247-BD01-4DFAFD452ECB} {C2FE4732-EA4E-49CC-BE34-46341FB32E09} = {3F113598-B240-4E06-B41A-6C684C208F2A} {0EE90477-6D50-49A3-A557-3741F568E2ED} = {120B20F8-E388-4973-8F67-8340EADED83B} - {888DB2A9-39D2-4B21-8620-8C2BD67AAF6F} = {A9587680-24D6-475A-81E8-8699773B5ED9} {416C923B-61E5-4182-909C-21651394C05F} = {A9587680-24D6-475A-81E8-8699773B5ED9} - {A99F2A92-EE56-49FB-970C-5EA7935D1316} = {A9587680-24D6-475A-81E8-8699773B5ED9} {4776CCE0-98E9-4E3A-9DDC-93278D63721E} = {120B20F8-E388-4973-8F67-8340EADED83B} {A476ADD9-1DA4-46E1-8555-6040C52B76D0} = {3F113598-B240-4E06-B41A-6C684C208F2A} {D4B3216E-6072-4B7A-97C5-A6FC4C2ABB05} = {3F113598-B240-4E06-B41A-6C684C208F2A} diff --git a/exercises/01-composite-ui/after/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj b/exercises/01-composite-ui/after/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj index c30c220c..9c02a1f0 100644 --- a/exercises/01-composite-ui/after/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj +++ b/exercises/01-composite-ui/after/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj @@ -10,7 +10,6 @@ - diff --git a/exercises/01-composite-ui/after/Divergent.CompositionGateway/Startup.cs b/exercises/01-composite-ui/after/Divergent.CompositionGateway/Startup.cs index 3f2bb613..cab786f1 100644 --- a/exercises/01-composite-ui/after/Divergent.CompositionGateway/Startup.cs +++ b/exercises/01-composite-ui/after/Divergent.CompositionGateway/Startup.cs @@ -1,5 +1,4 @@ -using ITOps.ViewModelComposition; -using ITOps.ViewModelComposition.Gateway; +using ServiceComposer.AspNetCore; namespace Divergent.CompositionGateway; @@ -21,6 +20,10 @@ public void Configure(IApplicationBuilder app) policyBuilder.AllowAnyHeader(); }); - app.RunCompositionGatewayWithDefaultRoutes(); + app.UseRouting(); + app.UseEndpoints(builder => + { + builder.MapCompositionHandlers(); + }); } } \ No newline at end of file diff --git a/exercises/01-composite-ui/after/Divergent.Customers.ViewModelComposition/Divergent.Customers.ViewModelComposition.csproj b/exercises/01-composite-ui/after/Divergent.Customers.ViewModelComposition/Divergent.Customers.ViewModelComposition.csproj index 6ec89002..78d59079 100644 --- a/exercises/01-composite-ui/after/Divergent.Customers.ViewModelComposition/Divergent.Customers.ViewModelComposition.csproj +++ b/exercises/01-composite-ui/after/Divergent.Customers.ViewModelComposition/Divergent.Customers.ViewModelComposition.csproj @@ -4,9 +4,12 @@ net8.0 + + + + - diff --git a/exercises/01-composite-ui/after/Divergent.Customers.ViewModelComposition/OrdersLoadedSubscriber.cs b/exercises/01-composite-ui/after/Divergent.Customers.ViewModelComposition/OrdersLoadedSubscriber.cs index 8ef5169e..3228ded7 100644 --- a/exercises/01-composite-ui/after/Divergent.Customers.ViewModelComposition/OrdersLoadedSubscriber.cs +++ b/exercises/01-composite-ui/after/Divergent.Customers.ViewModelComposition/OrdersLoadedSubscriber.cs @@ -1,24 +1,17 @@ -using Divergent.Sales.ViewModelComposition.Events; +using System.Net.Http; +using Divergent.Sales.ViewModelComposition.Events; using ITOps.Json; -using ITOps.ViewModelComposition; -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Routing; -using System; -using System.Net.Http; +using Microsoft.AspNetCore.Mvc; +using ServiceComposer.AspNetCore; namespace Divergent.Customers.ViewModelComposition; -public class OrdersLoadedSubscriber : ISubscribeToCompositionEvents +public class OrdersLoadedSubscriber : ICompositionEventsSubscriber { - // Very simple matching for the purpose of the exercise. - public bool Matches(RouteData routeData, string httpMethod) => - HttpMethods.IsGet(httpMethod) - && string.Equals((string)routeData.Values["controller"], "orders", StringComparison.OrdinalIgnoreCase) - && !routeData.Values.ContainsKey("id"); - - public void Subscribe(IPublishCompositionEvents publisher) + [HttpGet("/orders")] + public void Subscribe(ICompositionEventsPublisher publisher) { - publisher.Subscribe(async (pageViewModel, ordersLoaded, routeData, query) => + publisher.Subscribe(async (ordersLoaded, httpRequest) => { var orderIds = string.Join(",", ordersLoaded.OrderViewModelDictionary.Keys); diff --git a/exercises/01-composite-ui/after/Divergent.Finance.ViewModelComposition/Divergent.Finance.ViewModelComposition.csproj b/exercises/01-composite-ui/after/Divergent.Finance.ViewModelComposition/Divergent.Finance.ViewModelComposition.csproj index 6ec89002..78d59079 100644 --- a/exercises/01-composite-ui/after/Divergent.Finance.ViewModelComposition/Divergent.Finance.ViewModelComposition.csproj +++ b/exercises/01-composite-ui/after/Divergent.Finance.ViewModelComposition/Divergent.Finance.ViewModelComposition.csproj @@ -4,9 +4,12 @@ net8.0 + + + + - diff --git a/exercises/01-composite-ui/after/Divergent.Finance.ViewModelComposition/OrdersLoadedSubscriber.cs b/exercises/01-composite-ui/after/Divergent.Finance.ViewModelComposition/OrdersLoadedSubscriber.cs index c5dda4a6..7fe01b1c 100644 --- a/exercises/01-composite-ui/after/Divergent.Finance.ViewModelComposition/OrdersLoadedSubscriber.cs +++ b/exercises/01-composite-ui/after/Divergent.Finance.ViewModelComposition/OrdersLoadedSubscriber.cs @@ -1,24 +1,17 @@ -using Divergent.Sales.ViewModelComposition.Events; +using System.Net.Http; +using Divergent.Sales.ViewModelComposition.Events; using ITOps.Json; -using ITOps.ViewModelComposition; -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Routing; -using System; -using System.Net.Http; +using Microsoft.AspNetCore.Mvc; +using ServiceComposer.AspNetCore; namespace Divergent.Finance.ViewModelComposition; -public class OrdersLoadedSubscriber : ISubscribeToCompositionEvents +public class OrdersLoadedSubscriber : ICompositionEventsSubscriber { - // Very simple matching for the purpose of the exercise. - public bool Matches(RouteData routeData, string httpMethod) => - HttpMethods.IsGet(httpMethod) - && string.Equals((string)routeData.Values["controller"], "orders", StringComparison.OrdinalIgnoreCase) - && !routeData.Values.ContainsKey("id"); - - public void Subscribe(IPublishCompositionEvents publisher) + [HttpGet("/orders")] + public void Subscribe(ICompositionEventsPublisher publisher) { - publisher.Subscribe(async (pageViewModel, ordersLoaded, routeData, query) => + publisher.Subscribe(async (ordersLoaded, httpRequest) => { var orderIds = string.Join(",", ordersLoaded.OrderViewModelDictionary.Keys); diff --git a/exercises/01-composite-ui/after/Divergent.Sales.API/Controllers/OrdersController.cs b/exercises/01-composite-ui/after/Divergent.Sales.API/Controllers/OrdersController.cs index 3ba582fa..1565dec6 100644 --- a/exercises/01-composite-ui/after/Divergent.Sales.API/Controllers/OrdersController.cs +++ b/exercises/01-composite-ui/after/Divergent.Sales.API/Controllers/OrdersController.cs @@ -1,6 +1,5 @@ using Divergent.Sales.Data.Models; using ITOps.EndpointConfig; -using NServiceBus; using Microsoft.AspNetCore.Mvc; namespace Divergent.Sales.API.Controllers; @@ -20,7 +19,7 @@ public OrdersController(ILiteDbContext db) public IEnumerable Get() { var col = db.Database.GetCollection(); - + return col.Query() .Select(order => new { diff --git a/exercises/01-composite-ui/after/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj b/exercises/01-composite-ui/after/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj index 1a0c6ec8..7d3bd827 100644 --- a/exercises/01-composite-ui/after/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj +++ b/exercises/01-composite-ui/after/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj @@ -4,10 +4,13 @@ net8.0 + + + + - \ No newline at end of file diff --git a/exercises/01-composite-ui/after/Divergent.Sales.ViewModelComposition/OrdersListViewModelAppender.cs b/exercises/01-composite-ui/after/Divergent.Sales.ViewModelComposition/OrdersListViewModelAppender.cs index 84b19000..cb791b56 100644 --- a/exercises/01-composite-ui/after/Divergent.Sales.ViewModelComposition/OrdersListViewModelAppender.cs +++ b/exercises/01-composite-ui/after/Divergent.Sales.ViewModelComposition/OrdersListViewModelAppender.cs @@ -1,24 +1,19 @@ -using Divergent.Sales.ViewModelComposition.Events; -using ITOps.Json; -using ITOps.ViewModelComposition; -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Routing; -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Dynamic; using System.Net.Http; using System.Threading.Tasks; +using Divergent.Sales.ViewModelComposition.Events; +using ITOps.Json; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using ServiceComposer.AspNetCore; namespace Divergent.Sales.ViewModelComposition; -public class OrdersListViewModelAppender : IViewModelAppender +public class OrdersListViewModelAppender : ICompositionRequestsHandler { - public bool Matches(RouteData routeData, string httpMethod) => - HttpMethods.IsGet(httpMethod) - && string.Equals((string)routeData.Values["controller"], "orders", StringComparison.OrdinalIgnoreCase) - && !routeData.Values.ContainsKey("id"); - - public async Task Append(dynamic viewModel, RouteData routeData, IQueryCollection query) + [HttpGet("/orders")] + public async Task Handle(HttpRequest request) { // Hardcoded for simplicity. In a production app, a config object could be injected. var url = $"http://localhost:20185/api/orders"; @@ -28,8 +23,10 @@ public async Task Append(dynamic viewModel, RouteData routeData, IQueryCollectio var orderViewModelDictionary = MapToViewModelDictionary(orders); - await viewModel.RaiseEventAsync(new OrdersLoaded { OrderViewModelDictionary = orderViewModelDictionary }); + var compositionContext = request.GetCompositionContext(); + await compositionContext.RaiseEvent(new OrdersLoaded { OrderViewModelDictionary = orderViewModelDictionary }); + var viewModel = request.GetComposedResponseModel(); viewModel.Orders = orderViewModelDictionary.Values; } From fec8ef4e06685c5222bf61c30f2e1504a517cb17 Mon Sep 17 00:00:00 2001 From: David Boike Date: Thu, 31 Oct 2024 11:51:17 -0500 Subject: [PATCH 4/9] Exercise 2 before --- ...ivergent.Sales.ViewModelComposition.csproj | 2 +- .../OrdersListViewModelAppender.cs | 13 ++--- .../before/02-publish-subscribe-before.sln | 48 +++++++------------ .../Divergent.CompositionGateway.csproj | 1 - .../Divergent.CompositionGateway/Startup.cs | 9 ++-- ...gent.Customers.ViewModelComposition.csproj | 5 +- .../OrdersLoadedSubscriber.cs | 23 ++++----- ...ergent.Finance.ViewModelComposition.csproj | 5 +- .../OrdersLoadedSubscriber.cs | 23 ++++----- ...ivergent.Sales.ViewModelComposition.csproj | 5 +- .../OrdersListViewModelAppender.cs | 27 +++++------ 11 files changed, 69 insertions(+), 92 deletions(-) diff --git a/exercises/01-composite-ui/before/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj b/exercises/01-composite-ui/before/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj index df2602fe..7d3bd827 100644 --- a/exercises/01-composite-ui/before/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj +++ b/exercises/01-composite-ui/before/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj @@ -3,7 +3,7 @@ net8.0 - + diff --git a/exercises/01-composite-ui/before/Divergent.Sales.ViewModelComposition/OrdersListViewModelAppender.cs b/exercises/01-composite-ui/before/Divergent.Sales.ViewModelComposition/OrdersListViewModelAppender.cs index 36c4b37c..bf7b05f0 100644 --- a/exercises/01-composite-ui/before/Divergent.Sales.ViewModelComposition/OrdersListViewModelAppender.cs +++ b/exercises/01-composite-ui/before/Divergent.Sales.ViewModelComposition/OrdersListViewModelAppender.cs @@ -1,18 +1,15 @@ -using Divergent.Sales.ViewModelComposition.Events; -using ITOps.Json; -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Routing; -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Dynamic; using System.Net.Http; using System.Threading.Tasks; +using Divergent.Sales.ViewModelComposition.Events; +using ITOps.Json; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; using ServiceComposer.AspNetCore; namespace Divergent.Sales.ViewModelComposition; -using Microsoft.AspNetCore.Mvc; - public class OrdersListViewModelAppender : ICompositionRequestsHandler { [HttpGet("/orders")] diff --git a/exercises/02-publish-subscribe/before/02-publish-subscribe-before.sln b/exercises/02-publish-subscribe/before/02-publish-subscribe-before.sln index b0b3083d..96eb5b9a 100644 --- a/exercises/02-publish-subscribe/before/02-publish-subscribe-before.sln +++ b/exercises/02-publish-subscribe/before/02-publish-subscribe-before.sln @@ -1,31 +1,31 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.27130.2010 +# Visual Studio Version 17 +VisualStudioVersion = 17.11.35327.3 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Customers", "Divergent.Customers\Divergent.Customers.csproj", "{02EE3114-734F-42DF-994C-98480E1489FE}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Customers", "Divergent.Customers\Divergent.Customers.csproj", "{02EE3114-734F-42DF-994C-98480E1489FE}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Finance", "Divergent.Finance\Divergent.Finance.csproj", "{3EE37732-A31A-408D-AC60-2FBF08D09B56}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Finance", "Divergent.Finance\Divergent.Finance.csproj", "{3EE37732-A31A-408D-AC60-2FBF08D09B56}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Sales", "Divergent.Sales\Divergent.Sales.csproj", "{F358BD9C-7138-45C9-AA32-B27F5066FF68}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Sales", "Divergent.Sales\Divergent.Sales.csproj", "{F358BD9C-7138-45C9-AA32-B27F5066FF68}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Website", "Website", "{120B20F8-E388-4973-8F67-8340EADED83B}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Finance.Messages", "Divergent.Finance.Messages\Divergent.Finance.Messages.csproj", "{01CCC8E0-605E-417D-BF33-30881F65A49B}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Finance.Messages", "Divergent.Finance.Messages\Divergent.Finance.Messages.csproj", "{01CCC8E0-605E-417D-BF33-30881F65A49B}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Sales.Messages", "Divergent.Sales.Messages\Divergent.Sales.Messages.csproj", "{FD850B7B-46A5-43EC-9571-C13736E6B033}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Sales.Messages", "Divergent.Sales.Messages\Divergent.Sales.Messages.csproj", "{FD850B7B-46A5-43EC-9571-C13736E6B033}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Customers.Data", "Divergent.Customers.Data\Divergent.Customers.Data.csproj", "{314AA28E-E5A9-40B3-AA9B-C2C0E5BAD059}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Customers.Data", "Divergent.Customers.Data\Divergent.Customers.Data.csproj", "{314AA28E-E5A9-40B3-AA9B-C2C0E5BAD059}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Finance.Data", "Divergent.Finance.Data\Divergent.Finance.Data.csproj", "{FEE53DC5-B52D-49DB-8F07-A8C835998283}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Finance.Data", "Divergent.Finance.Data\Divergent.Finance.Data.csproj", "{FEE53DC5-B52D-49DB-8F07-A8C835998283}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Sales.Data", "Divergent.Sales.Data\Divergent.Sales.Data.csproj", "{80F82F7D-3F0A-4316-87CD-49F19DBD5B85}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Sales.Data", "Divergent.Sales.Data\Divergent.Sales.Data.csproj", "{80F82F7D-3F0A-4316-87CD-49F19DBD5B85}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ExternalSystems", "ExternalSystems", "{41918E2F-FCC6-48D8-8A3C-3EF756BE385C}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PaymentProviders", "externalsystems\MastercardPaymentProvider\PaymentProviders.csproj", "{4EEFC008-F185-480A-8312-D3E9C81C5D95}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PaymentProviders", "externalsystems\MastercardPaymentProvider\PaymentProviders.csproj", "{4EEFC008-F185-480A-8312-D3E9C81C5D95}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Shipping", "Divergent.Shipping\Divergent.Shipping.csproj", "{E8BCB506-5BD6-4963-B4D0-717A26916E46}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Shipping", "Divergent.Shipping\Divergent.Shipping.csproj", "{E8BCB506-5BD6-4963-B4D0-717A26916E46}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Customers", "Customers", "{808B901F-6EF7-49F0-B668-F54EEDB1F3F1}" EndProject @@ -37,22 +37,18 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Shipping", "Shipping", "{BA EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ITOps", "ITOps", "{A9587680-24D6-475A-81E8-8699773B5ED9}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Customers.API", "Divergent.Customers.API\Divergent.Customers.API.csproj", "{222B8A52-4F51-4140-80B4-8AF531E293E4}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Customers.API", "Divergent.Customers.API\Divergent.Customers.API.csproj", "{222B8A52-4F51-4140-80B4-8AF531E293E4}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Finance.API", "Divergent.Finance.API\Divergent.Finance.API.csproj", "{BF4B517B-DBC4-4107-886F-9E246312E9AF}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Finance.API", "Divergent.Finance.API\Divergent.Finance.API.csproj", "{BF4B517B-DBC4-4107-886F-9E246312E9AF}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Sales.API", "Divergent.Sales.API\Divergent.Sales.API.csproj", "{C2FE4732-EA4E-49CC-BE34-46341FB32E09}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Sales.API", "Divergent.Sales.API\Divergent.Sales.API.csproj", "{C2FE4732-EA4E-49CC-BE34-46341FB32E09}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Shipping.Data", "Divergent.Shipping.Data\Divergent.Shipping.Data.csproj", "{C825BBFF-297D-4E68-ABB9-276FD81D4AD4}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Shipping.Data", "Divergent.Shipping.Data\Divergent.Shipping.Data.csproj", "{C825BBFF-297D-4E68-ABB9-276FD81D4AD4}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Frontend", "Divergent.Frontend\Divergent.Frontend.csproj", "{0EE90477-6D50-49A3-A557-3741F568E2ED}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ITOps.ViewModelComposition", "..\..\shared-api-gateway\ITOps.ViewModelComposition\ITOps.ViewModelComposition.csproj", "{888DB2A9-39D2-4B21-8620-8C2BD67AAF6F}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Frontend", "Divergent.Frontend\Divergent.Frontend.csproj", "{0EE90477-6D50-49A3-A557-3741F568E2ED}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ITOps.Json", "..\..\shared-api-gateway\ITOps.Json\ITOps.Json.csproj", "{416C923B-61E5-4182-909C-21651394C05F}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ITOps.ViewModelComposition.Gateway", "..\..\shared-api-gateway\ITOps.ViewModelComposition.Gateway\ITOps.ViewModelComposition.Gateway.csproj", "{A99F2A92-EE56-49FB-970C-5EA7935D1316}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.CompositionGateway", "Divergent.CompositionGateway\Divergent.CompositionGateway.csproj", "{4776CCE0-98E9-4E3A-9DDC-93278D63721E}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Sales.ViewModelComposition", "Divergent.Sales.ViewModelComposition\Divergent.Sales.ViewModelComposition.csproj", "{A476ADD9-1DA4-46E1-8555-6040C52B76D0}" @@ -131,18 +127,10 @@ Global {0EE90477-6D50-49A3-A557-3741F568E2ED}.Debug|Any CPU.Build.0 = Debug|Any CPU {0EE90477-6D50-49A3-A557-3741F568E2ED}.Release|Any CPU.ActiveCfg = Release|Any CPU {0EE90477-6D50-49A3-A557-3741F568E2ED}.Release|Any CPU.Build.0 = Release|Any CPU - {888DB2A9-39D2-4B21-8620-8C2BD67AAF6F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {888DB2A9-39D2-4B21-8620-8C2BD67AAF6F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {888DB2A9-39D2-4B21-8620-8C2BD67AAF6F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {888DB2A9-39D2-4B21-8620-8C2BD67AAF6F}.Release|Any CPU.Build.0 = Release|Any CPU {416C923B-61E5-4182-909C-21651394C05F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {416C923B-61E5-4182-909C-21651394C05F}.Debug|Any CPU.Build.0 = Debug|Any CPU {416C923B-61E5-4182-909C-21651394C05F}.Release|Any CPU.ActiveCfg = Release|Any CPU {416C923B-61E5-4182-909C-21651394C05F}.Release|Any CPU.Build.0 = Release|Any CPU - {A99F2A92-EE56-49FB-970C-5EA7935D1316}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A99F2A92-EE56-49FB-970C-5EA7935D1316}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A99F2A92-EE56-49FB-970C-5EA7935D1316}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A99F2A92-EE56-49FB-970C-5EA7935D1316}.Release|Any CPU.Build.0 = Release|Any CPU {4776CCE0-98E9-4E3A-9DDC-93278D63721E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {4776CCE0-98E9-4E3A-9DDC-93278D63721E}.Debug|Any CPU.Build.0 = Debug|Any CPU {4776CCE0-98E9-4E3A-9DDC-93278D63721E}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -187,9 +175,7 @@ Global {C2FE4732-EA4E-49CC-BE34-46341FB32E09} = {3F113598-B240-4E06-B41A-6C684C208F2A} {C825BBFF-297D-4E68-ABB9-276FD81D4AD4} = {BAFA6668-162F-4D48-8BAD-46A39C59B6FE} {0EE90477-6D50-49A3-A557-3741F568E2ED} = {120B20F8-E388-4973-8F67-8340EADED83B} - {888DB2A9-39D2-4B21-8620-8C2BD67AAF6F} = {A9587680-24D6-475A-81E8-8699773B5ED9} {416C923B-61E5-4182-909C-21651394C05F} = {A9587680-24D6-475A-81E8-8699773B5ED9} - {A99F2A92-EE56-49FB-970C-5EA7935D1316} = {A9587680-24D6-475A-81E8-8699773B5ED9} {4776CCE0-98E9-4E3A-9DDC-93278D63721E} = {120B20F8-E388-4973-8F67-8340EADED83B} {A476ADD9-1DA4-46E1-8555-6040C52B76D0} = {3F113598-B240-4E06-B41A-6C684C208F2A} {D4B3216E-6072-4B7A-97C5-A6FC4C2ABB05} = {3F113598-B240-4E06-B41A-6C684C208F2A} diff --git a/exercises/02-publish-subscribe/before/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj b/exercises/02-publish-subscribe/before/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj index c30c220c..9c02a1f0 100644 --- a/exercises/02-publish-subscribe/before/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj +++ b/exercises/02-publish-subscribe/before/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj @@ -10,7 +10,6 @@ - diff --git a/exercises/02-publish-subscribe/before/Divergent.CompositionGateway/Startup.cs b/exercises/02-publish-subscribe/before/Divergent.CompositionGateway/Startup.cs index 3f2bb613..cab786f1 100644 --- a/exercises/02-publish-subscribe/before/Divergent.CompositionGateway/Startup.cs +++ b/exercises/02-publish-subscribe/before/Divergent.CompositionGateway/Startup.cs @@ -1,5 +1,4 @@ -using ITOps.ViewModelComposition; -using ITOps.ViewModelComposition.Gateway; +using ServiceComposer.AspNetCore; namespace Divergent.CompositionGateway; @@ -21,6 +20,10 @@ public void Configure(IApplicationBuilder app) policyBuilder.AllowAnyHeader(); }); - app.RunCompositionGatewayWithDefaultRoutes(); + app.UseRouting(); + app.UseEndpoints(builder => + { + builder.MapCompositionHandlers(); + }); } } \ No newline at end of file diff --git a/exercises/02-publish-subscribe/before/Divergent.Customers.ViewModelComposition/Divergent.Customers.ViewModelComposition.csproj b/exercises/02-publish-subscribe/before/Divergent.Customers.ViewModelComposition/Divergent.Customers.ViewModelComposition.csproj index 6ec89002..78d59079 100644 --- a/exercises/02-publish-subscribe/before/Divergent.Customers.ViewModelComposition/Divergent.Customers.ViewModelComposition.csproj +++ b/exercises/02-publish-subscribe/before/Divergent.Customers.ViewModelComposition/Divergent.Customers.ViewModelComposition.csproj @@ -4,9 +4,12 @@ net8.0 + + + + - diff --git a/exercises/02-publish-subscribe/before/Divergent.Customers.ViewModelComposition/OrdersLoadedSubscriber.cs b/exercises/02-publish-subscribe/before/Divergent.Customers.ViewModelComposition/OrdersLoadedSubscriber.cs index 8ef5169e..f0a6d4c1 100644 --- a/exercises/02-publish-subscribe/before/Divergent.Customers.ViewModelComposition/OrdersLoadedSubscriber.cs +++ b/exercises/02-publish-subscribe/before/Divergent.Customers.ViewModelComposition/OrdersLoadedSubscriber.cs @@ -1,24 +1,17 @@ -using Divergent.Sales.ViewModelComposition.Events; +using System.Net.Http; +using Divergent.Sales.ViewModelComposition.Events; using ITOps.Json; -using ITOps.ViewModelComposition; -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Routing; -using System; -using System.Net.Http; +using Microsoft.AspNetCore.Mvc; +using ServiceComposer.AspNetCore; namespace Divergent.Customers.ViewModelComposition; -public class OrdersLoadedSubscriber : ISubscribeToCompositionEvents +public class OrdersLoadedSubscriber : ICompositionEventsSubscriber { - // Very simple matching for the purpose of the exercise. - public bool Matches(RouteData routeData, string httpMethod) => - HttpMethods.IsGet(httpMethod) - && string.Equals((string)routeData.Values["controller"], "orders", StringComparison.OrdinalIgnoreCase) - && !routeData.Values.ContainsKey("id"); - - public void Subscribe(IPublishCompositionEvents publisher) + [HttpGet("/orders/{id}")] + public void Subscribe(ICompositionEventsPublisher publisher) { - publisher.Subscribe(async (pageViewModel, ordersLoaded, routeData, query) => + publisher.Subscribe(async (ordersLoaded, httpRequest) => { var orderIds = string.Join(",", ordersLoaded.OrderViewModelDictionary.Keys); diff --git a/exercises/02-publish-subscribe/before/Divergent.Finance.ViewModelComposition/Divergent.Finance.ViewModelComposition.csproj b/exercises/02-publish-subscribe/before/Divergent.Finance.ViewModelComposition/Divergent.Finance.ViewModelComposition.csproj index 6ec89002..78d59079 100644 --- a/exercises/02-publish-subscribe/before/Divergent.Finance.ViewModelComposition/Divergent.Finance.ViewModelComposition.csproj +++ b/exercises/02-publish-subscribe/before/Divergent.Finance.ViewModelComposition/Divergent.Finance.ViewModelComposition.csproj @@ -4,9 +4,12 @@ net8.0 + + + + - diff --git a/exercises/02-publish-subscribe/before/Divergent.Finance.ViewModelComposition/OrdersLoadedSubscriber.cs b/exercises/02-publish-subscribe/before/Divergent.Finance.ViewModelComposition/OrdersLoadedSubscriber.cs index c5dda4a6..7fe01b1c 100644 --- a/exercises/02-publish-subscribe/before/Divergent.Finance.ViewModelComposition/OrdersLoadedSubscriber.cs +++ b/exercises/02-publish-subscribe/before/Divergent.Finance.ViewModelComposition/OrdersLoadedSubscriber.cs @@ -1,24 +1,17 @@ -using Divergent.Sales.ViewModelComposition.Events; +using System.Net.Http; +using Divergent.Sales.ViewModelComposition.Events; using ITOps.Json; -using ITOps.ViewModelComposition; -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Routing; -using System; -using System.Net.Http; +using Microsoft.AspNetCore.Mvc; +using ServiceComposer.AspNetCore; namespace Divergent.Finance.ViewModelComposition; -public class OrdersLoadedSubscriber : ISubscribeToCompositionEvents +public class OrdersLoadedSubscriber : ICompositionEventsSubscriber { - // Very simple matching for the purpose of the exercise. - public bool Matches(RouteData routeData, string httpMethod) => - HttpMethods.IsGet(httpMethod) - && string.Equals((string)routeData.Values["controller"], "orders", StringComparison.OrdinalIgnoreCase) - && !routeData.Values.ContainsKey("id"); - - public void Subscribe(IPublishCompositionEvents publisher) + [HttpGet("/orders")] + public void Subscribe(ICompositionEventsPublisher publisher) { - publisher.Subscribe(async (pageViewModel, ordersLoaded, routeData, query) => + publisher.Subscribe(async (ordersLoaded, httpRequest) => { var orderIds = string.Join(",", ordersLoaded.OrderViewModelDictionary.Keys); diff --git a/exercises/02-publish-subscribe/before/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj b/exercises/02-publish-subscribe/before/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj index 1a0c6ec8..7d3bd827 100644 --- a/exercises/02-publish-subscribe/before/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj +++ b/exercises/02-publish-subscribe/before/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj @@ -4,10 +4,13 @@ net8.0 + + + + - \ No newline at end of file diff --git a/exercises/02-publish-subscribe/before/Divergent.Sales.ViewModelComposition/OrdersListViewModelAppender.cs b/exercises/02-publish-subscribe/before/Divergent.Sales.ViewModelComposition/OrdersListViewModelAppender.cs index 84b19000..cb791b56 100644 --- a/exercises/02-publish-subscribe/before/Divergent.Sales.ViewModelComposition/OrdersListViewModelAppender.cs +++ b/exercises/02-publish-subscribe/before/Divergent.Sales.ViewModelComposition/OrdersListViewModelAppender.cs @@ -1,24 +1,19 @@ -using Divergent.Sales.ViewModelComposition.Events; -using ITOps.Json; -using ITOps.ViewModelComposition; -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Routing; -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Dynamic; using System.Net.Http; using System.Threading.Tasks; +using Divergent.Sales.ViewModelComposition.Events; +using ITOps.Json; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using ServiceComposer.AspNetCore; namespace Divergent.Sales.ViewModelComposition; -public class OrdersListViewModelAppender : IViewModelAppender +public class OrdersListViewModelAppender : ICompositionRequestsHandler { - public bool Matches(RouteData routeData, string httpMethod) => - HttpMethods.IsGet(httpMethod) - && string.Equals((string)routeData.Values["controller"], "orders", StringComparison.OrdinalIgnoreCase) - && !routeData.Values.ContainsKey("id"); - - public async Task Append(dynamic viewModel, RouteData routeData, IQueryCollection query) + [HttpGet("/orders")] + public async Task Handle(HttpRequest request) { // Hardcoded for simplicity. In a production app, a config object could be injected. var url = $"http://localhost:20185/api/orders"; @@ -28,8 +23,10 @@ public async Task Append(dynamic viewModel, RouteData routeData, IQueryCollectio var orderViewModelDictionary = MapToViewModelDictionary(orders); - await viewModel.RaiseEventAsync(new OrdersLoaded { OrderViewModelDictionary = orderViewModelDictionary }); + var compositionContext = request.GetCompositionContext(); + await compositionContext.RaiseEvent(new OrdersLoaded { OrderViewModelDictionary = orderViewModelDictionary }); + var viewModel = request.GetComposedResponseModel(); viewModel.Orders = orderViewModelDictionary.Values; } From bc628f8d0adb444fee48a2f4428e1922b7d47779 Mon Sep 17 00:00:00 2001 From: David Boike Date: Thu, 31 Oct 2024 12:38:39 -0500 Subject: [PATCH 5/9] 2-after & 3-before & fixes --- .../OrdersLoadedSubscriber.cs | 6 +-- .../after/02-publish-subscribe-after.sln | 48 +++++++------------ .../Divergent.CompositionGateway.csproj | 1 - .../Divergent.CompositionGateway/Startup.cs | 9 ++-- ...gent.Customers.ViewModelComposition.csproj | 5 +- .../OrdersLoadedSubscriber.cs | 23 ++++----- ...ergent.Finance.ViewModelComposition.csproj | 5 +- .../OrdersLoadedSubscriber.cs | 23 ++++----- .../Handlers/OrderSubmittedHandler.cs | 12 ++--- ...ivergent.Sales.ViewModelComposition.csproj | 5 +- .../OrdersListViewModelAppender.cs | 27 +++++------ .../Handlers/SubmitOrderHandler.cs | 5 +- .../OrdersLoadedSubscriber.cs | 2 +- exercises/03-sagas/before/03-sagas-before.sln | 48 +++++++------------ .../Divergent.CompositionGateway.csproj | 3 +- .../Divergent.CompositionGateway/Startup.cs | 9 ++-- ...gent.Customers.ViewModelComposition.csproj | 5 +- .../OrdersLoadedSubscriber.cs | 23 ++++----- ...ergent.Finance.ViewModelComposition.csproj | 5 +- .../OrdersLoadedSubscriber.cs | 23 ++++----- ...ivergent.Sales.ViewModelComposition.csproj | 5 +- .../OrdersListViewModelAppender.cs | 27 +++++------ 22 files changed, 138 insertions(+), 181 deletions(-) diff --git a/exercises/01-composite-ui/before/Divergent.Customers.ViewModelComposition/OrdersLoadedSubscriber.cs b/exercises/01-composite-ui/before/Divergent.Customers.ViewModelComposition/OrdersLoadedSubscriber.cs index b959df81..3228ded7 100644 --- a/exercises/01-composite-ui/before/Divergent.Customers.ViewModelComposition/OrdersLoadedSubscriber.cs +++ b/exercises/01-composite-ui/before/Divergent.Customers.ViewModelComposition/OrdersLoadedSubscriber.cs @@ -1,6 +1,6 @@ -using Divergent.Sales.ViewModelComposition.Events; +using System.Net.Http; +using Divergent.Sales.ViewModelComposition.Events; using ITOps.Json; -using System.Net.Http; using Microsoft.AspNetCore.Mvc; using ServiceComposer.AspNetCore; @@ -8,7 +8,7 @@ namespace Divergent.Customers.ViewModelComposition; public class OrdersLoadedSubscriber : ICompositionEventsSubscriber { - [HttpGet("/orders/{id}")] + [HttpGet("/orders")] public void Subscribe(ICompositionEventsPublisher publisher) { publisher.Subscribe(async (ordersLoaded, httpRequest) => diff --git a/exercises/02-publish-subscribe/after/02-publish-subscribe-after.sln b/exercises/02-publish-subscribe/after/02-publish-subscribe-after.sln index b0b3083d..96eb5b9a 100644 --- a/exercises/02-publish-subscribe/after/02-publish-subscribe-after.sln +++ b/exercises/02-publish-subscribe/after/02-publish-subscribe-after.sln @@ -1,31 +1,31 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.27130.2010 +# Visual Studio Version 17 +VisualStudioVersion = 17.11.35327.3 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Customers", "Divergent.Customers\Divergent.Customers.csproj", "{02EE3114-734F-42DF-994C-98480E1489FE}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Customers", "Divergent.Customers\Divergent.Customers.csproj", "{02EE3114-734F-42DF-994C-98480E1489FE}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Finance", "Divergent.Finance\Divergent.Finance.csproj", "{3EE37732-A31A-408D-AC60-2FBF08D09B56}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Finance", "Divergent.Finance\Divergent.Finance.csproj", "{3EE37732-A31A-408D-AC60-2FBF08D09B56}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Sales", "Divergent.Sales\Divergent.Sales.csproj", "{F358BD9C-7138-45C9-AA32-B27F5066FF68}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Sales", "Divergent.Sales\Divergent.Sales.csproj", "{F358BD9C-7138-45C9-AA32-B27F5066FF68}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Website", "Website", "{120B20F8-E388-4973-8F67-8340EADED83B}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Finance.Messages", "Divergent.Finance.Messages\Divergent.Finance.Messages.csproj", "{01CCC8E0-605E-417D-BF33-30881F65A49B}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Finance.Messages", "Divergent.Finance.Messages\Divergent.Finance.Messages.csproj", "{01CCC8E0-605E-417D-BF33-30881F65A49B}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Sales.Messages", "Divergent.Sales.Messages\Divergent.Sales.Messages.csproj", "{FD850B7B-46A5-43EC-9571-C13736E6B033}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Sales.Messages", "Divergent.Sales.Messages\Divergent.Sales.Messages.csproj", "{FD850B7B-46A5-43EC-9571-C13736E6B033}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Customers.Data", "Divergent.Customers.Data\Divergent.Customers.Data.csproj", "{314AA28E-E5A9-40B3-AA9B-C2C0E5BAD059}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Customers.Data", "Divergent.Customers.Data\Divergent.Customers.Data.csproj", "{314AA28E-E5A9-40B3-AA9B-C2C0E5BAD059}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Finance.Data", "Divergent.Finance.Data\Divergent.Finance.Data.csproj", "{FEE53DC5-B52D-49DB-8F07-A8C835998283}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Finance.Data", "Divergent.Finance.Data\Divergent.Finance.Data.csproj", "{FEE53DC5-B52D-49DB-8F07-A8C835998283}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Sales.Data", "Divergent.Sales.Data\Divergent.Sales.Data.csproj", "{80F82F7D-3F0A-4316-87CD-49F19DBD5B85}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Sales.Data", "Divergent.Sales.Data\Divergent.Sales.Data.csproj", "{80F82F7D-3F0A-4316-87CD-49F19DBD5B85}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ExternalSystems", "ExternalSystems", "{41918E2F-FCC6-48D8-8A3C-3EF756BE385C}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PaymentProviders", "externalsystems\MastercardPaymentProvider\PaymentProviders.csproj", "{4EEFC008-F185-480A-8312-D3E9C81C5D95}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PaymentProviders", "externalsystems\MastercardPaymentProvider\PaymentProviders.csproj", "{4EEFC008-F185-480A-8312-D3E9C81C5D95}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Shipping", "Divergent.Shipping\Divergent.Shipping.csproj", "{E8BCB506-5BD6-4963-B4D0-717A26916E46}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Shipping", "Divergent.Shipping\Divergent.Shipping.csproj", "{E8BCB506-5BD6-4963-B4D0-717A26916E46}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Customers", "Customers", "{808B901F-6EF7-49F0-B668-F54EEDB1F3F1}" EndProject @@ -37,22 +37,18 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Shipping", "Shipping", "{BA EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ITOps", "ITOps", "{A9587680-24D6-475A-81E8-8699773B5ED9}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Customers.API", "Divergent.Customers.API\Divergent.Customers.API.csproj", "{222B8A52-4F51-4140-80B4-8AF531E293E4}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Customers.API", "Divergent.Customers.API\Divergent.Customers.API.csproj", "{222B8A52-4F51-4140-80B4-8AF531E293E4}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Finance.API", "Divergent.Finance.API\Divergent.Finance.API.csproj", "{BF4B517B-DBC4-4107-886F-9E246312E9AF}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Finance.API", "Divergent.Finance.API\Divergent.Finance.API.csproj", "{BF4B517B-DBC4-4107-886F-9E246312E9AF}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Sales.API", "Divergent.Sales.API\Divergent.Sales.API.csproj", "{C2FE4732-EA4E-49CC-BE34-46341FB32E09}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Sales.API", "Divergent.Sales.API\Divergent.Sales.API.csproj", "{C2FE4732-EA4E-49CC-BE34-46341FB32E09}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Shipping.Data", "Divergent.Shipping.Data\Divergent.Shipping.Data.csproj", "{C825BBFF-297D-4E68-ABB9-276FD81D4AD4}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Shipping.Data", "Divergent.Shipping.Data\Divergent.Shipping.Data.csproj", "{C825BBFF-297D-4E68-ABB9-276FD81D4AD4}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Frontend", "Divergent.Frontend\Divergent.Frontend.csproj", "{0EE90477-6D50-49A3-A557-3741F568E2ED}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ITOps.ViewModelComposition", "..\..\shared-api-gateway\ITOps.ViewModelComposition\ITOps.ViewModelComposition.csproj", "{888DB2A9-39D2-4B21-8620-8C2BD67AAF6F}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Frontend", "Divergent.Frontend\Divergent.Frontend.csproj", "{0EE90477-6D50-49A3-A557-3741F568E2ED}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ITOps.Json", "..\..\shared-api-gateway\ITOps.Json\ITOps.Json.csproj", "{416C923B-61E5-4182-909C-21651394C05F}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ITOps.ViewModelComposition.Gateway", "..\..\shared-api-gateway\ITOps.ViewModelComposition.Gateway\ITOps.ViewModelComposition.Gateway.csproj", "{A99F2A92-EE56-49FB-970C-5EA7935D1316}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.CompositionGateway", "Divergent.CompositionGateway\Divergent.CompositionGateway.csproj", "{4776CCE0-98E9-4E3A-9DDC-93278D63721E}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Sales.ViewModelComposition", "Divergent.Sales.ViewModelComposition\Divergent.Sales.ViewModelComposition.csproj", "{A476ADD9-1DA4-46E1-8555-6040C52B76D0}" @@ -131,18 +127,10 @@ Global {0EE90477-6D50-49A3-A557-3741F568E2ED}.Debug|Any CPU.Build.0 = Debug|Any CPU {0EE90477-6D50-49A3-A557-3741F568E2ED}.Release|Any CPU.ActiveCfg = Release|Any CPU {0EE90477-6D50-49A3-A557-3741F568E2ED}.Release|Any CPU.Build.0 = Release|Any CPU - {888DB2A9-39D2-4B21-8620-8C2BD67AAF6F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {888DB2A9-39D2-4B21-8620-8C2BD67AAF6F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {888DB2A9-39D2-4B21-8620-8C2BD67AAF6F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {888DB2A9-39D2-4B21-8620-8C2BD67AAF6F}.Release|Any CPU.Build.0 = Release|Any CPU {416C923B-61E5-4182-909C-21651394C05F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {416C923B-61E5-4182-909C-21651394C05F}.Debug|Any CPU.Build.0 = Debug|Any CPU {416C923B-61E5-4182-909C-21651394C05F}.Release|Any CPU.ActiveCfg = Release|Any CPU {416C923B-61E5-4182-909C-21651394C05F}.Release|Any CPU.Build.0 = Release|Any CPU - {A99F2A92-EE56-49FB-970C-5EA7935D1316}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A99F2A92-EE56-49FB-970C-5EA7935D1316}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A99F2A92-EE56-49FB-970C-5EA7935D1316}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A99F2A92-EE56-49FB-970C-5EA7935D1316}.Release|Any CPU.Build.0 = Release|Any CPU {4776CCE0-98E9-4E3A-9DDC-93278D63721E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {4776CCE0-98E9-4E3A-9DDC-93278D63721E}.Debug|Any CPU.Build.0 = Debug|Any CPU {4776CCE0-98E9-4E3A-9DDC-93278D63721E}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -187,9 +175,7 @@ Global {C2FE4732-EA4E-49CC-BE34-46341FB32E09} = {3F113598-B240-4E06-B41A-6C684C208F2A} {C825BBFF-297D-4E68-ABB9-276FD81D4AD4} = {BAFA6668-162F-4D48-8BAD-46A39C59B6FE} {0EE90477-6D50-49A3-A557-3741F568E2ED} = {120B20F8-E388-4973-8F67-8340EADED83B} - {888DB2A9-39D2-4B21-8620-8C2BD67AAF6F} = {A9587680-24D6-475A-81E8-8699773B5ED9} {416C923B-61E5-4182-909C-21651394C05F} = {A9587680-24D6-475A-81E8-8699773B5ED9} - {A99F2A92-EE56-49FB-970C-5EA7935D1316} = {A9587680-24D6-475A-81E8-8699773B5ED9} {4776CCE0-98E9-4E3A-9DDC-93278D63721E} = {120B20F8-E388-4973-8F67-8340EADED83B} {A476ADD9-1DA4-46E1-8555-6040C52B76D0} = {3F113598-B240-4E06-B41A-6C684C208F2A} {D4B3216E-6072-4B7A-97C5-A6FC4C2ABB05} = {3F113598-B240-4E06-B41A-6C684C208F2A} diff --git a/exercises/02-publish-subscribe/after/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj b/exercises/02-publish-subscribe/after/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj index c30c220c..9c02a1f0 100644 --- a/exercises/02-publish-subscribe/after/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj +++ b/exercises/02-publish-subscribe/after/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj @@ -10,7 +10,6 @@ - diff --git a/exercises/02-publish-subscribe/after/Divergent.CompositionGateway/Startup.cs b/exercises/02-publish-subscribe/after/Divergent.CompositionGateway/Startup.cs index 3f2bb613..cab786f1 100644 --- a/exercises/02-publish-subscribe/after/Divergent.CompositionGateway/Startup.cs +++ b/exercises/02-publish-subscribe/after/Divergent.CompositionGateway/Startup.cs @@ -1,5 +1,4 @@ -using ITOps.ViewModelComposition; -using ITOps.ViewModelComposition.Gateway; +using ServiceComposer.AspNetCore; namespace Divergent.CompositionGateway; @@ -21,6 +20,10 @@ public void Configure(IApplicationBuilder app) policyBuilder.AllowAnyHeader(); }); - app.RunCompositionGatewayWithDefaultRoutes(); + app.UseRouting(); + app.UseEndpoints(builder => + { + builder.MapCompositionHandlers(); + }); } } \ No newline at end of file diff --git a/exercises/02-publish-subscribe/after/Divergent.Customers.ViewModelComposition/Divergent.Customers.ViewModelComposition.csproj b/exercises/02-publish-subscribe/after/Divergent.Customers.ViewModelComposition/Divergent.Customers.ViewModelComposition.csproj index 6ec89002..78d59079 100644 --- a/exercises/02-publish-subscribe/after/Divergent.Customers.ViewModelComposition/Divergent.Customers.ViewModelComposition.csproj +++ b/exercises/02-publish-subscribe/after/Divergent.Customers.ViewModelComposition/Divergent.Customers.ViewModelComposition.csproj @@ -4,9 +4,12 @@ net8.0 + + + + - diff --git a/exercises/02-publish-subscribe/after/Divergent.Customers.ViewModelComposition/OrdersLoadedSubscriber.cs b/exercises/02-publish-subscribe/after/Divergent.Customers.ViewModelComposition/OrdersLoadedSubscriber.cs index 8ef5169e..3228ded7 100644 --- a/exercises/02-publish-subscribe/after/Divergent.Customers.ViewModelComposition/OrdersLoadedSubscriber.cs +++ b/exercises/02-publish-subscribe/after/Divergent.Customers.ViewModelComposition/OrdersLoadedSubscriber.cs @@ -1,24 +1,17 @@ -using Divergent.Sales.ViewModelComposition.Events; +using System.Net.Http; +using Divergent.Sales.ViewModelComposition.Events; using ITOps.Json; -using ITOps.ViewModelComposition; -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Routing; -using System; -using System.Net.Http; +using Microsoft.AspNetCore.Mvc; +using ServiceComposer.AspNetCore; namespace Divergent.Customers.ViewModelComposition; -public class OrdersLoadedSubscriber : ISubscribeToCompositionEvents +public class OrdersLoadedSubscriber : ICompositionEventsSubscriber { - // Very simple matching for the purpose of the exercise. - public bool Matches(RouteData routeData, string httpMethod) => - HttpMethods.IsGet(httpMethod) - && string.Equals((string)routeData.Values["controller"], "orders", StringComparison.OrdinalIgnoreCase) - && !routeData.Values.ContainsKey("id"); - - public void Subscribe(IPublishCompositionEvents publisher) + [HttpGet("/orders")] + public void Subscribe(ICompositionEventsPublisher publisher) { - publisher.Subscribe(async (pageViewModel, ordersLoaded, routeData, query) => + publisher.Subscribe(async (ordersLoaded, httpRequest) => { var orderIds = string.Join(",", ordersLoaded.OrderViewModelDictionary.Keys); diff --git a/exercises/02-publish-subscribe/after/Divergent.Finance.ViewModelComposition/Divergent.Finance.ViewModelComposition.csproj b/exercises/02-publish-subscribe/after/Divergent.Finance.ViewModelComposition/Divergent.Finance.ViewModelComposition.csproj index 6ec89002..78d59079 100644 --- a/exercises/02-publish-subscribe/after/Divergent.Finance.ViewModelComposition/Divergent.Finance.ViewModelComposition.csproj +++ b/exercises/02-publish-subscribe/after/Divergent.Finance.ViewModelComposition/Divergent.Finance.ViewModelComposition.csproj @@ -4,9 +4,12 @@ net8.0 + + + + - diff --git a/exercises/02-publish-subscribe/after/Divergent.Finance.ViewModelComposition/OrdersLoadedSubscriber.cs b/exercises/02-publish-subscribe/after/Divergent.Finance.ViewModelComposition/OrdersLoadedSubscriber.cs index c5dda4a6..7fe01b1c 100644 --- a/exercises/02-publish-subscribe/after/Divergent.Finance.ViewModelComposition/OrdersLoadedSubscriber.cs +++ b/exercises/02-publish-subscribe/after/Divergent.Finance.ViewModelComposition/OrdersLoadedSubscriber.cs @@ -1,24 +1,17 @@ -using Divergent.Sales.ViewModelComposition.Events; +using System.Net.Http; +using Divergent.Sales.ViewModelComposition.Events; using ITOps.Json; -using ITOps.ViewModelComposition; -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Routing; -using System; -using System.Net.Http; +using Microsoft.AspNetCore.Mvc; +using ServiceComposer.AspNetCore; namespace Divergent.Finance.ViewModelComposition; -public class OrdersLoadedSubscriber : ISubscribeToCompositionEvents +public class OrdersLoadedSubscriber : ICompositionEventsSubscriber { - // Very simple matching for the purpose of the exercise. - public bool Matches(RouteData routeData, string httpMethod) => - HttpMethods.IsGet(httpMethod) - && string.Equals((string)routeData.Values["controller"], "orders", StringComparison.OrdinalIgnoreCase) - && !routeData.Values.ContainsKey("id"); - - public void Subscribe(IPublishCompositionEvents publisher) + [HttpGet("/orders")] + public void Subscribe(ICompositionEventsPublisher publisher) { - publisher.Subscribe(async (pageViewModel, ordersLoaded, routeData, query) => + publisher.Subscribe(async (ordersLoaded, httpRequest) => { var orderIds = string.Join(",", ordersLoaded.OrderViewModelDictionary.Keys); diff --git a/exercises/02-publish-subscribe/after/Divergent.Finance/Handlers/OrderSubmittedHandler.cs b/exercises/02-publish-subscribe/after/Divergent.Finance/Handlers/OrderSubmittedHandler.cs index d5018b0b..a95acd04 100644 --- a/exercises/02-publish-subscribe/after/Divergent.Finance/Handlers/OrderSubmittedHandler.cs +++ b/exercises/02-publish-subscribe/after/Divergent.Finance/Handlers/OrderSubmittedHandler.cs @@ -1,8 +1,8 @@ -using Divergent.Sales.Messages.Events; -using NServiceBus; -using Divergent.Finance.Data.Models; +using Divergent.Finance.Data.Models; using Divergent.Finance.Messages.Commands; +using Divergent.Sales.Messages.Events; using ITOps.EndpointConfig; +using NServiceBus; namespace Divergent.Finance.Handlers; @@ -25,10 +25,10 @@ public async Task Handle(OrderSubmittedEvent message, IMessageHandlerContext con var prices = db.Database.GetCollection(); var orderItemPrices = db.Database.GetCollection(); - + var query = from price in prices.Query() - where message.Products.Contains(price.ProductId) - select price; + where message.Products.Contains(price.ProductId) + select price; foreach (var price in query.ToList()) { diff --git a/exercises/02-publish-subscribe/after/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj b/exercises/02-publish-subscribe/after/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj index 1a0c6ec8..7d3bd827 100644 --- a/exercises/02-publish-subscribe/after/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj +++ b/exercises/02-publish-subscribe/after/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj @@ -4,10 +4,13 @@ net8.0 + + + + - \ No newline at end of file diff --git a/exercises/02-publish-subscribe/after/Divergent.Sales.ViewModelComposition/OrdersListViewModelAppender.cs b/exercises/02-publish-subscribe/after/Divergent.Sales.ViewModelComposition/OrdersListViewModelAppender.cs index 84b19000..cb791b56 100644 --- a/exercises/02-publish-subscribe/after/Divergent.Sales.ViewModelComposition/OrdersListViewModelAppender.cs +++ b/exercises/02-publish-subscribe/after/Divergent.Sales.ViewModelComposition/OrdersListViewModelAppender.cs @@ -1,24 +1,19 @@ -using Divergent.Sales.ViewModelComposition.Events; -using ITOps.Json; -using ITOps.ViewModelComposition; -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Routing; -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Dynamic; using System.Net.Http; using System.Threading.Tasks; +using Divergent.Sales.ViewModelComposition.Events; +using ITOps.Json; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using ServiceComposer.AspNetCore; namespace Divergent.Sales.ViewModelComposition; -public class OrdersListViewModelAppender : IViewModelAppender +public class OrdersListViewModelAppender : ICompositionRequestsHandler { - public bool Matches(RouteData routeData, string httpMethod) => - HttpMethods.IsGet(httpMethod) - && string.Equals((string)routeData.Values["controller"], "orders", StringComparison.OrdinalIgnoreCase) - && !routeData.Values.ContainsKey("id"); - - public async Task Append(dynamic viewModel, RouteData routeData, IQueryCollection query) + [HttpGet("/orders")] + public async Task Handle(HttpRequest request) { // Hardcoded for simplicity. In a production app, a config object could be injected. var url = $"http://localhost:20185/api/orders"; @@ -28,8 +23,10 @@ public async Task Append(dynamic viewModel, RouteData routeData, IQueryCollectio var orderViewModelDictionary = MapToViewModelDictionary(orders); - await viewModel.RaiseEventAsync(new OrdersLoaded { OrderViewModelDictionary = orderViewModelDictionary }); + var compositionContext = request.GetCompositionContext(); + await compositionContext.RaiseEvent(new OrdersLoaded { OrderViewModelDictionary = orderViewModelDictionary }); + var viewModel = request.GetComposedResponseModel(); viewModel.Orders = orderViewModelDictionary.Values; } diff --git a/exercises/02-publish-subscribe/after/Divergent.Sales/Handlers/SubmitOrderHandler.cs b/exercises/02-publish-subscribe/after/Divergent.Sales/Handlers/SubmitOrderHandler.cs index 0d99fabe..8689e82e 100644 --- a/exercises/02-publish-subscribe/after/Divergent.Sales/Handlers/SubmitOrderHandler.cs +++ b/exercises/02-publish-subscribe/after/Divergent.Sales/Handlers/SubmitOrderHandler.cs @@ -1,10 +1,7 @@ -using System.Net.Http.Headers; -using System.Net.NetworkInformation; -using Divergent.Sales.Data.Models; +using Divergent.Sales.Data.Models; using Divergent.Sales.Messages.Commands; using Divergent.Sales.Messages.Events; using ITOps.EndpointConfig; -using LiteDB; using NServiceBus; namespace Divergent.Sales.Handlers; diff --git a/exercises/02-publish-subscribe/before/Divergent.Customers.ViewModelComposition/OrdersLoadedSubscriber.cs b/exercises/02-publish-subscribe/before/Divergent.Customers.ViewModelComposition/OrdersLoadedSubscriber.cs index f0a6d4c1..3228ded7 100644 --- a/exercises/02-publish-subscribe/before/Divergent.Customers.ViewModelComposition/OrdersLoadedSubscriber.cs +++ b/exercises/02-publish-subscribe/before/Divergent.Customers.ViewModelComposition/OrdersLoadedSubscriber.cs @@ -8,7 +8,7 @@ namespace Divergent.Customers.ViewModelComposition; public class OrdersLoadedSubscriber : ICompositionEventsSubscriber { - [HttpGet("/orders/{id}")] + [HttpGet("/orders")] public void Subscribe(ICompositionEventsPublisher publisher) { publisher.Subscribe(async (ordersLoaded, httpRequest) => diff --git a/exercises/03-sagas/before/03-sagas-before.sln b/exercises/03-sagas/before/03-sagas-before.sln index b0b3083d..96eb5b9a 100644 --- a/exercises/03-sagas/before/03-sagas-before.sln +++ b/exercises/03-sagas/before/03-sagas-before.sln @@ -1,31 +1,31 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.27130.2010 +# Visual Studio Version 17 +VisualStudioVersion = 17.11.35327.3 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Customers", "Divergent.Customers\Divergent.Customers.csproj", "{02EE3114-734F-42DF-994C-98480E1489FE}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Customers", "Divergent.Customers\Divergent.Customers.csproj", "{02EE3114-734F-42DF-994C-98480E1489FE}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Finance", "Divergent.Finance\Divergent.Finance.csproj", "{3EE37732-A31A-408D-AC60-2FBF08D09B56}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Finance", "Divergent.Finance\Divergent.Finance.csproj", "{3EE37732-A31A-408D-AC60-2FBF08D09B56}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Sales", "Divergent.Sales\Divergent.Sales.csproj", "{F358BD9C-7138-45C9-AA32-B27F5066FF68}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Sales", "Divergent.Sales\Divergent.Sales.csproj", "{F358BD9C-7138-45C9-AA32-B27F5066FF68}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Website", "Website", "{120B20F8-E388-4973-8F67-8340EADED83B}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Finance.Messages", "Divergent.Finance.Messages\Divergent.Finance.Messages.csproj", "{01CCC8E0-605E-417D-BF33-30881F65A49B}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Finance.Messages", "Divergent.Finance.Messages\Divergent.Finance.Messages.csproj", "{01CCC8E0-605E-417D-BF33-30881F65A49B}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Sales.Messages", "Divergent.Sales.Messages\Divergent.Sales.Messages.csproj", "{FD850B7B-46A5-43EC-9571-C13736E6B033}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Sales.Messages", "Divergent.Sales.Messages\Divergent.Sales.Messages.csproj", "{FD850B7B-46A5-43EC-9571-C13736E6B033}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Customers.Data", "Divergent.Customers.Data\Divergent.Customers.Data.csproj", "{314AA28E-E5A9-40B3-AA9B-C2C0E5BAD059}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Customers.Data", "Divergent.Customers.Data\Divergent.Customers.Data.csproj", "{314AA28E-E5A9-40B3-AA9B-C2C0E5BAD059}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Finance.Data", "Divergent.Finance.Data\Divergent.Finance.Data.csproj", "{FEE53DC5-B52D-49DB-8F07-A8C835998283}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Finance.Data", "Divergent.Finance.Data\Divergent.Finance.Data.csproj", "{FEE53DC5-B52D-49DB-8F07-A8C835998283}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Sales.Data", "Divergent.Sales.Data\Divergent.Sales.Data.csproj", "{80F82F7D-3F0A-4316-87CD-49F19DBD5B85}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Sales.Data", "Divergent.Sales.Data\Divergent.Sales.Data.csproj", "{80F82F7D-3F0A-4316-87CD-49F19DBD5B85}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ExternalSystems", "ExternalSystems", "{41918E2F-FCC6-48D8-8A3C-3EF756BE385C}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PaymentProviders", "externalsystems\MastercardPaymentProvider\PaymentProviders.csproj", "{4EEFC008-F185-480A-8312-D3E9C81C5D95}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PaymentProviders", "externalsystems\MastercardPaymentProvider\PaymentProviders.csproj", "{4EEFC008-F185-480A-8312-D3E9C81C5D95}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Shipping", "Divergent.Shipping\Divergent.Shipping.csproj", "{E8BCB506-5BD6-4963-B4D0-717A26916E46}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Shipping", "Divergent.Shipping\Divergent.Shipping.csproj", "{E8BCB506-5BD6-4963-B4D0-717A26916E46}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Customers", "Customers", "{808B901F-6EF7-49F0-B668-F54EEDB1F3F1}" EndProject @@ -37,22 +37,18 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Shipping", "Shipping", "{BA EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ITOps", "ITOps", "{A9587680-24D6-475A-81E8-8699773B5ED9}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Customers.API", "Divergent.Customers.API\Divergent.Customers.API.csproj", "{222B8A52-4F51-4140-80B4-8AF531E293E4}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Customers.API", "Divergent.Customers.API\Divergent.Customers.API.csproj", "{222B8A52-4F51-4140-80B4-8AF531E293E4}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Finance.API", "Divergent.Finance.API\Divergent.Finance.API.csproj", "{BF4B517B-DBC4-4107-886F-9E246312E9AF}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Finance.API", "Divergent.Finance.API\Divergent.Finance.API.csproj", "{BF4B517B-DBC4-4107-886F-9E246312E9AF}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Sales.API", "Divergent.Sales.API\Divergent.Sales.API.csproj", "{C2FE4732-EA4E-49CC-BE34-46341FB32E09}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Sales.API", "Divergent.Sales.API\Divergent.Sales.API.csproj", "{C2FE4732-EA4E-49CC-BE34-46341FB32E09}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Shipping.Data", "Divergent.Shipping.Data\Divergent.Shipping.Data.csproj", "{C825BBFF-297D-4E68-ABB9-276FD81D4AD4}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Shipping.Data", "Divergent.Shipping.Data\Divergent.Shipping.Data.csproj", "{C825BBFF-297D-4E68-ABB9-276FD81D4AD4}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Frontend", "Divergent.Frontend\Divergent.Frontend.csproj", "{0EE90477-6D50-49A3-A557-3741F568E2ED}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ITOps.ViewModelComposition", "..\..\shared-api-gateway\ITOps.ViewModelComposition\ITOps.ViewModelComposition.csproj", "{888DB2A9-39D2-4B21-8620-8C2BD67AAF6F}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Frontend", "Divergent.Frontend\Divergent.Frontend.csproj", "{0EE90477-6D50-49A3-A557-3741F568E2ED}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ITOps.Json", "..\..\shared-api-gateway\ITOps.Json\ITOps.Json.csproj", "{416C923B-61E5-4182-909C-21651394C05F}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ITOps.ViewModelComposition.Gateway", "..\..\shared-api-gateway\ITOps.ViewModelComposition.Gateway\ITOps.ViewModelComposition.Gateway.csproj", "{A99F2A92-EE56-49FB-970C-5EA7935D1316}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.CompositionGateway", "Divergent.CompositionGateway\Divergent.CompositionGateway.csproj", "{4776CCE0-98E9-4E3A-9DDC-93278D63721E}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Sales.ViewModelComposition", "Divergent.Sales.ViewModelComposition\Divergent.Sales.ViewModelComposition.csproj", "{A476ADD9-1DA4-46E1-8555-6040C52B76D0}" @@ -131,18 +127,10 @@ Global {0EE90477-6D50-49A3-A557-3741F568E2ED}.Debug|Any CPU.Build.0 = Debug|Any CPU {0EE90477-6D50-49A3-A557-3741F568E2ED}.Release|Any CPU.ActiveCfg = Release|Any CPU {0EE90477-6D50-49A3-A557-3741F568E2ED}.Release|Any CPU.Build.0 = Release|Any CPU - {888DB2A9-39D2-4B21-8620-8C2BD67AAF6F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {888DB2A9-39D2-4B21-8620-8C2BD67AAF6F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {888DB2A9-39D2-4B21-8620-8C2BD67AAF6F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {888DB2A9-39D2-4B21-8620-8C2BD67AAF6F}.Release|Any CPU.Build.0 = Release|Any CPU {416C923B-61E5-4182-909C-21651394C05F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {416C923B-61E5-4182-909C-21651394C05F}.Debug|Any CPU.Build.0 = Debug|Any CPU {416C923B-61E5-4182-909C-21651394C05F}.Release|Any CPU.ActiveCfg = Release|Any CPU {416C923B-61E5-4182-909C-21651394C05F}.Release|Any CPU.Build.0 = Release|Any CPU - {A99F2A92-EE56-49FB-970C-5EA7935D1316}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A99F2A92-EE56-49FB-970C-5EA7935D1316}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A99F2A92-EE56-49FB-970C-5EA7935D1316}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A99F2A92-EE56-49FB-970C-5EA7935D1316}.Release|Any CPU.Build.0 = Release|Any CPU {4776CCE0-98E9-4E3A-9DDC-93278D63721E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {4776CCE0-98E9-4E3A-9DDC-93278D63721E}.Debug|Any CPU.Build.0 = Debug|Any CPU {4776CCE0-98E9-4E3A-9DDC-93278D63721E}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -187,9 +175,7 @@ Global {C2FE4732-EA4E-49CC-BE34-46341FB32E09} = {3F113598-B240-4E06-B41A-6C684C208F2A} {C825BBFF-297D-4E68-ABB9-276FD81D4AD4} = {BAFA6668-162F-4D48-8BAD-46A39C59B6FE} {0EE90477-6D50-49A3-A557-3741F568E2ED} = {120B20F8-E388-4973-8F67-8340EADED83B} - {888DB2A9-39D2-4B21-8620-8C2BD67AAF6F} = {A9587680-24D6-475A-81E8-8699773B5ED9} {416C923B-61E5-4182-909C-21651394C05F} = {A9587680-24D6-475A-81E8-8699773B5ED9} - {A99F2A92-EE56-49FB-970C-5EA7935D1316} = {A9587680-24D6-475A-81E8-8699773B5ED9} {4776CCE0-98E9-4E3A-9DDC-93278D63721E} = {120B20F8-E388-4973-8F67-8340EADED83B} {A476ADD9-1DA4-46E1-8555-6040C52B76D0} = {3F113598-B240-4E06-B41A-6C684C208F2A} {D4B3216E-6072-4B7A-97C5-A6FC4C2ABB05} = {3F113598-B240-4E06-B41A-6C684C208F2A} diff --git a/exercises/03-sagas/before/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj b/exercises/03-sagas/before/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj index c30c220c..c1ea4207 100644 --- a/exercises/03-sagas/before/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj +++ b/exercises/03-sagas/before/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj @@ -6,11 +6,10 @@ - + - diff --git a/exercises/03-sagas/before/Divergent.CompositionGateway/Startup.cs b/exercises/03-sagas/before/Divergent.CompositionGateway/Startup.cs index 3f2bb613..cab786f1 100644 --- a/exercises/03-sagas/before/Divergent.CompositionGateway/Startup.cs +++ b/exercises/03-sagas/before/Divergent.CompositionGateway/Startup.cs @@ -1,5 +1,4 @@ -using ITOps.ViewModelComposition; -using ITOps.ViewModelComposition.Gateway; +using ServiceComposer.AspNetCore; namespace Divergent.CompositionGateway; @@ -21,6 +20,10 @@ public void Configure(IApplicationBuilder app) policyBuilder.AllowAnyHeader(); }); - app.RunCompositionGatewayWithDefaultRoutes(); + app.UseRouting(); + app.UseEndpoints(builder => + { + builder.MapCompositionHandlers(); + }); } } \ No newline at end of file diff --git a/exercises/03-sagas/before/Divergent.Customers.ViewModelComposition/Divergent.Customers.ViewModelComposition.csproj b/exercises/03-sagas/before/Divergent.Customers.ViewModelComposition/Divergent.Customers.ViewModelComposition.csproj index 6ec89002..78d59079 100644 --- a/exercises/03-sagas/before/Divergent.Customers.ViewModelComposition/Divergent.Customers.ViewModelComposition.csproj +++ b/exercises/03-sagas/before/Divergent.Customers.ViewModelComposition/Divergent.Customers.ViewModelComposition.csproj @@ -4,9 +4,12 @@ net8.0 + + + + - diff --git a/exercises/03-sagas/before/Divergent.Customers.ViewModelComposition/OrdersLoadedSubscriber.cs b/exercises/03-sagas/before/Divergent.Customers.ViewModelComposition/OrdersLoadedSubscriber.cs index 8ef5169e..3228ded7 100644 --- a/exercises/03-sagas/before/Divergent.Customers.ViewModelComposition/OrdersLoadedSubscriber.cs +++ b/exercises/03-sagas/before/Divergent.Customers.ViewModelComposition/OrdersLoadedSubscriber.cs @@ -1,24 +1,17 @@ -using Divergent.Sales.ViewModelComposition.Events; +using System.Net.Http; +using Divergent.Sales.ViewModelComposition.Events; using ITOps.Json; -using ITOps.ViewModelComposition; -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Routing; -using System; -using System.Net.Http; +using Microsoft.AspNetCore.Mvc; +using ServiceComposer.AspNetCore; namespace Divergent.Customers.ViewModelComposition; -public class OrdersLoadedSubscriber : ISubscribeToCompositionEvents +public class OrdersLoadedSubscriber : ICompositionEventsSubscriber { - // Very simple matching for the purpose of the exercise. - public bool Matches(RouteData routeData, string httpMethod) => - HttpMethods.IsGet(httpMethod) - && string.Equals((string)routeData.Values["controller"], "orders", StringComparison.OrdinalIgnoreCase) - && !routeData.Values.ContainsKey("id"); - - public void Subscribe(IPublishCompositionEvents publisher) + [HttpGet("/orders")] + public void Subscribe(ICompositionEventsPublisher publisher) { - publisher.Subscribe(async (pageViewModel, ordersLoaded, routeData, query) => + publisher.Subscribe(async (ordersLoaded, httpRequest) => { var orderIds = string.Join(",", ordersLoaded.OrderViewModelDictionary.Keys); diff --git a/exercises/03-sagas/before/Divergent.Finance.ViewModelComposition/Divergent.Finance.ViewModelComposition.csproj b/exercises/03-sagas/before/Divergent.Finance.ViewModelComposition/Divergent.Finance.ViewModelComposition.csproj index 6ec89002..78d59079 100644 --- a/exercises/03-sagas/before/Divergent.Finance.ViewModelComposition/Divergent.Finance.ViewModelComposition.csproj +++ b/exercises/03-sagas/before/Divergent.Finance.ViewModelComposition/Divergent.Finance.ViewModelComposition.csproj @@ -4,9 +4,12 @@ net8.0 + + + + - diff --git a/exercises/03-sagas/before/Divergent.Finance.ViewModelComposition/OrdersLoadedSubscriber.cs b/exercises/03-sagas/before/Divergent.Finance.ViewModelComposition/OrdersLoadedSubscriber.cs index c5dda4a6..7fe01b1c 100644 --- a/exercises/03-sagas/before/Divergent.Finance.ViewModelComposition/OrdersLoadedSubscriber.cs +++ b/exercises/03-sagas/before/Divergent.Finance.ViewModelComposition/OrdersLoadedSubscriber.cs @@ -1,24 +1,17 @@ -using Divergent.Sales.ViewModelComposition.Events; +using System.Net.Http; +using Divergent.Sales.ViewModelComposition.Events; using ITOps.Json; -using ITOps.ViewModelComposition; -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Routing; -using System; -using System.Net.Http; +using Microsoft.AspNetCore.Mvc; +using ServiceComposer.AspNetCore; namespace Divergent.Finance.ViewModelComposition; -public class OrdersLoadedSubscriber : ISubscribeToCompositionEvents +public class OrdersLoadedSubscriber : ICompositionEventsSubscriber { - // Very simple matching for the purpose of the exercise. - public bool Matches(RouteData routeData, string httpMethod) => - HttpMethods.IsGet(httpMethod) - && string.Equals((string)routeData.Values["controller"], "orders", StringComparison.OrdinalIgnoreCase) - && !routeData.Values.ContainsKey("id"); - - public void Subscribe(IPublishCompositionEvents publisher) + [HttpGet("/orders")] + public void Subscribe(ICompositionEventsPublisher publisher) { - publisher.Subscribe(async (pageViewModel, ordersLoaded, routeData, query) => + publisher.Subscribe(async (ordersLoaded, httpRequest) => { var orderIds = string.Join(",", ordersLoaded.OrderViewModelDictionary.Keys); diff --git a/exercises/03-sagas/before/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj b/exercises/03-sagas/before/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj index 1a0c6ec8..7d3bd827 100644 --- a/exercises/03-sagas/before/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj +++ b/exercises/03-sagas/before/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj @@ -4,10 +4,13 @@ net8.0 + + + + - \ No newline at end of file diff --git a/exercises/03-sagas/before/Divergent.Sales.ViewModelComposition/OrdersListViewModelAppender.cs b/exercises/03-sagas/before/Divergent.Sales.ViewModelComposition/OrdersListViewModelAppender.cs index 84b19000..cb791b56 100644 --- a/exercises/03-sagas/before/Divergent.Sales.ViewModelComposition/OrdersListViewModelAppender.cs +++ b/exercises/03-sagas/before/Divergent.Sales.ViewModelComposition/OrdersListViewModelAppender.cs @@ -1,24 +1,19 @@ -using Divergent.Sales.ViewModelComposition.Events; -using ITOps.Json; -using ITOps.ViewModelComposition; -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Routing; -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Dynamic; using System.Net.Http; using System.Threading.Tasks; +using Divergent.Sales.ViewModelComposition.Events; +using ITOps.Json; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using ServiceComposer.AspNetCore; namespace Divergent.Sales.ViewModelComposition; -public class OrdersListViewModelAppender : IViewModelAppender +public class OrdersListViewModelAppender : ICompositionRequestsHandler { - public bool Matches(RouteData routeData, string httpMethod) => - HttpMethods.IsGet(httpMethod) - && string.Equals((string)routeData.Values["controller"], "orders", StringComparison.OrdinalIgnoreCase) - && !routeData.Values.ContainsKey("id"); - - public async Task Append(dynamic viewModel, RouteData routeData, IQueryCollection query) + [HttpGet("/orders")] + public async Task Handle(HttpRequest request) { // Hardcoded for simplicity. In a production app, a config object could be injected. var url = $"http://localhost:20185/api/orders"; @@ -28,8 +23,10 @@ public async Task Append(dynamic viewModel, RouteData routeData, IQueryCollectio var orderViewModelDictionary = MapToViewModelDictionary(orders); - await viewModel.RaiseEventAsync(new OrdersLoaded { OrderViewModelDictionary = orderViewModelDictionary }); + var compositionContext = request.GetCompositionContext(); + await compositionContext.RaiseEvent(new OrdersLoaded { OrderViewModelDictionary = orderViewModelDictionary }); + var viewModel = request.GetComposedResponseModel(); viewModel.Orders = orderViewModelDictionary.Values; } From 4b7ae3a93b977ba52f3cad84b8bdaef74fbe0478 Mon Sep 17 00:00:00 2001 From: David Boike Date: Thu, 31 Oct 2024 12:46:37 -0500 Subject: [PATCH 6/9] 3-after --- exercises/03-sagas/after/03-sagas-after.sln | 48 +++++++------------ .../Divergent.CompositionGateway.csproj | 5 -- .../Divergent.CompositionGateway/Startup.cs | 9 ++-- ...gent.Customers.ViewModelComposition.csproj | 5 +- .../OrdersLoadedSubscriber.cs | 23 ++++----- ...ergent.Finance.ViewModelComposition.csproj | 5 +- .../OrdersLoadedSubscriber.cs | 23 ++++----- ...ivergent.Sales.ViewModelComposition.csproj | 5 +- .../OrdersListViewModelAppender.cs | 27 +++++------ 9 files changed, 63 insertions(+), 87 deletions(-) diff --git a/exercises/03-sagas/after/03-sagas-after.sln b/exercises/03-sagas/after/03-sagas-after.sln index b0b3083d..96eb5b9a 100644 --- a/exercises/03-sagas/after/03-sagas-after.sln +++ b/exercises/03-sagas/after/03-sagas-after.sln @@ -1,31 +1,31 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.27130.2010 +# Visual Studio Version 17 +VisualStudioVersion = 17.11.35327.3 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Customers", "Divergent.Customers\Divergent.Customers.csproj", "{02EE3114-734F-42DF-994C-98480E1489FE}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Customers", "Divergent.Customers\Divergent.Customers.csproj", "{02EE3114-734F-42DF-994C-98480E1489FE}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Finance", "Divergent.Finance\Divergent.Finance.csproj", "{3EE37732-A31A-408D-AC60-2FBF08D09B56}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Finance", "Divergent.Finance\Divergent.Finance.csproj", "{3EE37732-A31A-408D-AC60-2FBF08D09B56}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Sales", "Divergent.Sales\Divergent.Sales.csproj", "{F358BD9C-7138-45C9-AA32-B27F5066FF68}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Sales", "Divergent.Sales\Divergent.Sales.csproj", "{F358BD9C-7138-45C9-AA32-B27F5066FF68}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Website", "Website", "{120B20F8-E388-4973-8F67-8340EADED83B}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Finance.Messages", "Divergent.Finance.Messages\Divergent.Finance.Messages.csproj", "{01CCC8E0-605E-417D-BF33-30881F65A49B}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Finance.Messages", "Divergent.Finance.Messages\Divergent.Finance.Messages.csproj", "{01CCC8E0-605E-417D-BF33-30881F65A49B}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Sales.Messages", "Divergent.Sales.Messages\Divergent.Sales.Messages.csproj", "{FD850B7B-46A5-43EC-9571-C13736E6B033}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Sales.Messages", "Divergent.Sales.Messages\Divergent.Sales.Messages.csproj", "{FD850B7B-46A5-43EC-9571-C13736E6B033}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Customers.Data", "Divergent.Customers.Data\Divergent.Customers.Data.csproj", "{314AA28E-E5A9-40B3-AA9B-C2C0E5BAD059}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Customers.Data", "Divergent.Customers.Data\Divergent.Customers.Data.csproj", "{314AA28E-E5A9-40B3-AA9B-C2C0E5BAD059}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Finance.Data", "Divergent.Finance.Data\Divergent.Finance.Data.csproj", "{FEE53DC5-B52D-49DB-8F07-A8C835998283}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Finance.Data", "Divergent.Finance.Data\Divergent.Finance.Data.csproj", "{FEE53DC5-B52D-49DB-8F07-A8C835998283}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Sales.Data", "Divergent.Sales.Data\Divergent.Sales.Data.csproj", "{80F82F7D-3F0A-4316-87CD-49F19DBD5B85}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Sales.Data", "Divergent.Sales.Data\Divergent.Sales.Data.csproj", "{80F82F7D-3F0A-4316-87CD-49F19DBD5B85}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ExternalSystems", "ExternalSystems", "{41918E2F-FCC6-48D8-8A3C-3EF756BE385C}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PaymentProviders", "externalsystems\MastercardPaymentProvider\PaymentProviders.csproj", "{4EEFC008-F185-480A-8312-D3E9C81C5D95}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PaymentProviders", "externalsystems\MastercardPaymentProvider\PaymentProviders.csproj", "{4EEFC008-F185-480A-8312-D3E9C81C5D95}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Shipping", "Divergent.Shipping\Divergent.Shipping.csproj", "{E8BCB506-5BD6-4963-B4D0-717A26916E46}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Shipping", "Divergent.Shipping\Divergent.Shipping.csproj", "{E8BCB506-5BD6-4963-B4D0-717A26916E46}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Customers", "Customers", "{808B901F-6EF7-49F0-B668-F54EEDB1F3F1}" EndProject @@ -37,22 +37,18 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Shipping", "Shipping", "{BA EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ITOps", "ITOps", "{A9587680-24D6-475A-81E8-8699773B5ED9}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Customers.API", "Divergent.Customers.API\Divergent.Customers.API.csproj", "{222B8A52-4F51-4140-80B4-8AF531E293E4}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Customers.API", "Divergent.Customers.API\Divergent.Customers.API.csproj", "{222B8A52-4F51-4140-80B4-8AF531E293E4}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Finance.API", "Divergent.Finance.API\Divergent.Finance.API.csproj", "{BF4B517B-DBC4-4107-886F-9E246312E9AF}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Finance.API", "Divergent.Finance.API\Divergent.Finance.API.csproj", "{BF4B517B-DBC4-4107-886F-9E246312E9AF}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Sales.API", "Divergent.Sales.API\Divergent.Sales.API.csproj", "{C2FE4732-EA4E-49CC-BE34-46341FB32E09}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Sales.API", "Divergent.Sales.API\Divergent.Sales.API.csproj", "{C2FE4732-EA4E-49CC-BE34-46341FB32E09}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Shipping.Data", "Divergent.Shipping.Data\Divergent.Shipping.Data.csproj", "{C825BBFF-297D-4E68-ABB9-276FD81D4AD4}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Shipping.Data", "Divergent.Shipping.Data\Divergent.Shipping.Data.csproj", "{C825BBFF-297D-4E68-ABB9-276FD81D4AD4}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Frontend", "Divergent.Frontend\Divergent.Frontend.csproj", "{0EE90477-6D50-49A3-A557-3741F568E2ED}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ITOps.ViewModelComposition", "..\..\shared-api-gateway\ITOps.ViewModelComposition\ITOps.ViewModelComposition.csproj", "{888DB2A9-39D2-4B21-8620-8C2BD67AAF6F}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Frontend", "Divergent.Frontend\Divergent.Frontend.csproj", "{0EE90477-6D50-49A3-A557-3741F568E2ED}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ITOps.Json", "..\..\shared-api-gateway\ITOps.Json\ITOps.Json.csproj", "{416C923B-61E5-4182-909C-21651394C05F}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ITOps.ViewModelComposition.Gateway", "..\..\shared-api-gateway\ITOps.ViewModelComposition.Gateway\ITOps.ViewModelComposition.Gateway.csproj", "{A99F2A92-EE56-49FB-970C-5EA7935D1316}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.CompositionGateway", "Divergent.CompositionGateway\Divergent.CompositionGateway.csproj", "{4776CCE0-98E9-4E3A-9DDC-93278D63721E}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Sales.ViewModelComposition", "Divergent.Sales.ViewModelComposition\Divergent.Sales.ViewModelComposition.csproj", "{A476ADD9-1DA4-46E1-8555-6040C52B76D0}" @@ -131,18 +127,10 @@ Global {0EE90477-6D50-49A3-A557-3741F568E2ED}.Debug|Any CPU.Build.0 = Debug|Any CPU {0EE90477-6D50-49A3-A557-3741F568E2ED}.Release|Any CPU.ActiveCfg = Release|Any CPU {0EE90477-6D50-49A3-A557-3741F568E2ED}.Release|Any CPU.Build.0 = Release|Any CPU - {888DB2A9-39D2-4B21-8620-8C2BD67AAF6F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {888DB2A9-39D2-4B21-8620-8C2BD67AAF6F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {888DB2A9-39D2-4B21-8620-8C2BD67AAF6F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {888DB2A9-39D2-4B21-8620-8C2BD67AAF6F}.Release|Any CPU.Build.0 = Release|Any CPU {416C923B-61E5-4182-909C-21651394C05F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {416C923B-61E5-4182-909C-21651394C05F}.Debug|Any CPU.Build.0 = Debug|Any CPU {416C923B-61E5-4182-909C-21651394C05F}.Release|Any CPU.ActiveCfg = Release|Any CPU {416C923B-61E5-4182-909C-21651394C05F}.Release|Any CPU.Build.0 = Release|Any CPU - {A99F2A92-EE56-49FB-970C-5EA7935D1316}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A99F2A92-EE56-49FB-970C-5EA7935D1316}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A99F2A92-EE56-49FB-970C-5EA7935D1316}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A99F2A92-EE56-49FB-970C-5EA7935D1316}.Release|Any CPU.Build.0 = Release|Any CPU {4776CCE0-98E9-4E3A-9DDC-93278D63721E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {4776CCE0-98E9-4E3A-9DDC-93278D63721E}.Debug|Any CPU.Build.0 = Debug|Any CPU {4776CCE0-98E9-4E3A-9DDC-93278D63721E}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -187,9 +175,7 @@ Global {C2FE4732-EA4E-49CC-BE34-46341FB32E09} = {3F113598-B240-4E06-B41A-6C684C208F2A} {C825BBFF-297D-4E68-ABB9-276FD81D4AD4} = {BAFA6668-162F-4D48-8BAD-46A39C59B6FE} {0EE90477-6D50-49A3-A557-3741F568E2ED} = {120B20F8-E388-4973-8F67-8340EADED83B} - {888DB2A9-39D2-4B21-8620-8C2BD67AAF6F} = {A9587680-24D6-475A-81E8-8699773B5ED9} {416C923B-61E5-4182-909C-21651394C05F} = {A9587680-24D6-475A-81E8-8699773B5ED9} - {A99F2A92-EE56-49FB-970C-5EA7935D1316} = {A9587680-24D6-475A-81E8-8699773B5ED9} {4776CCE0-98E9-4E3A-9DDC-93278D63721E} = {120B20F8-E388-4973-8F67-8340EADED83B} {A476ADD9-1DA4-46E1-8555-6040C52B76D0} = {3F113598-B240-4E06-B41A-6C684C208F2A} {D4B3216E-6072-4B7A-97C5-A6FC4C2ABB05} = {3F113598-B240-4E06-B41A-6C684C208F2A} diff --git a/exercises/03-sagas/after/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj b/exercises/03-sagas/after/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj index c30c220c..93d68bf0 100644 --- a/exercises/03-sagas/after/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj +++ b/exercises/03-sagas/after/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj @@ -6,11 +6,6 @@ - - - - - diff --git a/exercises/03-sagas/after/Divergent.CompositionGateway/Startup.cs b/exercises/03-sagas/after/Divergent.CompositionGateway/Startup.cs index 3f2bb613..cab786f1 100644 --- a/exercises/03-sagas/after/Divergent.CompositionGateway/Startup.cs +++ b/exercises/03-sagas/after/Divergent.CompositionGateway/Startup.cs @@ -1,5 +1,4 @@ -using ITOps.ViewModelComposition; -using ITOps.ViewModelComposition.Gateway; +using ServiceComposer.AspNetCore; namespace Divergent.CompositionGateway; @@ -21,6 +20,10 @@ public void Configure(IApplicationBuilder app) policyBuilder.AllowAnyHeader(); }); - app.RunCompositionGatewayWithDefaultRoutes(); + app.UseRouting(); + app.UseEndpoints(builder => + { + builder.MapCompositionHandlers(); + }); } } \ No newline at end of file diff --git a/exercises/03-sagas/after/Divergent.Customers.ViewModelComposition/Divergent.Customers.ViewModelComposition.csproj b/exercises/03-sagas/after/Divergent.Customers.ViewModelComposition/Divergent.Customers.ViewModelComposition.csproj index 6ec89002..78d59079 100644 --- a/exercises/03-sagas/after/Divergent.Customers.ViewModelComposition/Divergent.Customers.ViewModelComposition.csproj +++ b/exercises/03-sagas/after/Divergent.Customers.ViewModelComposition/Divergent.Customers.ViewModelComposition.csproj @@ -4,9 +4,12 @@ net8.0 + + + + - diff --git a/exercises/03-sagas/after/Divergent.Customers.ViewModelComposition/OrdersLoadedSubscriber.cs b/exercises/03-sagas/after/Divergent.Customers.ViewModelComposition/OrdersLoadedSubscriber.cs index 8ef5169e..3228ded7 100644 --- a/exercises/03-sagas/after/Divergent.Customers.ViewModelComposition/OrdersLoadedSubscriber.cs +++ b/exercises/03-sagas/after/Divergent.Customers.ViewModelComposition/OrdersLoadedSubscriber.cs @@ -1,24 +1,17 @@ -using Divergent.Sales.ViewModelComposition.Events; +using System.Net.Http; +using Divergent.Sales.ViewModelComposition.Events; using ITOps.Json; -using ITOps.ViewModelComposition; -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Routing; -using System; -using System.Net.Http; +using Microsoft.AspNetCore.Mvc; +using ServiceComposer.AspNetCore; namespace Divergent.Customers.ViewModelComposition; -public class OrdersLoadedSubscriber : ISubscribeToCompositionEvents +public class OrdersLoadedSubscriber : ICompositionEventsSubscriber { - // Very simple matching for the purpose of the exercise. - public bool Matches(RouteData routeData, string httpMethod) => - HttpMethods.IsGet(httpMethod) - && string.Equals((string)routeData.Values["controller"], "orders", StringComparison.OrdinalIgnoreCase) - && !routeData.Values.ContainsKey("id"); - - public void Subscribe(IPublishCompositionEvents publisher) + [HttpGet("/orders")] + public void Subscribe(ICompositionEventsPublisher publisher) { - publisher.Subscribe(async (pageViewModel, ordersLoaded, routeData, query) => + publisher.Subscribe(async (ordersLoaded, httpRequest) => { var orderIds = string.Join(",", ordersLoaded.OrderViewModelDictionary.Keys); diff --git a/exercises/03-sagas/after/Divergent.Finance.ViewModelComposition/Divergent.Finance.ViewModelComposition.csproj b/exercises/03-sagas/after/Divergent.Finance.ViewModelComposition/Divergent.Finance.ViewModelComposition.csproj index 6ec89002..78d59079 100644 --- a/exercises/03-sagas/after/Divergent.Finance.ViewModelComposition/Divergent.Finance.ViewModelComposition.csproj +++ b/exercises/03-sagas/after/Divergent.Finance.ViewModelComposition/Divergent.Finance.ViewModelComposition.csproj @@ -4,9 +4,12 @@ net8.0 + + + + - diff --git a/exercises/03-sagas/after/Divergent.Finance.ViewModelComposition/OrdersLoadedSubscriber.cs b/exercises/03-sagas/after/Divergent.Finance.ViewModelComposition/OrdersLoadedSubscriber.cs index c5dda4a6..7fe01b1c 100644 --- a/exercises/03-sagas/after/Divergent.Finance.ViewModelComposition/OrdersLoadedSubscriber.cs +++ b/exercises/03-sagas/after/Divergent.Finance.ViewModelComposition/OrdersLoadedSubscriber.cs @@ -1,24 +1,17 @@ -using Divergent.Sales.ViewModelComposition.Events; +using System.Net.Http; +using Divergent.Sales.ViewModelComposition.Events; using ITOps.Json; -using ITOps.ViewModelComposition; -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Routing; -using System; -using System.Net.Http; +using Microsoft.AspNetCore.Mvc; +using ServiceComposer.AspNetCore; namespace Divergent.Finance.ViewModelComposition; -public class OrdersLoadedSubscriber : ISubscribeToCompositionEvents +public class OrdersLoadedSubscriber : ICompositionEventsSubscriber { - // Very simple matching for the purpose of the exercise. - public bool Matches(RouteData routeData, string httpMethod) => - HttpMethods.IsGet(httpMethod) - && string.Equals((string)routeData.Values["controller"], "orders", StringComparison.OrdinalIgnoreCase) - && !routeData.Values.ContainsKey("id"); - - public void Subscribe(IPublishCompositionEvents publisher) + [HttpGet("/orders")] + public void Subscribe(ICompositionEventsPublisher publisher) { - publisher.Subscribe(async (pageViewModel, ordersLoaded, routeData, query) => + publisher.Subscribe(async (ordersLoaded, httpRequest) => { var orderIds = string.Join(",", ordersLoaded.OrderViewModelDictionary.Keys); diff --git a/exercises/03-sagas/after/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj b/exercises/03-sagas/after/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj index 1a0c6ec8..7d3bd827 100644 --- a/exercises/03-sagas/after/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj +++ b/exercises/03-sagas/after/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj @@ -4,10 +4,13 @@ net8.0 + + + + - \ No newline at end of file diff --git a/exercises/03-sagas/after/Divergent.Sales.ViewModelComposition/OrdersListViewModelAppender.cs b/exercises/03-sagas/after/Divergent.Sales.ViewModelComposition/OrdersListViewModelAppender.cs index 84b19000..cb791b56 100644 --- a/exercises/03-sagas/after/Divergent.Sales.ViewModelComposition/OrdersListViewModelAppender.cs +++ b/exercises/03-sagas/after/Divergent.Sales.ViewModelComposition/OrdersListViewModelAppender.cs @@ -1,24 +1,19 @@ -using Divergent.Sales.ViewModelComposition.Events; -using ITOps.Json; -using ITOps.ViewModelComposition; -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Routing; -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Dynamic; using System.Net.Http; using System.Threading.Tasks; +using Divergent.Sales.ViewModelComposition.Events; +using ITOps.Json; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using ServiceComposer.AspNetCore; namespace Divergent.Sales.ViewModelComposition; -public class OrdersListViewModelAppender : IViewModelAppender +public class OrdersListViewModelAppender : ICompositionRequestsHandler { - public bool Matches(RouteData routeData, string httpMethod) => - HttpMethods.IsGet(httpMethod) - && string.Equals((string)routeData.Values["controller"], "orders", StringComparison.OrdinalIgnoreCase) - && !routeData.Values.ContainsKey("id"); - - public async Task Append(dynamic viewModel, RouteData routeData, IQueryCollection query) + [HttpGet("/orders")] + public async Task Handle(HttpRequest request) { // Hardcoded for simplicity. In a production app, a config object could be injected. var url = $"http://localhost:20185/api/orders"; @@ -28,8 +23,10 @@ public async Task Append(dynamic viewModel, RouteData routeData, IQueryCollectio var orderViewModelDictionary = MapToViewModelDictionary(orders); - await viewModel.RaiseEventAsync(new OrdersLoaded { OrderViewModelDictionary = orderViewModelDictionary }); + var compositionContext = request.GetCompositionContext(); + await compositionContext.RaiseEvent(new OrdersLoaded { OrderViewModelDictionary = orderViewModelDictionary }); + var viewModel = request.GetComposedResponseModel(); viewModel.Orders = orderViewModelDictionary.Values; } From 28a245a58f2e830ed8acd79eaaa09cf4a66a884d Mon Sep 17 00:00:00 2001 From: David Boike Date: Thu, 31 Oct 2024 12:53:42 -0500 Subject: [PATCH 7/9] 4-before --- .../before/04-integration-before.sln | 54 +++++++------------ .../Divergent.CompositionGateway.csproj | 1 - .../Divergent.CompositionGateway/Startup.cs | 9 ++-- ...gent.Customers.ViewModelComposition.csproj | 5 +- .../OrdersLoadedSubscriber.cs | 23 +++----- ...ergent.Finance.ViewModelComposition.csproj | 5 +- .../OrdersLoadedSubscriber.cs | 23 +++----- ...ivergent.Sales.ViewModelComposition.csproj | 5 +- .../OrdersListViewModelAppender.cs | 27 +++++----- 9 files changed, 66 insertions(+), 86 deletions(-) diff --git a/exercises/04-integration/before/04-integration-before.sln b/exercises/04-integration/before/04-integration-before.sln index 00f166dd..a659026c 100644 --- a/exercises/04-integration/before/04-integration-before.sln +++ b/exercises/04-integration/before/04-integration-before.sln @@ -1,31 +1,31 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.27130.2010 +# Visual Studio Version 17 +VisualStudioVersion = 17.11.35327.3 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Customers", "Divergent.Customers\Divergent.Customers.csproj", "{02EE3114-734F-42DF-994C-98480E1489FE}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Customers", "Divergent.Customers\Divergent.Customers.csproj", "{02EE3114-734F-42DF-994C-98480E1489FE}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Finance", "Divergent.Finance\Divergent.Finance.csproj", "{3EE37732-A31A-408D-AC60-2FBF08D09B56}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Finance", "Divergent.Finance\Divergent.Finance.csproj", "{3EE37732-A31A-408D-AC60-2FBF08D09B56}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Sales", "Divergent.Sales\Divergent.Sales.csproj", "{F358BD9C-7138-45C9-AA32-B27F5066FF68}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Sales", "Divergent.Sales\Divergent.Sales.csproj", "{F358BD9C-7138-45C9-AA32-B27F5066FF68}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Website", "Website", "{120B20F8-E388-4973-8F67-8340EADED83B}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Finance.Messages", "Divergent.Finance.Messages\Divergent.Finance.Messages.csproj", "{01CCC8E0-605E-417D-BF33-30881F65A49B}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Finance.Messages", "Divergent.Finance.Messages\Divergent.Finance.Messages.csproj", "{01CCC8E0-605E-417D-BF33-30881F65A49B}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Sales.Messages", "Divergent.Sales.Messages\Divergent.Sales.Messages.csproj", "{FD850B7B-46A5-43EC-9571-C13736E6B033}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Sales.Messages", "Divergent.Sales.Messages\Divergent.Sales.Messages.csproj", "{FD850B7B-46A5-43EC-9571-C13736E6B033}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Customers.Data", "Divergent.Customers.Data\Divergent.Customers.Data.csproj", "{314AA28E-E5A9-40B3-AA9B-C2C0E5BAD059}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Customers.Data", "Divergent.Customers.Data\Divergent.Customers.Data.csproj", "{314AA28E-E5A9-40B3-AA9B-C2C0E5BAD059}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Finance.Data", "Divergent.Finance.Data\Divergent.Finance.Data.csproj", "{FEE53DC5-B52D-49DB-8F07-A8C835998283}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Finance.Data", "Divergent.Finance.Data\Divergent.Finance.Data.csproj", "{FEE53DC5-B52D-49DB-8F07-A8C835998283}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Sales.Data", "Divergent.Sales.Data\Divergent.Sales.Data.csproj", "{80F82F7D-3F0A-4316-87CD-49F19DBD5B85}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Sales.Data", "Divergent.Sales.Data\Divergent.Sales.Data.csproj", "{80F82F7D-3F0A-4316-87CD-49F19DBD5B85}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ExternalSystems", "ExternalSystems", "{41918E2F-FCC6-48D8-8A3C-3EF756BE385C}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PaymentProviders", "externalsystems\MastercardPaymentProvider\PaymentProviders.csproj", "{4EEFC008-F185-480A-8312-D3E9C81C5D95}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PaymentProviders", "externalsystems\MastercardPaymentProvider\PaymentProviders.csproj", "{4EEFC008-F185-480A-8312-D3E9C81C5D95}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Shipping", "Divergent.Shipping\Divergent.Shipping.csproj", "{E8BCB506-5BD6-4963-B4D0-717A26916E46}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Shipping", "Divergent.Shipping\Divergent.Shipping.csproj", "{E8BCB506-5BD6-4963-B4D0-717A26916E46}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Customers", "Customers", "{808B901F-6EF7-49F0-B668-F54EEDB1F3F1}" EndProject @@ -37,28 +37,24 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Shipping", "Shipping", "{BA EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ITOps", "ITOps", "{A9587680-24D6-475A-81E8-8699773B5ED9}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.ITOps", "Divergent.ITOps\Divergent.ITOps.csproj", "{CC7D8937-2DCA-447D-A951-FA0A566EE92E}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.ITOps", "Divergent.ITOps\Divergent.ITOps.csproj", "{CC7D8937-2DCA-447D-A951-FA0A566EE92E}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.ITOps.Interfaces", "Divergent.ITOps.Interfaces\Divergent.ITOps.Interfaces.csproj", "{23DEA9FF-FCB9-4C9F-94F7-0A77E23D8791}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.ITOps.Interfaces", "Divergent.ITOps.Interfaces\Divergent.ITOps.Interfaces.csproj", "{23DEA9FF-FCB9-4C9F-94F7-0A77E23D8791}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Customers.API", "Divergent.Customers.API\Divergent.Customers.API.csproj", "{222B8A52-4F51-4140-80B4-8AF531E293E4}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Customers.API", "Divergent.Customers.API\Divergent.Customers.API.csproj", "{222B8A52-4F51-4140-80B4-8AF531E293E4}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Finance.API", "Divergent.Finance.API\Divergent.Finance.API.csproj", "{BF4B517B-DBC4-4107-886F-9E246312E9AF}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Finance.API", "Divergent.Finance.API\Divergent.Finance.API.csproj", "{BF4B517B-DBC4-4107-886F-9E246312E9AF}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Sales.API", "Divergent.Sales.API\Divergent.Sales.API.csproj", "{C2FE4732-EA4E-49CC-BE34-46341FB32E09}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Sales.API", "Divergent.Sales.API\Divergent.Sales.API.csproj", "{C2FE4732-EA4E-49CC-BE34-46341FB32E09}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.ITOps.Messages", "Divergent.ITOps.Messages\Divergent.ITOps.Messages.csproj", "{5B5FC22D-A8C8-4FBB-B533-3052E83D410C}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.ITOps.Messages", "Divergent.ITOps.Messages\Divergent.ITOps.Messages.csproj", "{5B5FC22D-A8C8-4FBB-B533-3052E83D410C}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Shipping.Data", "Divergent.Shipping.Data\Divergent.Shipping.Data.csproj", "{C825BBFF-297D-4E68-ABB9-276FD81D4AD4}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Shipping.Data", "Divergent.Shipping.Data\Divergent.Shipping.Data.csproj", "{C825BBFF-297D-4E68-ABB9-276FD81D4AD4}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Frontend", "Divergent.Frontend\Divergent.Frontend.csproj", "{0EE90477-6D50-49A3-A557-3741F568E2ED}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ITOps.ViewModelComposition", "..\..\shared-api-gateway\ITOps.ViewModelComposition\ITOps.ViewModelComposition.csproj", "{888DB2A9-39D2-4B21-8620-8C2BD67AAF6F}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Frontend", "Divergent.Frontend\Divergent.Frontend.csproj", "{0EE90477-6D50-49A3-A557-3741F568E2ED}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ITOps.Json", "..\..\shared-api-gateway\ITOps.Json\ITOps.Json.csproj", "{416C923B-61E5-4182-909C-21651394C05F}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ITOps.ViewModelComposition.Gateway", "..\..\shared-api-gateway\ITOps.ViewModelComposition.Gateway\ITOps.ViewModelComposition.Gateway.csproj", "{A99F2A92-EE56-49FB-970C-5EA7935D1316}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.CompositionGateway", "Divergent.CompositionGateway\Divergent.CompositionGateway.csproj", "{4776CCE0-98E9-4E3A-9DDC-93278D63721E}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Sales.ViewModelComposition", "Divergent.Sales.ViewModelComposition\Divergent.Sales.ViewModelComposition.csproj", "{A476ADD9-1DA4-46E1-8555-6040C52B76D0}" @@ -149,18 +145,10 @@ Global {0EE90477-6D50-49A3-A557-3741F568E2ED}.Debug|Any CPU.Build.0 = Debug|Any CPU {0EE90477-6D50-49A3-A557-3741F568E2ED}.Release|Any CPU.ActiveCfg = Release|Any CPU {0EE90477-6D50-49A3-A557-3741F568E2ED}.Release|Any CPU.Build.0 = Release|Any CPU - {888DB2A9-39D2-4B21-8620-8C2BD67AAF6F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {888DB2A9-39D2-4B21-8620-8C2BD67AAF6F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {888DB2A9-39D2-4B21-8620-8C2BD67AAF6F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {888DB2A9-39D2-4B21-8620-8C2BD67AAF6F}.Release|Any CPU.Build.0 = Release|Any CPU {416C923B-61E5-4182-909C-21651394C05F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {416C923B-61E5-4182-909C-21651394C05F}.Debug|Any CPU.Build.0 = Debug|Any CPU {416C923B-61E5-4182-909C-21651394C05F}.Release|Any CPU.ActiveCfg = Release|Any CPU {416C923B-61E5-4182-909C-21651394C05F}.Release|Any CPU.Build.0 = Release|Any CPU - {A99F2A92-EE56-49FB-970C-5EA7935D1316}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A99F2A92-EE56-49FB-970C-5EA7935D1316}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A99F2A92-EE56-49FB-970C-5EA7935D1316}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A99F2A92-EE56-49FB-970C-5EA7935D1316}.Release|Any CPU.Build.0 = Release|Any CPU {4776CCE0-98E9-4E3A-9DDC-93278D63721E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {4776CCE0-98E9-4E3A-9DDC-93278D63721E}.Debug|Any CPU.Build.0 = Debug|Any CPU {4776CCE0-98E9-4E3A-9DDC-93278D63721E}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -208,9 +196,7 @@ Global {5B5FC22D-A8C8-4FBB-B533-3052E83D410C} = {A9587680-24D6-475A-81E8-8699773B5ED9} {C825BBFF-297D-4E68-ABB9-276FD81D4AD4} = {BAFA6668-162F-4D48-8BAD-46A39C59B6FE} {0EE90477-6D50-49A3-A557-3741F568E2ED} = {120B20F8-E388-4973-8F67-8340EADED83B} - {888DB2A9-39D2-4B21-8620-8C2BD67AAF6F} = {A9587680-24D6-475A-81E8-8699773B5ED9} {416C923B-61E5-4182-909C-21651394C05F} = {A9587680-24D6-475A-81E8-8699773B5ED9} - {A99F2A92-EE56-49FB-970C-5EA7935D1316} = {A9587680-24D6-475A-81E8-8699773B5ED9} {4776CCE0-98E9-4E3A-9DDC-93278D63721E} = {120B20F8-E388-4973-8F67-8340EADED83B} {A476ADD9-1DA4-46E1-8555-6040C52B76D0} = {3F113598-B240-4E06-B41A-6C684C208F2A} {D4B3216E-6072-4B7A-97C5-A6FC4C2ABB05} = {3F113598-B240-4E06-B41A-6C684C208F2A} diff --git a/exercises/04-integration/before/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj b/exercises/04-integration/before/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj index c30c220c..9c02a1f0 100644 --- a/exercises/04-integration/before/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj +++ b/exercises/04-integration/before/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj @@ -10,7 +10,6 @@ - diff --git a/exercises/04-integration/before/Divergent.CompositionGateway/Startup.cs b/exercises/04-integration/before/Divergent.CompositionGateway/Startup.cs index 3f2bb613..cab786f1 100644 --- a/exercises/04-integration/before/Divergent.CompositionGateway/Startup.cs +++ b/exercises/04-integration/before/Divergent.CompositionGateway/Startup.cs @@ -1,5 +1,4 @@ -using ITOps.ViewModelComposition; -using ITOps.ViewModelComposition.Gateway; +using ServiceComposer.AspNetCore; namespace Divergent.CompositionGateway; @@ -21,6 +20,10 @@ public void Configure(IApplicationBuilder app) policyBuilder.AllowAnyHeader(); }); - app.RunCompositionGatewayWithDefaultRoutes(); + app.UseRouting(); + app.UseEndpoints(builder => + { + builder.MapCompositionHandlers(); + }); } } \ No newline at end of file diff --git a/exercises/04-integration/before/Divergent.Customers.ViewModelComposition/Divergent.Customers.ViewModelComposition.csproj b/exercises/04-integration/before/Divergent.Customers.ViewModelComposition/Divergent.Customers.ViewModelComposition.csproj index 6ec89002..78d59079 100644 --- a/exercises/04-integration/before/Divergent.Customers.ViewModelComposition/Divergent.Customers.ViewModelComposition.csproj +++ b/exercises/04-integration/before/Divergent.Customers.ViewModelComposition/Divergent.Customers.ViewModelComposition.csproj @@ -4,9 +4,12 @@ net8.0 + + + + - diff --git a/exercises/04-integration/before/Divergent.Customers.ViewModelComposition/OrdersLoadedSubscriber.cs b/exercises/04-integration/before/Divergent.Customers.ViewModelComposition/OrdersLoadedSubscriber.cs index 8ef5169e..3228ded7 100644 --- a/exercises/04-integration/before/Divergent.Customers.ViewModelComposition/OrdersLoadedSubscriber.cs +++ b/exercises/04-integration/before/Divergent.Customers.ViewModelComposition/OrdersLoadedSubscriber.cs @@ -1,24 +1,17 @@ -using Divergent.Sales.ViewModelComposition.Events; +using System.Net.Http; +using Divergent.Sales.ViewModelComposition.Events; using ITOps.Json; -using ITOps.ViewModelComposition; -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Routing; -using System; -using System.Net.Http; +using Microsoft.AspNetCore.Mvc; +using ServiceComposer.AspNetCore; namespace Divergent.Customers.ViewModelComposition; -public class OrdersLoadedSubscriber : ISubscribeToCompositionEvents +public class OrdersLoadedSubscriber : ICompositionEventsSubscriber { - // Very simple matching for the purpose of the exercise. - public bool Matches(RouteData routeData, string httpMethod) => - HttpMethods.IsGet(httpMethod) - && string.Equals((string)routeData.Values["controller"], "orders", StringComparison.OrdinalIgnoreCase) - && !routeData.Values.ContainsKey("id"); - - public void Subscribe(IPublishCompositionEvents publisher) + [HttpGet("/orders")] + public void Subscribe(ICompositionEventsPublisher publisher) { - publisher.Subscribe(async (pageViewModel, ordersLoaded, routeData, query) => + publisher.Subscribe(async (ordersLoaded, httpRequest) => { var orderIds = string.Join(",", ordersLoaded.OrderViewModelDictionary.Keys); diff --git a/exercises/04-integration/before/Divergent.Finance.ViewModelComposition/Divergent.Finance.ViewModelComposition.csproj b/exercises/04-integration/before/Divergent.Finance.ViewModelComposition/Divergent.Finance.ViewModelComposition.csproj index 6ec89002..78d59079 100644 --- a/exercises/04-integration/before/Divergent.Finance.ViewModelComposition/Divergent.Finance.ViewModelComposition.csproj +++ b/exercises/04-integration/before/Divergent.Finance.ViewModelComposition/Divergent.Finance.ViewModelComposition.csproj @@ -4,9 +4,12 @@ net8.0 + + + + - diff --git a/exercises/04-integration/before/Divergent.Finance.ViewModelComposition/OrdersLoadedSubscriber.cs b/exercises/04-integration/before/Divergent.Finance.ViewModelComposition/OrdersLoadedSubscriber.cs index c5dda4a6..7fe01b1c 100644 --- a/exercises/04-integration/before/Divergent.Finance.ViewModelComposition/OrdersLoadedSubscriber.cs +++ b/exercises/04-integration/before/Divergent.Finance.ViewModelComposition/OrdersLoadedSubscriber.cs @@ -1,24 +1,17 @@ -using Divergent.Sales.ViewModelComposition.Events; +using System.Net.Http; +using Divergent.Sales.ViewModelComposition.Events; using ITOps.Json; -using ITOps.ViewModelComposition; -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Routing; -using System; -using System.Net.Http; +using Microsoft.AspNetCore.Mvc; +using ServiceComposer.AspNetCore; namespace Divergent.Finance.ViewModelComposition; -public class OrdersLoadedSubscriber : ISubscribeToCompositionEvents +public class OrdersLoadedSubscriber : ICompositionEventsSubscriber { - // Very simple matching for the purpose of the exercise. - public bool Matches(RouteData routeData, string httpMethod) => - HttpMethods.IsGet(httpMethod) - && string.Equals((string)routeData.Values["controller"], "orders", StringComparison.OrdinalIgnoreCase) - && !routeData.Values.ContainsKey("id"); - - public void Subscribe(IPublishCompositionEvents publisher) + [HttpGet("/orders")] + public void Subscribe(ICompositionEventsPublisher publisher) { - publisher.Subscribe(async (pageViewModel, ordersLoaded, routeData, query) => + publisher.Subscribe(async (ordersLoaded, httpRequest) => { var orderIds = string.Join(",", ordersLoaded.OrderViewModelDictionary.Keys); diff --git a/exercises/04-integration/before/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj b/exercises/04-integration/before/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj index 1a0c6ec8..7d3bd827 100644 --- a/exercises/04-integration/before/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj +++ b/exercises/04-integration/before/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj @@ -4,10 +4,13 @@ net8.0 + + + + - \ No newline at end of file diff --git a/exercises/04-integration/before/Divergent.Sales.ViewModelComposition/OrdersListViewModelAppender.cs b/exercises/04-integration/before/Divergent.Sales.ViewModelComposition/OrdersListViewModelAppender.cs index 84b19000..cb791b56 100644 --- a/exercises/04-integration/before/Divergent.Sales.ViewModelComposition/OrdersListViewModelAppender.cs +++ b/exercises/04-integration/before/Divergent.Sales.ViewModelComposition/OrdersListViewModelAppender.cs @@ -1,24 +1,19 @@ -using Divergent.Sales.ViewModelComposition.Events; -using ITOps.Json; -using ITOps.ViewModelComposition; -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Routing; -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Dynamic; using System.Net.Http; using System.Threading.Tasks; +using Divergent.Sales.ViewModelComposition.Events; +using ITOps.Json; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using ServiceComposer.AspNetCore; namespace Divergent.Sales.ViewModelComposition; -public class OrdersListViewModelAppender : IViewModelAppender +public class OrdersListViewModelAppender : ICompositionRequestsHandler { - public bool Matches(RouteData routeData, string httpMethod) => - HttpMethods.IsGet(httpMethod) - && string.Equals((string)routeData.Values["controller"], "orders", StringComparison.OrdinalIgnoreCase) - && !routeData.Values.ContainsKey("id"); - - public async Task Append(dynamic viewModel, RouteData routeData, IQueryCollection query) + [HttpGet("/orders")] + public async Task Handle(HttpRequest request) { // Hardcoded for simplicity. In a production app, a config object could be injected. var url = $"http://localhost:20185/api/orders"; @@ -28,8 +23,10 @@ public async Task Append(dynamic viewModel, RouteData routeData, IQueryCollectio var orderViewModelDictionary = MapToViewModelDictionary(orders); - await viewModel.RaiseEventAsync(new OrdersLoaded { OrderViewModelDictionary = orderViewModelDictionary }); + var compositionContext = request.GetCompositionContext(); + await compositionContext.RaiseEvent(new OrdersLoaded { OrderViewModelDictionary = orderViewModelDictionary }); + var viewModel = request.GetComposedResponseModel(); viewModel.Orders = orderViewModelDictionary.Values; } From 21df20208fcc83af9ff50eab842011e257211abb Mon Sep 17 00:00:00 2001 From: David Boike Date: Thu, 31 Oct 2024 13:02:11 -0500 Subject: [PATCH 8/9] 4-after --- .../after/04-integration-after.sln | 54 +++++++------------ .../Divergent.CompositionGateway.csproj | 1 - .../Divergent.CompositionGateway/Startup.cs | 9 ++-- ...gent.Customers.ViewModelComposition.csproj | 5 +- .../OrdersLoadedSubscriber.cs | 23 +++----- ...ergent.Finance.ViewModelComposition.csproj | 5 +- .../OrdersLoadedSubscriber.cs | 23 +++----- ...ivergent.Sales.ViewModelComposition.csproj | 5 +- .../OrdersListViewModelAppender.cs | 27 +++++----- 9 files changed, 66 insertions(+), 86 deletions(-) diff --git a/exercises/04-integration/after/04-integration-after.sln b/exercises/04-integration/after/04-integration-after.sln index 00f166dd..a659026c 100644 --- a/exercises/04-integration/after/04-integration-after.sln +++ b/exercises/04-integration/after/04-integration-after.sln @@ -1,31 +1,31 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.27130.2010 +# Visual Studio Version 17 +VisualStudioVersion = 17.11.35327.3 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Customers", "Divergent.Customers\Divergent.Customers.csproj", "{02EE3114-734F-42DF-994C-98480E1489FE}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Customers", "Divergent.Customers\Divergent.Customers.csproj", "{02EE3114-734F-42DF-994C-98480E1489FE}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Finance", "Divergent.Finance\Divergent.Finance.csproj", "{3EE37732-A31A-408D-AC60-2FBF08D09B56}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Finance", "Divergent.Finance\Divergent.Finance.csproj", "{3EE37732-A31A-408D-AC60-2FBF08D09B56}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Sales", "Divergent.Sales\Divergent.Sales.csproj", "{F358BD9C-7138-45C9-AA32-B27F5066FF68}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Sales", "Divergent.Sales\Divergent.Sales.csproj", "{F358BD9C-7138-45C9-AA32-B27F5066FF68}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Website", "Website", "{120B20F8-E388-4973-8F67-8340EADED83B}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Finance.Messages", "Divergent.Finance.Messages\Divergent.Finance.Messages.csproj", "{01CCC8E0-605E-417D-BF33-30881F65A49B}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Finance.Messages", "Divergent.Finance.Messages\Divergent.Finance.Messages.csproj", "{01CCC8E0-605E-417D-BF33-30881F65A49B}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Sales.Messages", "Divergent.Sales.Messages\Divergent.Sales.Messages.csproj", "{FD850B7B-46A5-43EC-9571-C13736E6B033}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Sales.Messages", "Divergent.Sales.Messages\Divergent.Sales.Messages.csproj", "{FD850B7B-46A5-43EC-9571-C13736E6B033}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Customers.Data", "Divergent.Customers.Data\Divergent.Customers.Data.csproj", "{314AA28E-E5A9-40B3-AA9B-C2C0E5BAD059}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Customers.Data", "Divergent.Customers.Data\Divergent.Customers.Data.csproj", "{314AA28E-E5A9-40B3-AA9B-C2C0E5BAD059}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Finance.Data", "Divergent.Finance.Data\Divergent.Finance.Data.csproj", "{FEE53DC5-B52D-49DB-8F07-A8C835998283}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Finance.Data", "Divergent.Finance.Data\Divergent.Finance.Data.csproj", "{FEE53DC5-B52D-49DB-8F07-A8C835998283}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Sales.Data", "Divergent.Sales.Data\Divergent.Sales.Data.csproj", "{80F82F7D-3F0A-4316-87CD-49F19DBD5B85}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Sales.Data", "Divergent.Sales.Data\Divergent.Sales.Data.csproj", "{80F82F7D-3F0A-4316-87CD-49F19DBD5B85}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ExternalSystems", "ExternalSystems", "{41918E2F-FCC6-48D8-8A3C-3EF756BE385C}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PaymentProviders", "externalsystems\MastercardPaymentProvider\PaymentProviders.csproj", "{4EEFC008-F185-480A-8312-D3E9C81C5D95}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PaymentProviders", "externalsystems\MastercardPaymentProvider\PaymentProviders.csproj", "{4EEFC008-F185-480A-8312-D3E9C81C5D95}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Shipping", "Divergent.Shipping\Divergent.Shipping.csproj", "{E8BCB506-5BD6-4963-B4D0-717A26916E46}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Shipping", "Divergent.Shipping\Divergent.Shipping.csproj", "{E8BCB506-5BD6-4963-B4D0-717A26916E46}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Customers", "Customers", "{808B901F-6EF7-49F0-B668-F54EEDB1F3F1}" EndProject @@ -37,28 +37,24 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Shipping", "Shipping", "{BA EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ITOps", "ITOps", "{A9587680-24D6-475A-81E8-8699773B5ED9}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.ITOps", "Divergent.ITOps\Divergent.ITOps.csproj", "{CC7D8937-2DCA-447D-A951-FA0A566EE92E}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.ITOps", "Divergent.ITOps\Divergent.ITOps.csproj", "{CC7D8937-2DCA-447D-A951-FA0A566EE92E}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.ITOps.Interfaces", "Divergent.ITOps.Interfaces\Divergent.ITOps.Interfaces.csproj", "{23DEA9FF-FCB9-4C9F-94F7-0A77E23D8791}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.ITOps.Interfaces", "Divergent.ITOps.Interfaces\Divergent.ITOps.Interfaces.csproj", "{23DEA9FF-FCB9-4C9F-94F7-0A77E23D8791}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Customers.API", "Divergent.Customers.API\Divergent.Customers.API.csproj", "{222B8A52-4F51-4140-80B4-8AF531E293E4}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Customers.API", "Divergent.Customers.API\Divergent.Customers.API.csproj", "{222B8A52-4F51-4140-80B4-8AF531E293E4}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Finance.API", "Divergent.Finance.API\Divergent.Finance.API.csproj", "{BF4B517B-DBC4-4107-886F-9E246312E9AF}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Finance.API", "Divergent.Finance.API\Divergent.Finance.API.csproj", "{BF4B517B-DBC4-4107-886F-9E246312E9AF}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Sales.API", "Divergent.Sales.API\Divergent.Sales.API.csproj", "{C2FE4732-EA4E-49CC-BE34-46341FB32E09}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Sales.API", "Divergent.Sales.API\Divergent.Sales.API.csproj", "{C2FE4732-EA4E-49CC-BE34-46341FB32E09}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.ITOps.Messages", "Divergent.ITOps.Messages\Divergent.ITOps.Messages.csproj", "{5B5FC22D-A8C8-4FBB-B533-3052E83D410C}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.ITOps.Messages", "Divergent.ITOps.Messages\Divergent.ITOps.Messages.csproj", "{5B5FC22D-A8C8-4FBB-B533-3052E83D410C}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Shipping.Data", "Divergent.Shipping.Data\Divergent.Shipping.Data.csproj", "{C825BBFF-297D-4E68-ABB9-276FD81D4AD4}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Shipping.Data", "Divergent.Shipping.Data\Divergent.Shipping.Data.csproj", "{C825BBFF-297D-4E68-ABB9-276FD81D4AD4}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Divergent.Frontend", "Divergent.Frontend\Divergent.Frontend.csproj", "{0EE90477-6D50-49A3-A557-3741F568E2ED}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ITOps.ViewModelComposition", "..\..\shared-api-gateway\ITOps.ViewModelComposition\ITOps.ViewModelComposition.csproj", "{888DB2A9-39D2-4B21-8620-8C2BD67AAF6F}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Frontend", "Divergent.Frontend\Divergent.Frontend.csproj", "{0EE90477-6D50-49A3-A557-3741F568E2ED}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ITOps.Json", "..\..\shared-api-gateway\ITOps.Json\ITOps.Json.csproj", "{416C923B-61E5-4182-909C-21651394C05F}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ITOps.ViewModelComposition.Gateway", "..\..\shared-api-gateway\ITOps.ViewModelComposition.Gateway\ITOps.ViewModelComposition.Gateway.csproj", "{A99F2A92-EE56-49FB-970C-5EA7935D1316}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.CompositionGateway", "Divergent.CompositionGateway\Divergent.CompositionGateway.csproj", "{4776CCE0-98E9-4E3A-9DDC-93278D63721E}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Divergent.Sales.ViewModelComposition", "Divergent.Sales.ViewModelComposition\Divergent.Sales.ViewModelComposition.csproj", "{A476ADD9-1DA4-46E1-8555-6040C52B76D0}" @@ -149,18 +145,10 @@ Global {0EE90477-6D50-49A3-A557-3741F568E2ED}.Debug|Any CPU.Build.0 = Debug|Any CPU {0EE90477-6D50-49A3-A557-3741F568E2ED}.Release|Any CPU.ActiveCfg = Release|Any CPU {0EE90477-6D50-49A3-A557-3741F568E2ED}.Release|Any CPU.Build.0 = Release|Any CPU - {888DB2A9-39D2-4B21-8620-8C2BD67AAF6F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {888DB2A9-39D2-4B21-8620-8C2BD67AAF6F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {888DB2A9-39D2-4B21-8620-8C2BD67AAF6F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {888DB2A9-39D2-4B21-8620-8C2BD67AAF6F}.Release|Any CPU.Build.0 = Release|Any CPU {416C923B-61E5-4182-909C-21651394C05F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {416C923B-61E5-4182-909C-21651394C05F}.Debug|Any CPU.Build.0 = Debug|Any CPU {416C923B-61E5-4182-909C-21651394C05F}.Release|Any CPU.ActiveCfg = Release|Any CPU {416C923B-61E5-4182-909C-21651394C05F}.Release|Any CPU.Build.0 = Release|Any CPU - {A99F2A92-EE56-49FB-970C-5EA7935D1316}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A99F2A92-EE56-49FB-970C-5EA7935D1316}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A99F2A92-EE56-49FB-970C-5EA7935D1316}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A99F2A92-EE56-49FB-970C-5EA7935D1316}.Release|Any CPU.Build.0 = Release|Any CPU {4776CCE0-98E9-4E3A-9DDC-93278D63721E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {4776CCE0-98E9-4E3A-9DDC-93278D63721E}.Debug|Any CPU.Build.0 = Debug|Any CPU {4776CCE0-98E9-4E3A-9DDC-93278D63721E}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -208,9 +196,7 @@ Global {5B5FC22D-A8C8-4FBB-B533-3052E83D410C} = {A9587680-24D6-475A-81E8-8699773B5ED9} {C825BBFF-297D-4E68-ABB9-276FD81D4AD4} = {BAFA6668-162F-4D48-8BAD-46A39C59B6FE} {0EE90477-6D50-49A3-A557-3741F568E2ED} = {120B20F8-E388-4973-8F67-8340EADED83B} - {888DB2A9-39D2-4B21-8620-8C2BD67AAF6F} = {A9587680-24D6-475A-81E8-8699773B5ED9} {416C923B-61E5-4182-909C-21651394C05F} = {A9587680-24D6-475A-81E8-8699773B5ED9} - {A99F2A92-EE56-49FB-970C-5EA7935D1316} = {A9587680-24D6-475A-81E8-8699773B5ED9} {4776CCE0-98E9-4E3A-9DDC-93278D63721E} = {120B20F8-E388-4973-8F67-8340EADED83B} {A476ADD9-1DA4-46E1-8555-6040C52B76D0} = {3F113598-B240-4E06-B41A-6C684C208F2A} {D4B3216E-6072-4B7A-97C5-A6FC4C2ABB05} = {3F113598-B240-4E06-B41A-6C684C208F2A} diff --git a/exercises/04-integration/after/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj b/exercises/04-integration/after/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj index c30c220c..9c02a1f0 100644 --- a/exercises/04-integration/after/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj +++ b/exercises/04-integration/after/Divergent.CompositionGateway/Divergent.CompositionGateway.csproj @@ -10,7 +10,6 @@ - diff --git a/exercises/04-integration/after/Divergent.CompositionGateway/Startup.cs b/exercises/04-integration/after/Divergent.CompositionGateway/Startup.cs index 3f2bb613..cab786f1 100644 --- a/exercises/04-integration/after/Divergent.CompositionGateway/Startup.cs +++ b/exercises/04-integration/after/Divergent.CompositionGateway/Startup.cs @@ -1,5 +1,4 @@ -using ITOps.ViewModelComposition; -using ITOps.ViewModelComposition.Gateway; +using ServiceComposer.AspNetCore; namespace Divergent.CompositionGateway; @@ -21,6 +20,10 @@ public void Configure(IApplicationBuilder app) policyBuilder.AllowAnyHeader(); }); - app.RunCompositionGatewayWithDefaultRoutes(); + app.UseRouting(); + app.UseEndpoints(builder => + { + builder.MapCompositionHandlers(); + }); } } \ No newline at end of file diff --git a/exercises/04-integration/after/Divergent.Customers.ViewModelComposition/Divergent.Customers.ViewModelComposition.csproj b/exercises/04-integration/after/Divergent.Customers.ViewModelComposition/Divergent.Customers.ViewModelComposition.csproj index 6ec89002..78d59079 100644 --- a/exercises/04-integration/after/Divergent.Customers.ViewModelComposition/Divergent.Customers.ViewModelComposition.csproj +++ b/exercises/04-integration/after/Divergent.Customers.ViewModelComposition/Divergent.Customers.ViewModelComposition.csproj @@ -4,9 +4,12 @@ net8.0 + + + + - diff --git a/exercises/04-integration/after/Divergent.Customers.ViewModelComposition/OrdersLoadedSubscriber.cs b/exercises/04-integration/after/Divergent.Customers.ViewModelComposition/OrdersLoadedSubscriber.cs index 8ef5169e..3228ded7 100644 --- a/exercises/04-integration/after/Divergent.Customers.ViewModelComposition/OrdersLoadedSubscriber.cs +++ b/exercises/04-integration/after/Divergent.Customers.ViewModelComposition/OrdersLoadedSubscriber.cs @@ -1,24 +1,17 @@ -using Divergent.Sales.ViewModelComposition.Events; +using System.Net.Http; +using Divergent.Sales.ViewModelComposition.Events; using ITOps.Json; -using ITOps.ViewModelComposition; -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Routing; -using System; -using System.Net.Http; +using Microsoft.AspNetCore.Mvc; +using ServiceComposer.AspNetCore; namespace Divergent.Customers.ViewModelComposition; -public class OrdersLoadedSubscriber : ISubscribeToCompositionEvents +public class OrdersLoadedSubscriber : ICompositionEventsSubscriber { - // Very simple matching for the purpose of the exercise. - public bool Matches(RouteData routeData, string httpMethod) => - HttpMethods.IsGet(httpMethod) - && string.Equals((string)routeData.Values["controller"], "orders", StringComparison.OrdinalIgnoreCase) - && !routeData.Values.ContainsKey("id"); - - public void Subscribe(IPublishCompositionEvents publisher) + [HttpGet("/orders")] + public void Subscribe(ICompositionEventsPublisher publisher) { - publisher.Subscribe(async (pageViewModel, ordersLoaded, routeData, query) => + publisher.Subscribe(async (ordersLoaded, httpRequest) => { var orderIds = string.Join(",", ordersLoaded.OrderViewModelDictionary.Keys); diff --git a/exercises/04-integration/after/Divergent.Finance.ViewModelComposition/Divergent.Finance.ViewModelComposition.csproj b/exercises/04-integration/after/Divergent.Finance.ViewModelComposition/Divergent.Finance.ViewModelComposition.csproj index 6ec89002..78d59079 100644 --- a/exercises/04-integration/after/Divergent.Finance.ViewModelComposition/Divergent.Finance.ViewModelComposition.csproj +++ b/exercises/04-integration/after/Divergent.Finance.ViewModelComposition/Divergent.Finance.ViewModelComposition.csproj @@ -4,9 +4,12 @@ net8.0 + + + + - diff --git a/exercises/04-integration/after/Divergent.Finance.ViewModelComposition/OrdersLoadedSubscriber.cs b/exercises/04-integration/after/Divergent.Finance.ViewModelComposition/OrdersLoadedSubscriber.cs index c5dda4a6..7fe01b1c 100644 --- a/exercises/04-integration/after/Divergent.Finance.ViewModelComposition/OrdersLoadedSubscriber.cs +++ b/exercises/04-integration/after/Divergent.Finance.ViewModelComposition/OrdersLoadedSubscriber.cs @@ -1,24 +1,17 @@ -using Divergent.Sales.ViewModelComposition.Events; +using System.Net.Http; +using Divergent.Sales.ViewModelComposition.Events; using ITOps.Json; -using ITOps.ViewModelComposition; -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Routing; -using System; -using System.Net.Http; +using Microsoft.AspNetCore.Mvc; +using ServiceComposer.AspNetCore; namespace Divergent.Finance.ViewModelComposition; -public class OrdersLoadedSubscriber : ISubscribeToCompositionEvents +public class OrdersLoadedSubscriber : ICompositionEventsSubscriber { - // Very simple matching for the purpose of the exercise. - public bool Matches(RouteData routeData, string httpMethod) => - HttpMethods.IsGet(httpMethod) - && string.Equals((string)routeData.Values["controller"], "orders", StringComparison.OrdinalIgnoreCase) - && !routeData.Values.ContainsKey("id"); - - public void Subscribe(IPublishCompositionEvents publisher) + [HttpGet("/orders")] + public void Subscribe(ICompositionEventsPublisher publisher) { - publisher.Subscribe(async (pageViewModel, ordersLoaded, routeData, query) => + publisher.Subscribe(async (ordersLoaded, httpRequest) => { var orderIds = string.Join(",", ordersLoaded.OrderViewModelDictionary.Keys); diff --git a/exercises/04-integration/after/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj b/exercises/04-integration/after/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj index 1a0c6ec8..7d3bd827 100644 --- a/exercises/04-integration/after/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj +++ b/exercises/04-integration/after/Divergent.Sales.ViewModelComposition/Divergent.Sales.ViewModelComposition.csproj @@ -4,10 +4,13 @@ net8.0 + + + + - \ No newline at end of file diff --git a/exercises/04-integration/after/Divergent.Sales.ViewModelComposition/OrdersListViewModelAppender.cs b/exercises/04-integration/after/Divergent.Sales.ViewModelComposition/OrdersListViewModelAppender.cs index 84b19000..cb791b56 100644 --- a/exercises/04-integration/after/Divergent.Sales.ViewModelComposition/OrdersListViewModelAppender.cs +++ b/exercises/04-integration/after/Divergent.Sales.ViewModelComposition/OrdersListViewModelAppender.cs @@ -1,24 +1,19 @@ -using Divergent.Sales.ViewModelComposition.Events; -using ITOps.Json; -using ITOps.ViewModelComposition; -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Routing; -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Dynamic; using System.Net.Http; using System.Threading.Tasks; +using Divergent.Sales.ViewModelComposition.Events; +using ITOps.Json; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using ServiceComposer.AspNetCore; namespace Divergent.Sales.ViewModelComposition; -public class OrdersListViewModelAppender : IViewModelAppender +public class OrdersListViewModelAppender : ICompositionRequestsHandler { - public bool Matches(RouteData routeData, string httpMethod) => - HttpMethods.IsGet(httpMethod) - && string.Equals((string)routeData.Values["controller"], "orders", StringComparison.OrdinalIgnoreCase) - && !routeData.Values.ContainsKey("id"); - - public async Task Append(dynamic viewModel, RouteData routeData, IQueryCollection query) + [HttpGet("/orders")] + public async Task Handle(HttpRequest request) { // Hardcoded for simplicity. In a production app, a config object could be injected. var url = $"http://localhost:20185/api/orders"; @@ -28,8 +23,10 @@ public async Task Append(dynamic viewModel, RouteData routeData, IQueryCollectio var orderViewModelDictionary = MapToViewModelDictionary(orders); - await viewModel.RaiseEventAsync(new OrdersLoaded { OrderViewModelDictionary = orderViewModelDictionary }); + var compositionContext = request.GetCompositionContext(); + await compositionContext.RaiseEvent(new OrdersLoaded { OrderViewModelDictionary = orderViewModelDictionary }); + var viewModel = request.GetComposedResponseModel(); viewModel.Orders = orderViewModelDictionary.Values; } From 39290cd8d47c6da37c30b24eb0f102fd8bd542af Mon Sep 17 00:00:00 2001 From: David Boike Date: Thu, 31 Oct 2024 13:26:39 -0500 Subject: [PATCH 9/9] Update exercise README that contains ViewModelComposition code --- exercises/01-composite-ui/README.md | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/exercises/01-composite-ui/README.md b/exercises/01-composite-ui/README.md index 4ae8eb8f..d42d6b41 100644 --- a/exercises/01-composite-ui/README.md +++ b/exercises/01-composite-ui/README.md @@ -88,27 +88,20 @@ In the `Divergent.Finance.ViewModelComposition` project, add a new class named ` Add the following code to the class ```csharp +using System.Net.Http; using Divergent.Sales.ViewModelComposition.Events; using ITOps.Json; -using ITOps.ViewModelComposition; -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Routing; -using System; -using System.Net.Http; +using Microsoft.AspNetCore.Mvc; +using ServiceComposer.AspNetCore; namespace Divergent.Finance.ViewModelComposition; -public class OrdersLoadedSubscriber : ISubscribeToCompositionEvents +public class OrdersLoadedSubscriber : ICompositionEventsSubscriber { - // Very simple matching for the purpose of the exercise. - public bool Matches(RouteData routeData, string httpMethod) => - HttpMethods.IsGet(httpMethod) - && string.Equals((string)routeData.Values["controller"], "orders", StringComparison.OrdinalIgnoreCase) - && !routeData.Values.ContainsKey("id"); - - public void Subscribe(IPublishCompositionEvents publisher) + [HttpGet("/orders")] + public void Subscribe(ICompositionEventsPublisher publisher) { - publisher.Subscribe(async (pageViewModel, ordersLoaded, routeData, query) => + publisher.Subscribe(async (ordersLoaded, httpRequest) => { var orderIds = string.Join(",", ordersLoaded.OrderViewModelDictionary.Keys);