From 514142a3c7721611ed66f5612d981493f26404ff Mon Sep 17 00:00:00 2001 From: Eduard Tomas Date: Wed, 21 Jun 2017 12:58:55 +0200 Subject: [PATCH 01/64] global.json set to 2.0.0-preview1-005977 dcproj update --- docker-compose.dcproj | 8 +- docker-compose.vs.debug.yml | 166 ---------------------------------- docker-compose.vs.release.yml | 112 ----------------------- global.json | 2 +- 4 files changed, 3 insertions(+), 285 deletions(-) delete mode 100644 docker-compose.vs.debug.yml delete mode 100644 docker-compose.vs.release.yml diff --git a/docker-compose.dcproj b/docker-compose.dcproj index f7f04c5b4..23547b577 100644 --- a/docker-compose.dcproj +++ b/docker-compose.dcproj @@ -5,6 +5,8 @@ True http://localhost:5100 webmvc + Linux + 2.0 @@ -14,12 +16,6 @@ docker-compose.yml - - docker-compose.yml - - - docker-compose.yml - \ No newline at end of file diff --git a/docker-compose.vs.debug.yml b/docker-compose.vs.debug.yml deleted file mode 100644 index b0c792d32..000000000 --- a/docker-compose.vs.debug.yml +++ /dev/null @@ -1,166 +0,0 @@ -version: '3' - -services: - basket.api: - image: eshop/basket.api:dev - build: - args: - source: ${DOCKER_BUILD_SOURCE} - environment: - - DOTNET_USE_POLLING_FILE_WATCHER=1 - volumes: - - ./src/Services/Basket/Basket.API:/app - - ~/.nuget/packages:/root/.nuget/packages:ro - - ~/clrdbg:/clrdbg:ro - entrypoint: tail -f /dev/null - labels: - - "com.microsoft.visualstudio.targetoperatingsystem=linux" - - catalog.api: - image: eshop/catalog.api:dev - build: - args: - source: ${DOCKER_BUILD_SOURCE} - environment: - - DOTNET_USE_POLLING_FILE_WATCHER=1 - volumes: - - ./src/Services/Catalog/Catalog.API:/app - - ~/.nuget/packages:/root/.nuget/packages:ro - - ~/clrdbg:/clrdbg:ro - entrypoint: tail -f /dev/null - labels: - - "com.microsoft.visualstudio.targetoperatingsystem=linux" - - identity.api: - image: eshop/identity.api:dev - build: - args: - source: ${DOCKER_BUILD_SOURCE} - environment: - - DOTNET_USE_POLLING_FILE_WATCHER=1 - volumes: - - ./src/Services/Identity/Identity.API:/app - - ~/.nuget/packages:/root/.nuget/packages:ro - - ~/clrdbg:/clrdbg:ro - entrypoint: tail -f /dev/null - labels: - - "com.microsoft.visualstudio.targetoperatingsystem=linux" - - ordering.api: - image: eshop/ordering.api:dev - build: - args: - source: ${DOCKER_BUILD_SOURCE} - environment: - - DOTNET_USE_POLLING_FILE_WATCHER=1 - volumes: - - ./src/Services/Ordering/Ordering.API:/app - - ~/.nuget/packages:/root/.nuget/packages:ro - - ~/clrdbg:/clrdbg:ro - entrypoint: tail -f /dev/null - labels: - - "com.microsoft.visualstudio.targetoperatingsystem=linux" - - marketing.api: - image: eshop/marketing.api:dev - build: - args: - source: ${DOCKER_BUILD_SOURCE} - environment: - - DOTNET_USE_POLLING_FILE_WATCHER=1 - volumes: - - ./src/Services/Marketing/Marketing.API:/app - - ~/.nuget/packages:/root/.nuget/packages:ro - - ~/clrdbg:/clrdbg:ro - entrypoint: tail -f /dev/null - labels: - - "com.microsoft.visualstudio.targetoperatingsystem=linux" - - - webspa: - image: eshop/webspa:dev - build: - args: - source: ${DOCKER_BUILD_SOURCE} - environment: - - DOTNET_USE_POLLING_FILE_WATCHER=1 - volumes: - - ./src/Web/WebSPA:/app - - ~/.nuget/packages:/root/.nuget/packages:ro - - ~/clrdbg:/clrdbg:ro - entrypoint: tail -f /dev/null - labels: - - "com.microsoft.visualstudio.targetoperatingsystem=linux" - - webmvc: - image: eshop/webmvc:dev - build: - args: - source: ${DOCKER_BUILD_SOURCE} - environment: - - DOTNET_USE_POLLING_FILE_WATCHER=1 - volumes: - - ./src/Web/WebMVC:/app - - ~/.nuget/packages:/root/.nuget/packages:ro - - ~/clrdbg:/clrdbg:ro - entrypoint: tail -f /dev/null - labels: - - "com.microsoft.visualstudio.targetoperatingsystem=linux" - - webstatus: - image: eshop/webstatus:dev - build: - args: - source: ${DOCKER_BUILD_SOURCE} - environment: - - DOTNET_USE_POLLING_FILE_WATCHER=1 - volumes: - - ./src/Web/WebStatus:/app - - ~/.nuget/packages:/root/.nuget/packages:ro - - ~/clrdbg:/clrdbg:ro - entrypoint: tail -f /dev/null - labels: - - "com.microsoft.visualstudio.targetoperatingsystem=linux" - - payment.api: - image: eshop/payment.api:dev - build: - args: - source: ${DOCKER_BUILD_SOURCE} - environment: - - DOTNET_USE_POLLING_FILE_WATCHER=1 - volumes: - - ./src/Services/Payment/Payment.API:/app - - ~/.nuget/packages:/root/.nuget/packages:ro - - ~/clrdbg:/clrdbg:ro - entrypoint: tail -f /dev/null - labels: - - "com.microsoft.visualstudio.targetoperatingsystem=linux" - - graceperiodmanager: - image: eshop/graceperiodmanager:dev - build: - args: - source: ${DOCKER_BUILD_SOURCE} - volumes: - - ./src/Services/GracePeriod/GracePeriodManager:/app - - ~/.nuget/packages:/root/.nuget/packages:ro - - ~/clrdbg:/clrdbg:ro - entrypoint: tail -f /dev/null - labels: - - "com.microsoft.visualstudio.targetoperatingsystem=linux" - - locations.api: - image: eshop/locations.api:dev - build: - args: - source: ${DOCKER_BUILD_SOURCE} - environment: - - DOTNET_USE_POLLING_FILE_WATCHER=1 - volumes: - - ./src/Services/Location/Locations.API:/app - - ~/.nuget/packages:/root/.nuget/packages:ro - - ~/clrdbg:/clrdbg:ro - entrypoint: tail -f /dev/null - labels: - - "com.microsoft.visualstudio.targetoperatingsystem=linux" diff --git a/docker-compose.vs.release.yml b/docker-compose.vs.release.yml deleted file mode 100644 index 6aac3f799..000000000 --- a/docker-compose.vs.release.yml +++ /dev/null @@ -1,112 +0,0 @@ -version: '3' - -services: - basket.api: - build: - args: - source: ${DOCKER_BUILD_SOURCE} - volumes: - - ~/clrdbg:/clrdbg:ro - entrypoint: tail -f /dev/null - labels: - - "com.microsoft.visualstudio.targetoperatingsystem=linux" - - catalog.api: - build: - args: - source: ${DOCKER_BUILD_SOURCE} - volumes: - - ~/clrdbg:/clrdbg:ro - entrypoint: tail -f /dev/null - labels: - - "com.microsoft.visualstudio.targetoperatingsystem=linux" - - identity.api: - build: - args: - source: ${DOCKER_BUILD_SOURCE} - volumes: - - ~/clrdbg:/clrdbg:ro - entrypoint: tail -f /dev/null - labels: - - "com.microsoft.visualstudio.targetoperatingsystem=linux" - - ordering.api: - build: - args: - source: ${DOCKER_BUILD_SOURCE} - volumes: - - ~/clrdbg:/clrdbg:ro - entrypoint: tail -f /dev/null - labels: - - "com.microsoft.visualstudio.targetoperatingsystem=linux" - - marketing.api: - build: - args: - source: ${DOCKER_BUILD_SOURCE} - volumes: - - ~/clrdbg:/clrdbg:ro - entrypoint: tail -f /dev/null - labels: - - "com.microsoft.visualstudio.targetoperatingsystem=linux" - - webspa: - build: - args: - source: ${DOCKER_BUILD_SOURCE} - volumes: - - ~/clrdbg:/clrdbg:ro - entrypoint: tail -f /dev/null - labels: - - "com.microsoft.visualstudio.targetoperatingsystem=linux" - - webmvc: - build: - args: - source: ${DOCKER_BUILD_SOURCE} - volumes: - - ~/clrdbg:/clrdbg:ro - entrypoint: tail -f /dev/null - labels: - - "com.microsoft.visualstudio.targetoperatingsystem=linux" - - webstatus: - build: - args: - source: ${DOCKER_BUILD_SOURCE} - volumes: - - ~/clrdbg:/clrdbg:ro - entrypoint: tail -f /dev/null - labels: - - "com.microsoft.visualstudio.targetoperatingsystem=linux" - - payment.api: - build: - args: - source: ${DOCKER_BUILD_SOURCE} - volumes: - - ~/clrdbg:/clrdbg:ro - entrypoint: tail -f /dev/null - labels: - - "com.microsoft.visualstudio.targetoperatingsystem=linux" - - graceperiodmanager: - build: - args: - source: ${DOCKER_BUILD_SOURCE} - volumes: - - ~/clrdbg:/clrdbg:ro - entrypoint: tail -f /dev/null - labels: - - "com.microsoft.visualstudio.targetoperatingsystem=linux" - - locations.api: - build: - args: - source: ${DOCKER_BUILD_SOURCE} - volumes: - - ~/clrdbg:/clrdbg:ro - entrypoint: tail -f /dev/null - labels: - - "com.microsoft.visualstudio.targetoperatingsystem=linux" diff --git a/global.json b/global.json index 38fed7db6..6c30ddc76 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,5 @@ { "sdk": { - "version":"1.0.4" + "version":"2.0.0-preview1-005977" } } \ No newline at end of file From 56902a554970e9ff8eda5ed770f58bee028902ca Mon Sep 17 00:00:00 2001 From: Eduard Tomas Date: Wed, 21 Jun 2017 19:03:48 +0200 Subject: [PATCH 02/64] [WIP] Projects & Dockerfile migrated to 2.0 Lots of things to address yet, because nuget packages are still on 1.1 --- cli-windows/build-bits.ps1 | 7 ++++++- .../DataProtection/DataProtection.csproj | 2 +- .../EventBus/EventBus.Tests/EventBus.Tests.csproj | 2 +- .../EventBus/EventBus/EventBus.csproj | 2 +- .../EventBusRabbitMQ/EventBusRabbitMQ.csproj | 2 +- src/Services/Basket/Basket.API/Basket.API.csproj | 2 +- src/Services/Basket/Basket.API/Dockerfile | 2 +- .../Catalog/Catalog.API/Catalog.API.csproj | 2 +- src/Services/Catalog/Catalog.API/Dockerfile | 2 +- .../GracePeriod/GracePeriodManager/Dockerfile | 2 +- .../GracePeriodManager/GracePeriodManager.csproj | 2 +- .../Location/Locations.API/Locations.API.csproj | 2 +- src/Services/Marketing/Marketing.API/Dockerfile | 2 +- .../Marketing/Marketing.API/Marketing.API.csproj | 3 ++- src/Services/Ordering/Ordering.API/Dockerfile | 2 +- .../Ordering/Ordering.API/Ordering.API.csproj | 2 +- .../Ordering.Domain/Ordering.Domain.csproj | 3 ++- .../Ordering.Domain/SeedWork/Enumeration.cs | 2 +- .../Ordering.Infrastructure.csproj | 2 +- .../Payment/Payment.API/Payment.API.csproj | 2 +- src/Web/WebMVC/Dockerfile | 2 +- src/Web/WebMVC/Startup.cs | 5 +++-- src/Web/WebMVC/WebMVC.csproj | 4 +--- src/Web/WebSPA/Dockerfile | 2 +- src/Web/WebSPA/WebSPA.csproj | 5 +---- src/Web/WebStatus/Dockerfile | 2 +- src/Web/WebStatus/WebStatus.csproj | 14 +++----------- .../FunctionalTests/FunctionalTests.csproj | 2 +- .../IntegrationTests/IntegrationTests.csproj | 2 +- test/Services/UnitTest/UnitTest.csproj | 2 +- 30 files changed, 41 insertions(+), 46 deletions(-) diff --git a/cli-windows/build-bits.ps1 b/cli-windows/build-bits.ps1 index 26651da5b..9533ee25e 100644 --- a/cli-windows/build-bits.ps1 +++ b/cli-windows/build-bits.ps1 @@ -14,7 +14,12 @@ $projectPaths = @{Path="$rootPath\src\Services\Identity\Identity.API";Prj="Identity.API.csproj"}, @{Path="$rootPath\src\Services\Catalog\Catalog.API";Prj="Catalog.API.csproj"}, @{Path="$rootPath\src\Services\Ordering\Ordering.API";Prj="Ordering.API.csproj"}, - @{Path="$rootPath\src\Services\Basket\Basket.API";Prj="Basket.API.csproj"} + @{Path="$rootPath\src\Services\GracePeriod\GracePeriodManager";Prj="GracePeriodManager.csproj"}, + @{Path="$rootPath\src\Services\Basket\Basket.API";Prj="Basket.API.csproj"}, + @{Path="$rootPath\src\Services\Identity\Identity.API";Prj="Identity.API.csproj"}, + @{Path="$rootPath\src\Services\Location\Location.API";Prj="Locations.API.csproj"}, + @{Path="$rootPath\src\Services\Marketing\Marketing.API";Prj="Marketing.API.csproj"}, + @{Path="$rootPath\src\Services\Payment\Payment.API";Prj="Payment.API.csproj"}, @{Path="$rootPath\src\Web\WebStatus";Prj="WebStatus.csproj"} $projectPaths | foreach { diff --git a/src/BuildingBlocks/DataProtection/DataProtection/DataProtection.csproj b/src/BuildingBlocks/DataProtection/DataProtection/DataProtection.csproj index bfe61a85a..c5266d0a9 100644 --- a/src/BuildingBlocks/DataProtection/DataProtection/DataProtection.csproj +++ b/src/BuildingBlocks/DataProtection/DataProtection/DataProtection.csproj @@ -1,7 +1,7 @@  - netcoreapp1.1 + netstandard1.5 Microsoft.eShopOnContainers.BuildingBlocks diff --git a/src/BuildingBlocks/EventBus/EventBus.Tests/EventBus.Tests.csproj b/src/BuildingBlocks/EventBus/EventBus.Tests/EventBus.Tests.csproj index 1387a74dd..8589f6035 100644 --- a/src/BuildingBlocks/EventBus/EventBus.Tests/EventBus.Tests.csproj +++ b/src/BuildingBlocks/EventBus/EventBus.Tests/EventBus.Tests.csproj @@ -1,7 +1,7 @@  - netcoreapp1.1 + netstandard1.5 diff --git a/src/BuildingBlocks/EventBus/EventBus/EventBus.csproj b/src/BuildingBlocks/EventBus/EventBus/EventBus.csproj index 37aeb8d1f..723b22b64 100644 --- a/src/BuildingBlocks/EventBus/EventBus/EventBus.csproj +++ b/src/BuildingBlocks/EventBus/EventBus/EventBus.csproj @@ -1,7 +1,7 @@  - netcoreapp1.1 + netstandard1.5 Microsoft.eShopOnContainers.BuildingBlocks.EventBus diff --git a/src/BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.csproj b/src/BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.csproj index d7e3a58d8..d59c999c1 100644 --- a/src/BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.csproj +++ b/src/BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.csproj @@ -1,7 +1,7 @@  - netcoreapp1.1 + netstandard1.5 Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ diff --git a/src/Services/Basket/Basket.API/Basket.API.csproj b/src/Services/Basket/Basket.API/Basket.API.csproj index 5287dcc96..6e5c66b61 100644 --- a/src/Services/Basket/Basket.API/Basket.API.csproj +++ b/src/Services/Basket/Basket.API/Basket.API.csproj @@ -1,7 +1,7 @@  - netcoreapp1.1 + netcoreapp2.0 1.1.2 Exe $(PackageTargetFallback);netstandard1.6.1;dnxcore50;portable-net451+win8 diff --git a/src/Services/Basket/Basket.API/Dockerfile b/src/Services/Basket/Basket.API/Dockerfile index c81c776b0..2e7395520 100644 --- a/src/Services/Basket/Basket.API/Dockerfile +++ b/src/Services/Basket/Basket.API/Dockerfile @@ -1,4 +1,4 @@ -FROM microsoft/aspnetcore:1.1.2 +FROM microsoft/aspnetcore:2.0 ARG source WORKDIR /app EXPOSE 80 diff --git a/src/Services/Catalog/Catalog.API/Catalog.API.csproj b/src/Services/Catalog/Catalog.API/Catalog.API.csproj index 8f30f7ca3..140a7a552 100644 --- a/src/Services/Catalog/Catalog.API/Catalog.API.csproj +++ b/src/Services/Catalog/Catalog.API/Catalog.API.csproj @@ -1,7 +1,7 @@  - netcoreapp1.1 + netcoreapp2.0 portable true Catalog.API diff --git a/src/Services/Catalog/Catalog.API/Dockerfile b/src/Services/Catalog/Catalog.API/Dockerfile index 61c8e8839..0f5d934d2 100644 --- a/src/Services/Catalog/Catalog.API/Dockerfile +++ b/src/Services/Catalog/Catalog.API/Dockerfile @@ -1,4 +1,4 @@ -FROM microsoft/aspnetcore:1.1.2 +FROM microsoft/aspnetcore:2.0 ARG source WORKDIR /app EXPOSE 80 diff --git a/src/Services/GracePeriod/GracePeriodManager/Dockerfile b/src/Services/GracePeriod/GracePeriodManager/Dockerfile index 37971fde2..7a4f21a64 100644 --- a/src/Services/GracePeriod/GracePeriodManager/Dockerfile +++ b/src/Services/GracePeriod/GracePeriodManager/Dockerfile @@ -1,4 +1,4 @@ -FROM microsoft/aspnetcore:1.1.2 +FROM microsoft/aspnetcore:2.0 ARG source WORKDIR /app COPY ${source:-obj/Docker/publish} . diff --git a/src/Services/GracePeriod/GracePeriodManager/GracePeriodManager.csproj b/src/Services/GracePeriod/GracePeriodManager/GracePeriodManager.csproj index d057a6b54..ab9a44f2e 100644 --- a/src/Services/GracePeriod/GracePeriodManager/GracePeriodManager.csproj +++ b/src/Services/GracePeriod/GracePeriodManager/GracePeriodManager.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp1.1 + netcoreapp2.0 1.1.2 diff --git a/src/Services/Location/Locations.API/Locations.API.csproj b/src/Services/Location/Locations.API/Locations.API.csproj index b9ef671dc..e78661ba0 100644 --- a/src/Services/Location/Locations.API/Locations.API.csproj +++ b/src/Services/Location/Locations.API/Locations.API.csproj @@ -1,7 +1,7 @@  - netcoreapp1.1 + netcoreapp2.0 ..\..\..\..\docker-compose.dcproj Microsoft.eShopOnContainers.Services.Locations.API aspnet-Locations.API-20161122013619 diff --git a/src/Services/Marketing/Marketing.API/Dockerfile b/src/Services/Marketing/Marketing.API/Dockerfile index 54a79a5e4..bae6435ed 100644 --- a/src/Services/Marketing/Marketing.API/Dockerfile +++ b/src/Services/Marketing/Marketing.API/Dockerfile @@ -1,4 +1,4 @@ -FROM microsoft/aspnetcore:1.1.2 +FROM microsoft/aspnetcore:2.0 ARG source WORKDIR /app EXPOSE 80 diff --git a/src/Services/Marketing/Marketing.API/Marketing.API.csproj b/src/Services/Marketing/Marketing.API/Marketing.API.csproj index 4a6e2d4ea..85d9370ce 100644 --- a/src/Services/Marketing/Marketing.API/Marketing.API.csproj +++ b/src/Services/Marketing/Marketing.API/Marketing.API.csproj @@ -1,13 +1,14 @@  - netcoreapp1.1 + netcoreapp2.0 1.1.2 Exe ..\..\..\..\docker-compose.dcproj Microsoft.eShopOnContainers.Services.Marketing.API portable-net45+win8 aspnet-Marketing.API-20161122013619 + diff --git a/src/Services/Ordering/Ordering.API/Dockerfile b/src/Services/Ordering/Ordering.API/Dockerfile index 09564ae9a..c7386bb43 100644 --- a/src/Services/Ordering/Ordering.API/Dockerfile +++ b/src/Services/Ordering/Ordering.API/Dockerfile @@ -1,4 +1,4 @@ -FROM microsoft/aspnetcore:1.1.2 +FROM microsoft/aspnetcore:2.0 ARG source WORKDIR /app EXPOSE 80 diff --git a/src/Services/Ordering/Ordering.API/Ordering.API.csproj b/src/Services/Ordering/Ordering.API/Ordering.API.csproj index 96b4f6627..71c2ea251 100644 --- a/src/Services/Ordering/Ordering.API/Ordering.API.csproj +++ b/src/Services/Ordering/Ordering.API/Ordering.API.csproj @@ -1,7 +1,7 @@  - netcoreapp1.1 + netcoreapp2.0 1.1.2 Exe aspnet-Ordering.API-20161122013547 diff --git a/src/Services/Ordering/Ordering.Domain/Ordering.Domain.csproj b/src/Services/Ordering/Ordering.Domain/Ordering.Domain.csproj index 528f5e27a..c6cb205c3 100644 --- a/src/Services/Ordering/Ordering.Domain/Ordering.Domain.csproj +++ b/src/Services/Ordering/Ordering.Domain/Ordering.Domain.csproj @@ -1,7 +1,7 @@  - netstandard1.6.1 + netstandard1.4 Ordering.Domain Ordering.Domain 1.6.1 @@ -14,6 +14,7 @@ + diff --git a/src/Services/Ordering/Ordering.Domain/SeedWork/Enumeration.cs b/src/Services/Ordering/Ordering.Domain/SeedWork/Enumeration.cs index ec8dfd968..ecf248be9 100644 --- a/src/Services/Ordering/Ordering.Domain/SeedWork/Enumeration.cs +++ b/src/Services/Ordering/Ordering.Domain/SeedWork/Enumeration.cs @@ -29,7 +29,7 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.SeedWork public static IEnumerable GetAll() where T : Enumeration, new() { var type = typeof(T); - var fields = type.GetTypeInfo().GetFields(BindingFlags.Public | BindingFlags.Static | BindingFlags.DeclaredOnly); + var fields = type.GetFields(BindingFlags.Public | BindingFlags.Static | BindingFlags.DeclaredOnly); foreach (var info in fields) { diff --git a/src/Services/Ordering/Ordering.Infrastructure/Ordering.Infrastructure.csproj b/src/Services/Ordering/Ordering.Infrastructure/Ordering.Infrastructure.csproj index 43ba7ecd1..6f460108f 100644 --- a/src/Services/Ordering/Ordering.Infrastructure/Ordering.Infrastructure.csproj +++ b/src/Services/Ordering/Ordering.Infrastructure/Ordering.Infrastructure.csproj @@ -1,7 +1,7 @@  - netstandard1.6.1 + netstandard1.4 Ordering.Infrastructure Ordering.Infrastructure 1.6.1 diff --git a/src/Services/Payment/Payment.API/Payment.API.csproj b/src/Services/Payment/Payment.API/Payment.API.csproj index dc8aad80d..bb873d1c8 100644 --- a/src/Services/Payment/Payment.API/Payment.API.csproj +++ b/src/Services/Payment/Payment.API/Payment.API.csproj @@ -1,7 +1,7 @@  - netcoreapp1.1 + netcoreapp2.0 ..\..\..\..\docker-compose.dcproj portable-net45+win8 diff --git a/src/Web/WebMVC/Dockerfile b/src/Web/WebMVC/Dockerfile index 16a9c99df..729620bb9 100644 --- a/src/Web/WebMVC/Dockerfile +++ b/src/Web/WebMVC/Dockerfile @@ -1,4 +1,4 @@ -FROM microsoft/aspnetcore:1.1.2 +FROM microsoft/aspnetcore:2.0 ARG source WORKDIR /app EXPOSE 80 diff --git a/src/Web/WebMVC/Startup.cs b/src/Web/WebMVC/Startup.cs index 8147f6720..bcdbbcc21 100644 --- a/src/Web/WebMVC/Startup.cs +++ b/src/Web/WebMVC/Startup.cs @@ -1,4 +1,6 @@ -using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Authentication.Cookies; +using Microsoft.AspNetCore.Authentication.OpenIdConnect; +using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; using Microsoft.eShopOnContainers.BuildingBlocks; @@ -116,7 +118,6 @@ namespace Microsoft.eShopOnContainers.WebMVC var oidcOptions = new OpenIdConnectOptions { - AuthenticationScheme = "oidc", SignInScheme = "Cookies", Authority = identityUrl.ToString(), PostLogoutRedirectUri = callBackUrl.ToString(), diff --git a/src/Web/WebMVC/WebMVC.csproj b/src/Web/WebMVC/WebMVC.csproj index 48925ab34..b6a866c12 100644 --- a/src/Web/WebMVC/WebMVC.csproj +++ b/src/Web/WebMVC/WebMVC.csproj @@ -1,9 +1,7 @@  - netcoreapp1.1 - 1.1.2 - Exe + netcoreapp2.0 aspnet-Microsoft.eShopOnContainers-946ae052-8305-4a99-965b-ec8636ddbae3 $(PackageTargetFallback);dotnet5.6;portable-net45+win8 ..\..\..\docker-compose.dcproj diff --git a/src/Web/WebSPA/Dockerfile b/src/Web/WebSPA/Dockerfile index b954fac87..f08724dd8 100644 --- a/src/Web/WebSPA/Dockerfile +++ b/src/Web/WebSPA/Dockerfile @@ -1,4 +1,4 @@ -FROM microsoft/aspnetcore:1.1.2 +FROM microsoft/aspnetcore:2.0 ARG source WORKDIR /app EXPOSE 80 diff --git a/src/Web/WebSPA/WebSPA.csproj b/src/Web/WebSPA/WebSPA.csproj index c4bc8e8d5..9b64a5fe7 100644 --- a/src/Web/WebSPA/WebSPA.csproj +++ b/src/Web/WebSPA/WebSPA.csproj @@ -1,10 +1,7 @@  - netcoreapp1.1 - 1.1.2 - Exe - eShopOnContainers.WebSPA + netcoreapp2.0 aspnetcorespa-c23d27a4-eb88-4b18-9b77-2a93f3b15119 $(PackageTargetFallback);dotnet5.6;portable-net45+win8 ..\..\..\docker-compose.dcproj diff --git a/src/Web/WebStatus/Dockerfile b/src/Web/WebStatus/Dockerfile index 729a46123..8d9b70884 100644 --- a/src/Web/WebStatus/Dockerfile +++ b/src/Web/WebStatus/Dockerfile @@ -1,4 +1,4 @@ -FROM microsoft/aspnetcore:1.1.2 +FROM microsoft/aspnetcore:2.0 ARG source WORKDIR /app EXPOSE 80 diff --git a/src/Web/WebStatus/WebStatus.csproj b/src/Web/WebStatus/WebStatus.csproj index b845fdcc3..3a5a8c633 100644 --- a/src/Web/WebStatus/WebStatus.csproj +++ b/src/Web/WebStatus/WebStatus.csproj @@ -1,23 +1,15 @@  - netcoreapp1.1.2 - 1.1.2 - - - + netcoreapp2.0 $(PackageTargetFallback);portable-net45+win8+wp8+wpa81; ..\..\..\docker-compose.dcproj + - - - - - - + diff --git a/test/Services/FunctionalTests/FunctionalTests.csproj b/test/Services/FunctionalTests/FunctionalTests.csproj index ef5561595..1bf5db148 100644 --- a/test/Services/FunctionalTests/FunctionalTests.csproj +++ b/test/Services/FunctionalTests/FunctionalTests.csproj @@ -1,7 +1,7 @@  - netcoreapp1.1 + netcoreapp2.0 true $(PackageTargetFallback);netstandard1.6.1;dnxcore50;portable-net451+win8 false diff --git a/test/Services/IntegrationTests/IntegrationTests.csproj b/test/Services/IntegrationTests/IntegrationTests.csproj index 689b801bc..8578b7adf 100644 --- a/test/Services/IntegrationTests/IntegrationTests.csproj +++ b/test/Services/IntegrationTests/IntegrationTests.csproj @@ -1,7 +1,7 @@  - netcoreapp1.1 + netcoreapp2.0 FunctionalTests FunctionalTests true diff --git a/test/Services/UnitTest/UnitTest.csproj b/test/Services/UnitTest/UnitTest.csproj index 2cf0dfbb0..e5a1cb835 100644 --- a/test/Services/UnitTest/UnitTest.csproj +++ b/test/Services/UnitTest/UnitTest.csproj @@ -1,7 +1,7 @@  - netcoreapp1.1 + netcoreapp2.0 true $(PackageTargetFallback);netstandard1.6.1;dnxcore50;portable-net451+win8 false From 5d383dbaad4db1bfe57b876f2cb681409873f992 Mon Sep 17 00:00:00 2001 From: Eduard Tomas Date: Wed, 21 Jun 2017 19:10:12 +0200 Subject: [PATCH 03/64] GracePeriodManager nuget updated --- .../GracePeriodManager.csproj | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Services/GracePeriod/GracePeriodManager/GracePeriodManager.csproj b/src/Services/GracePeriod/GracePeriodManager/GracePeriodManager.csproj index ab9a44f2e..08f3542fa 100644 --- a/src/Services/GracePeriod/GracePeriodManager/GracePeriodManager.csproj +++ b/src/Services/GracePeriod/GracePeriodManager/GracePeriodManager.csproj @@ -9,15 +9,15 @@ - - - - - - - - - + + + + + + + + + From b050ba5c944d942fa15b81b931a87618774ba556 Mon Sep 17 00:00:00 2001 From: Eduard Tomas Date: Wed, 21 Jun 2017 19:16:59 +0200 Subject: [PATCH 04/64] DataProtection.csproj nuget updated --- .../DataProtection/DataProtection/DataProtection.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BuildingBlocks/DataProtection/DataProtection/DataProtection.csproj b/src/BuildingBlocks/DataProtection/DataProtection/DataProtection.csproj index c5266d0a9..ab35dab8e 100644 --- a/src/BuildingBlocks/DataProtection/DataProtection/DataProtection.csproj +++ b/src/BuildingBlocks/DataProtection/DataProtection/DataProtection.csproj @@ -6,7 +6,7 @@ - + From 7fd5647bae65bfe9784f9edae9346b464d0e3b97 Mon Sep 17 00:00:00 2001 From: Eduard Tomas Date: Wed, 21 Jun 2017 19:19:58 +0200 Subject: [PATCH 05/64] EventBus.csproj nuget updated --- src/BuildingBlocks/EventBus/EventBus/EventBus.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BuildingBlocks/EventBus/EventBus/EventBus.csproj b/src/BuildingBlocks/EventBus/EventBus/EventBus.csproj index 723b22b64..1fc8e48cf 100644 --- a/src/BuildingBlocks/EventBus/EventBus/EventBus.csproj +++ b/src/BuildingBlocks/EventBus/EventBus/EventBus.csproj @@ -10,7 +10,7 @@ - + \ No newline at end of file From ea129609d580631c284a81df29bec5b372339960 Mon Sep 17 00:00:00 2001 From: Eduard Tomas Date: Wed, 21 Jun 2017 19:33:24 +0200 Subject: [PATCH 06/64] Basket.API nuget updated --- .../Basket/Basket.API/Basket.API.csproj | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/src/Services/Basket/Basket.API/Basket.API.csproj b/src/Services/Basket/Basket.API/Basket.API.csproj index 6e5c66b61..d2e8d5173 100644 --- a/src/Services/Basket/Basket.API/Basket.API.csproj +++ b/src/Services/Basket/Basket.API/Basket.API.csproj @@ -2,8 +2,6 @@ netcoreapp2.0 - 1.1.2 - Exe $(PackageTargetFallback);netstandard1.6.1;dnxcore50;portable-net451+win8 ..\..\..\..\docker-compose.dcproj @@ -21,19 +19,19 @@ - - - - - - - - - - + + + + + + + + + + - - + + From 4069a3a048109c3dc116e7cee0f942ae6ca0d4f0 Mon Sep 17 00:00:00 2001 From: Eduard Tomas Date: Wed, 21 Jun 2017 19:36:33 +0200 Subject: [PATCH 07/64] Catalog.API nuget updated --- .../Catalog/Catalog.API/Catalog.API.csproj | 40 +++++++++---------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/src/Services/Catalog/Catalog.API/Catalog.API.csproj b/src/Services/Catalog/Catalog.API/Catalog.API.csproj index 140a7a552..5cd6691ab 100644 --- a/src/Services/Catalog/Catalog.API/Catalog.API.csproj +++ b/src/Services/Catalog/Catalog.API/Catalog.API.csproj @@ -5,10 +5,8 @@ portable true Catalog.API - Exe Catalog.API aspnet-Catalog.API-20161122013618 - 1.1.2 $(PackageTargetFallback);dotnet5.6;portable-net45+win8 ..\..\..\..\docker-compose.dcproj @@ -30,25 +28,25 @@ - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + From 4303cbae89d6fe2e93fa72f1e6d4db71d55d29bc Mon Sep 17 00:00:00 2001 From: Eduard Tomas Date: Wed, 21 Jun 2017 19:39:47 +0200 Subject: [PATCH 08/64] Locations.API nuget updated --- .../Locations.API/Locations.API.csproj | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/Services/Location/Locations.API/Locations.API.csproj b/src/Services/Location/Locations.API/Locations.API.csproj index e78661ba0..01cb58ec5 100644 --- a/src/Services/Location/Locations.API/Locations.API.csproj +++ b/src/Services/Location/Locations.API/Locations.API.csproj @@ -11,25 +11,25 @@ - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + From 706423cc8d4d88c3bbfdd980315ae1874fe1f0a9 Mon Sep 17 00:00:00 2001 From: Eduard Tomas Date: Wed, 21 Jun 2017 19:43:02 +0200 Subject: [PATCH 09/64] Marketing.API nuget updated --- .../Marketing.API/Marketing.API.csproj | 56 +++++++++---------- 1 file changed, 27 insertions(+), 29 deletions(-) diff --git a/src/Services/Marketing/Marketing.API/Marketing.API.csproj b/src/Services/Marketing/Marketing.API/Marketing.API.csproj index 85d9370ce..b8af9107a 100644 --- a/src/Services/Marketing/Marketing.API/Marketing.API.csproj +++ b/src/Services/Marketing/Marketing.API/Marketing.API.csproj @@ -2,8 +2,6 @@ netcoreapp2.0 - 1.1.2 - Exe ..\..\..\..\docker-compose.dcproj Microsoft.eShopOnContainers.Services.Marketing.API portable-net45+win8 @@ -20,33 +18,33 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + From 3c2ce4d7a7a4b5089c2a19bca62accafdd8a67fe Mon Sep 17 00:00:00 2001 From: Eduard Tomas Date: Wed, 21 Jun 2017 19:48:13 +0200 Subject: [PATCH 10/64] Ordering.API nuget update --- .../Ordering/Ordering.API/Ordering.API.csproj | 46 +++++++++---------- .../Ordering.Domain/Ordering.Domain.csproj | 2 +- .../Ordering.Infrastructure.csproj | 6 +-- 3 files changed, 26 insertions(+), 28 deletions(-) diff --git a/src/Services/Ordering/Ordering.API/Ordering.API.csproj b/src/Services/Ordering/Ordering.API/Ordering.API.csproj index 71c2ea251..80c3d9068 100644 --- a/src/Services/Ordering/Ordering.API/Ordering.API.csproj +++ b/src/Services/Ordering/Ordering.API/Ordering.API.csproj @@ -2,8 +2,6 @@ netcoreapp2.0 - 1.1.2 - Exe aspnet-Ordering.API-20161122013547 $(PackageTargetFallback);netstandard1.6.1;dnxcore50;portable-net451+win8 ..\..\..\..\docker-compose.dcproj @@ -30,35 +28,35 @@ - + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - + - - + + diff --git a/src/Services/Ordering/Ordering.Domain/Ordering.Domain.csproj b/src/Services/Ordering/Ordering.Domain/Ordering.Domain.csproj index c6cb205c3..9ccbf60eb 100644 --- a/src/Services/Ordering/Ordering.Domain/Ordering.Domain.csproj +++ b/src/Services/Ordering/Ordering.Domain/Ordering.Domain.csproj @@ -14,7 +14,7 @@ - + diff --git a/src/Services/Ordering/Ordering.Infrastructure/Ordering.Infrastructure.csproj b/src/Services/Ordering/Ordering.Infrastructure/Ordering.Infrastructure.csproj index 6f460108f..ef785364f 100644 --- a/src/Services/Ordering/Ordering.Infrastructure/Ordering.Infrastructure.csproj +++ b/src/Services/Ordering/Ordering.Infrastructure/Ordering.Infrastructure.csproj @@ -16,9 +16,9 @@ - - - + + + From 17dc20077d2fcab4d69babc90b6d7e9911196218 Mon Sep 17 00:00:00 2001 From: Eduard Tomas Date: Wed, 21 Jun 2017 19:50:01 +0200 Subject: [PATCH 11/64] Payment.API nuget updated --- .../Payment/Payment.API/Payment.API.csproj | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Services/Payment/Payment.API/Payment.API.csproj b/src/Services/Payment/Payment.API/Payment.API.csproj index bb873d1c8..1bbb9696b 100644 --- a/src/Services/Payment/Payment.API/Payment.API.csproj +++ b/src/Services/Payment/Payment.API/Payment.API.csproj @@ -11,15 +11,15 @@ - - - - - - - - - + + + + + + + + + From 286b8e4344b144e8644a17dc5a8bf461abbe38d5 Mon Sep 17 00:00:00 2001 From: Eduard Tomas Date: Wed, 21 Jun 2017 19:57:36 +0200 Subject: [PATCH 12/64] Unwanted fwk reference in GracePeriodManager --- .../GracePeriod/GracePeriodManager/GracePeriodManager.csproj | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Services/GracePeriod/GracePeriodManager/GracePeriodManager.csproj b/src/Services/GracePeriod/GracePeriodManager/GracePeriodManager.csproj index 08f3542fa..f239692b7 100644 --- a/src/Services/GracePeriod/GracePeriodManager/GracePeriodManager.csproj +++ b/src/Services/GracePeriod/GracePeriodManager/GracePeriodManager.csproj @@ -3,7 +3,6 @@ Exe netcoreapp2.0 - 1.1.2 From 6b466a2c664291bf6c6c69775062d331fdcdb51c Mon Sep 17 00:00:00 2001 From: Eduard Tomas Date: Thu, 22 Jun 2017 16:15:58 +0200 Subject: [PATCH 13/64] Fixing NetStandard.Library versions --- .../DataProtection/DataProtection/DataProtection.csproj | 1 + src/Services/Location/Locations.API/Dockerfile | 2 +- src/Services/Ordering/Ordering.Domain/Ordering.Domain.csproj | 2 +- .../Ordering.Infrastructure/Ordering.Infrastructure.csproj | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/BuildingBlocks/DataProtection/DataProtection/DataProtection.csproj b/src/BuildingBlocks/DataProtection/DataProtection/DataProtection.csproj index ab35dab8e..69b23a145 100644 --- a/src/BuildingBlocks/DataProtection/DataProtection/DataProtection.csproj +++ b/src/BuildingBlocks/DataProtection/DataProtection/DataProtection.csproj @@ -3,6 +3,7 @@ netstandard1.5 Microsoft.eShopOnContainers.BuildingBlocks + 2.0.0-preview1-25301-01 diff --git a/src/Services/Location/Locations.API/Dockerfile b/src/Services/Location/Locations.API/Dockerfile index 3d00f01a9..5a5edb3e7 100644 --- a/src/Services/Location/Locations.API/Dockerfile +++ b/src/Services/Location/Locations.API/Dockerfile @@ -1,4 +1,4 @@ -FROM microsoft/aspnetcore:1.1 +FROM microsoft/aspnetcore:2.0 ARG source WORKDIR /app EXPOSE 80 diff --git a/src/Services/Ordering/Ordering.Domain/Ordering.Domain.csproj b/src/Services/Ordering/Ordering.Domain/Ordering.Domain.csproj index 9ccbf60eb..187dc56fc 100644 --- a/src/Services/Ordering/Ordering.Domain/Ordering.Domain.csproj +++ b/src/Services/Ordering/Ordering.Domain/Ordering.Domain.csproj @@ -3,8 +3,8 @@ netstandard1.4 Ordering.Domain + 2.0.0-preview1-25301-01 Ordering.Domain - 1.6.1 $(PackageTargetFallback);dnxcore50 false false diff --git a/src/Services/Ordering/Ordering.Infrastructure/Ordering.Infrastructure.csproj b/src/Services/Ordering/Ordering.Infrastructure/Ordering.Infrastructure.csproj index ef785364f..ea8d8c29b 100644 --- a/src/Services/Ordering/Ordering.Infrastructure/Ordering.Infrastructure.csproj +++ b/src/Services/Ordering/Ordering.Infrastructure/Ordering.Infrastructure.csproj @@ -4,7 +4,7 @@ netstandard1.4 Ordering.Infrastructure Ordering.Infrastructure - 1.6.1 + 2.0.0-preview1-25301-01 $(PackageTargetFallback);dnxcore50 false false From 0a1f14f1f185812cdf56ec44c3acbd1a809f3c5e Mon Sep 17 00:00:00 2001 From: Eduard Tomas Date: Thu, 22 Jun 2017 16:19:54 +0200 Subject: [PATCH 14/64] WebSPA nuget update --- src/Web/WebSPA/Startup.cs | 6 ------ src/Web/WebSPA/WebSPA.csproj | 42 ++++++++++++++++++------------------ 2 files changed, 21 insertions(+), 27 deletions(-) diff --git a/src/Web/WebSPA/Startup.cs b/src/Web/WebSPA/Startup.cs index d9e9d093b..53406422f 100644 --- a/src/Web/WebSPA/Startup.cs +++ b/src/Web/WebSPA/Startup.cs @@ -27,12 +27,6 @@ namespace eShopConContainers.WebSPA .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true) .AddEnvironmentVariables(); - if (env.IsDevelopment()) - { - // For more details on using the user secret store see http://go.microsoft.com/fwlink/?LinkID=532709 - builder.AddUserSecrets(); - } - Configuration = builder.Build(); var localPath = new Uri(Configuration["ASPNETCORE_URLS"])?.LocalPath ?? "/"; diff --git a/src/Web/WebSPA/WebSPA.csproj b/src/Web/WebSPA/WebSPA.csproj index 9b64a5fe7..c598d700e 100644 --- a/src/Web/WebSPA/WebSPA.csproj +++ b/src/Web/WebSPA/WebSPA.csproj @@ -25,29 +25,29 @@ - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + All - - + + From bbc682d6a9925a40cde76182683f9bd0ee162686 Mon Sep 17 00:00:00 2001 From: Eduard Tomas Date: Thu, 22 Jun 2017 16:22:41 +0200 Subject: [PATCH 15/64] WebMVC nuget update --- src/Web/WebMVC/WebMVC.csproj | 40 ++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/Web/WebMVC/WebMVC.csproj b/src/Web/WebMVC/WebMVC.csproj index b6a866c12..89077d5e9 100644 --- a/src/Web/WebMVC/WebMVC.csproj +++ b/src/Web/WebMVC/WebMVC.csproj @@ -27,29 +27,29 @@ --> - - - - - - - - - - - - - + + + + + + + + + + + + + - + All - - - - - - + + + + + + From fdd9a367190748fe4f9beff76500d2b4f5d89299 Mon Sep 17 00:00:00 2001 From: Eduard Tomas Date: Thu, 22 Jun 2017 16:55:57 +0200 Subject: [PATCH 16/64] MVC auth updated to 2.0.0 --- .../WebMVC/Controllers/AccountController.cs | 5 +- src/Web/WebMVC/Services/BasketService.cs | 2 +- src/Web/WebMVC/Services/CampaignService.cs | 2 +- src/Web/WebMVC/Services/OrderingService.cs | 2 +- src/Web/WebMVC/Startup.cs | 58 +++++++++---------- 5 files changed, 33 insertions(+), 36 deletions(-) diff --git a/src/Web/WebMVC/Controllers/AccountController.cs b/src/Web/WebMVC/Controllers/AccountController.cs index a38207d58..c00a94c72 100644 --- a/src/Web/WebMVC/Controllers/AccountController.cs +++ b/src/Web/WebMVC/Controllers/AccountController.cs @@ -22,7 +22,8 @@ namespace Microsoft.eShopOnContainers.WebMVC.Controllers public async Task SignIn(string returnUrl) { var user = User as ClaimsPrincipal; - var token = await HttpContext.Authentication.GetTokenAsync("access_token"); + + var token = await HttpContext.GetTokenAsync("access_token"); if (token != null) { @@ -42,7 +43,7 @@ namespace Microsoft.eShopOnContainers.WebMVC.Controllers // "Catalog" because UrlHelper doesn't support nameof() for controllers // https://github.com/aspnet/Mvc/issues/5853 var homeUrl = Url.Action(nameof(CatalogController.Index), "Catalog"); - return new SignOutResult("oidc", new AuthenticationProperties { RedirectUri = homeUrl }); + return new SignOutResult("oidc", new AspNetCore.Authentication.AuthenticationProperties { RedirectUri = homeUrl }); } } } diff --git a/src/Web/WebMVC/Services/BasketService.cs b/src/Web/WebMVC/Services/BasketService.cs index 55cec1bb9..fd4bad124 100644 --- a/src/Web/WebMVC/Services/BasketService.cs +++ b/src/Web/WebMVC/Services/BasketService.cs @@ -125,7 +125,7 @@ namespace Microsoft.eShopOnContainers.WebMVC.Services async Task GetUserTokenAsync() { var context = _httpContextAccesor.HttpContext; - return await context.Authentication.GetTokenAsync("access_token"); + return await context.GetTokenAsync("access_token"); } } } diff --git a/src/Web/WebMVC/Services/CampaignService.cs b/src/Web/WebMVC/Services/CampaignService.cs index e90be9590..dd93e3283 100644 --- a/src/Web/WebMVC/Services/CampaignService.cs +++ b/src/Web/WebMVC/Services/CampaignService.cs @@ -64,7 +64,7 @@ private async Task GetUserTokenAsync() { var context = _httpContextAccesor.HttpContext; - return await context.Authentication.GetTokenAsync("access_token"); + return await context.GetTokenAsync("access_token"); } } } \ No newline at end of file diff --git a/src/Web/WebMVC/Services/OrderingService.cs b/src/Web/WebMVC/Services/OrderingService.cs index d9eba7392..f36f1410d 100644 --- a/src/Web/WebMVC/Services/OrderingService.cs +++ b/src/Web/WebMVC/Services/OrderingService.cs @@ -151,7 +151,7 @@ namespace Microsoft.eShopOnContainers.WebMVC.Services { var context = _httpContextAccesor.HttpContext; - return await context.Authentication.GetTokenAsync("access_token"); + return await context.GetTokenAsync("access_token"); } } } diff --git a/src/Web/WebMVC/Startup.cs b/src/Web/WebMVC/Startup.cs index bcdbbcc21..7fe05da02 100644 --- a/src/Web/WebMVC/Startup.cs +++ b/src/Web/WebMVC/Startup.cs @@ -26,13 +26,6 @@ namespace Microsoft.eShopOnContainers.WebMVC .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) // Settings for the application .AddEnvironmentVariables(); // override settings with environment variables set in compose. - - if (env.IsDevelopment()) - { - // For more details on using the user secret store see http://go.microsoft.com/fwlink/?LinkID=532709 - builder.AddUserSecrets(); - } - Configuration = builder.Build(); } @@ -84,6 +77,32 @@ namespace Microsoft.eShopOnContainers.WebMVC { services.AddSingleton(); } + + + var identityUrl = Configuration.GetValue("IdentityUrl"); + var callBackUrl = Configuration.GetValue("CallBackUrl"); + // Add Authentication services + services.AddCookieAuthentication(CookieAuthenticationDefaults.AuthenticationScheme); + services.AddOpenIdConnectAuthentication("Oidc", options => + { + options.SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme; + options.Authority = identityUrl.ToString(); + options.PostLogoutRedirectUri = callBackUrl.ToString(); + options.ClientId = "mvc"; + options.ClientSecret = "secret"; + options.ResponseType = "code id_token"; + options.SaveTokens = true; + options.GetClaimsFromUserInfoEndpoint = true; + options.RequireHttpsMetadata = false; + options.Scope.Add("openid"); + options.Scope.Add("profile"); + options.Scope.Add("orders"); + options.Scope.Add("basket"); + options.Scope.Add("marketing"); + }); + + services.AddAuthentication(sharedOptions => sharedOptions.DefaultSignInScheme = CookieAuthenticationDefaults.AuthenticationScheme); + } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. @@ -106,33 +125,10 @@ namespace Microsoft.eShopOnContainers.WebMVC app.UseStaticFiles(); - app.UseCookieAuthentication(new CookieAuthenticationOptions - { - AuthenticationScheme = "Cookies", - AutomaticAuthenticate = true, - }); - var identityUrl = Configuration.GetValue("IdentityUrl"); - var callBackUrl = Configuration.GetValue("CallBackUrl"); + var log = loggerFactory.CreateLogger("identity"); - var oidcOptions = new OpenIdConnectOptions - { - SignInScheme = "Cookies", - Authority = identityUrl.ToString(), - PostLogoutRedirectUri = callBackUrl.ToString(), - ClientId = "mvc", - ClientSecret = "secret", - ResponseType = "code id_token", - SaveTokens = true, - GetClaimsFromUserInfoEndpoint = true, - RequireHttpsMetadata = false, - Scope = { "openid", "profile", "orders", "basket", "marketing" } - }; - - //Wait untill identity service is ready on compose. - app.UseOpenIdConnectAuthentication(oidcOptions); - app.UseMvc(routes => { routes.MapRoute( From 340d50fddd9e6ea0e887cb06cb6c2a761baf0146 Mon Sep 17 00:00:00 2001 From: Eduard Tomas Date: Thu, 22 Jun 2017 16:56:10 +0200 Subject: [PATCH 17/64] WebStatus Nuget updated --- src/Web/WebStatus/WebStatus.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Web/WebStatus/WebStatus.csproj b/src/Web/WebStatus/WebStatus.csproj index 3a5a8c633..409c7362f 100644 --- a/src/Web/WebStatus/WebStatus.csproj +++ b/src/Web/WebStatus/WebStatus.csproj @@ -6,7 +6,7 @@ - + From d6a6416e195fcecde2df5ef6982fde9552b1db3f Mon Sep 17 00:00:00 2001 From: Eduard Tomas Date: Thu, 22 Jun 2017 16:56:27 +0200 Subject: [PATCH 18/64] Bad folder for Locations.API corrected --- cli-windows/build-bits.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli-windows/build-bits.ps1 b/cli-windows/build-bits.ps1 index 9533ee25e..96caa7f26 100644 --- a/cli-windows/build-bits.ps1 +++ b/cli-windows/build-bits.ps1 @@ -17,7 +17,7 @@ $projectPaths = @{Path="$rootPath\src\Services\GracePeriod\GracePeriodManager";Prj="GracePeriodManager.csproj"}, @{Path="$rootPath\src\Services\Basket\Basket.API";Prj="Basket.API.csproj"}, @{Path="$rootPath\src\Services\Identity\Identity.API";Prj="Identity.API.csproj"}, - @{Path="$rootPath\src\Services\Location\Location.API";Prj="Locations.API.csproj"}, + @{Path="$rootPath\src\Services\Location\Locations.API";Prj="Locations.API.csproj"}, @{Path="$rootPath\src\Services\Marketing\Marketing.API";Prj="Marketing.API.csproj"}, @{Path="$rootPath\src\Services\Payment\Payment.API";Prj="Payment.API.csproj"}, @{Path="$rootPath\src\Web\WebStatus";Prj="WebStatus.csproj"} From eba0a53562d8e0b31155282271da679514708a15 Mon Sep 17 00:00:00 2001 From: Eduard Tomas Date: Thu, 22 Jun 2017 20:11:36 +0200 Subject: [PATCH 19/64] fixed invalid WebMVC csproj entries --- src/Web/WebMVC/WebMVC.csproj | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/Web/WebMVC/WebMVC.csproj b/src/Web/WebMVC/WebMVC.csproj index 89077d5e9..b8a57a359 100644 --- a/src/Web/WebMVC/WebMVC.csproj +++ b/src/Web/WebMVC/WebMVC.csproj @@ -7,17 +7,6 @@ ..\..\..\docker-compose.dcproj - - - - - - - - - PreserveNewest - - + + diff --git a/src/Services/Identity/Identity.API/Identity.API.csproj b/src/Services/Identity/Identity.API/Identity.API.csproj index d31664a2b..4f175503c 100644 --- a/src/Services/Identity/Identity.API/Identity.API.csproj +++ b/src/Services/Identity/Identity.API/Identity.API.csproj @@ -3,7 +3,6 @@ netcoreapp1.1 1.1.2 - Exe aspnet-eShopOnContainers.Identity-90487118-103c-4ff0-b9da-e5e26f7ab0c5 $(PackageTargetFallback);dotnet5.6;portable-net45+win8 ..\..\..\..\docker-compose.dcproj diff --git a/src/Web/WebMVC/Startup.cs b/src/Web/WebMVC/Startup.cs index 7fe05da02..f07fb21c7 100644 --- a/src/Web/WebMVC/Startup.cs +++ b/src/Web/WebMVC/Startup.cs @@ -83,7 +83,7 @@ namespace Microsoft.eShopOnContainers.WebMVC var callBackUrl = Configuration.GetValue("CallBackUrl"); // Add Authentication services services.AddCookieAuthentication(CookieAuthenticationDefaults.AuthenticationScheme); - services.AddOpenIdConnectAuthentication("Oidc", options => + services.AddOpenIdConnectAuthentication(OpenIdConnectDefaults.AuthenticationScheme, options => { options.SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme; options.Authority = identityUrl.ToString(); @@ -101,8 +101,11 @@ namespace Microsoft.eShopOnContainers.WebMVC options.Scope.Add("marketing"); }); - services.AddAuthentication(sharedOptions => sharedOptions.DefaultSignInScheme = CookieAuthenticationDefaults.AuthenticationScheme); - + services.AddAuthentication(options => { + options.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme; + options.DefaultSignInScheme = CookieAuthenticationDefaults.AuthenticationScheme; + options.DefaultAuthenticateScheme = CookieAuthenticationDefaults.AuthenticationScheme; + }); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. @@ -125,7 +128,7 @@ namespace Microsoft.eShopOnContainers.WebMVC app.UseStaticFiles(); - + app.UseAuthentication(); var log = loggerFactory.CreateLogger("identity"); From d65a11253516f2a003c094d1752641af9b51811d Mon Sep 17 00:00:00 2001 From: Eduard Tomas Date: Thu, 29 Jun 2017 18:36:57 +0200 Subject: [PATCH 22/64] References updated to preview-2 code adjustements to work with preview-2 --- cli-windows/build-bits.ps1 | 1 + global.json | 2 +- .../DataProtection/DataProtection.csproj | 2 +- .../EventBusRabbitMQ/EventBusRabbitMQ.csproj | 4 +- .../IntegrationEventLogEF.csproj | 2 +- .../Microsoft.Extensions.HealthChecks.csproj | 2 +- .../Resilience.Http/Resilience.Http.csproj | 4 +- .../Basket/Basket.API/Basket.API.csproj | 22 +++++----- .../Catalog/Catalog.API/Catalog.API.csproj | 38 ++++++++-------- src/Services/Catalog/Catalog.API/Startup.cs | 1 + .../GracePeriodManager.csproj | 18 ++++---- .../Identity/Identity.API/Identity.API.csproj | 5 +-- .../Locations.API/Locations.API.csproj | 24 +++++------ .../Marketing.API/Marketing.API.csproj | 43 +++++++++---------- .../Marketing/Marketing.API/Startup.cs | 1 + .../Ordering/Ordering.API/Ordering.API.csproj | 38 ++++++++-------- .../Ordering.Domain/Ordering.Domain.csproj | 4 +- .../Ordering.Infrastructure.csproj | 11 +++-- .../Payment/Payment.API/Payment.API.csproj | 16 +++---- src/Web/WebMVC/ViewModels/ApplicationUser.cs | 2 +- src/Web/WebMVC/WebMVC.csproj | 39 ++++++++--------- .../WebMonolithic/eShopWeb/eShopWeb.csproj | 1 - src/Web/WebSPA/WebSPA.csproj | 41 ++++++++---------- src/Web/WebStatus/WebStatus.csproj | 6 +-- .../FunctionalTests/FunctionalTests.csproj | 2 +- .../IntegrationTests/IntegrationTests.csproj | 2 +- test/Services/UnitTest/UnitTest.csproj | 2 +- 27 files changed, 162 insertions(+), 171 deletions(-) diff --git a/cli-windows/build-bits.ps1 b/cli-windows/build-bits.ps1 index 96caa7f26..6a5a06d86 100644 --- a/cli-windows/build-bits.ps1 +++ b/cli-windows/build-bits.ps1 @@ -20,6 +20,7 @@ $projectPaths = @{Path="$rootPath\src\Services\Location\Locations.API";Prj="Locations.API.csproj"}, @{Path="$rootPath\src\Services\Marketing\Marketing.API";Prj="Marketing.API.csproj"}, @{Path="$rootPath\src\Services\Payment\Payment.API";Prj="Payment.API.csproj"}, + @{Path="$rootPath\src\Services\GracePeriod\GracePeriodManager";Prj="GracePeriodManager.csproj"}, @{Path="$rootPath\src\Web\WebStatus";Prj="WebStatus.csproj"} $projectPaths | foreach { diff --git a/global.json b/global.json index 6c30ddc76..7d2a1589c 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,5 @@ { "sdk": { - "version":"2.0.0-preview1-005977" + "version":"2.0.0-preview2-006497" } } \ No newline at end of file diff --git a/src/BuildingBlocks/DataProtection/DataProtection/DataProtection.csproj b/src/BuildingBlocks/DataProtection/DataProtection/DataProtection.csproj index a8024b7e5..2f519fc95 100644 --- a/src/BuildingBlocks/DataProtection/DataProtection/DataProtection.csproj +++ b/src/BuildingBlocks/DataProtection/DataProtection/DataProtection.csproj @@ -11,7 +11,7 @@ diff --git a/src/BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.csproj b/src/BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.csproj index d59c999c1..f033ad159 100644 --- a/src/BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.csproj +++ b/src/BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.csproj @@ -8,8 +8,8 @@ - - + + diff --git a/src/BuildingBlocks/EventBus/IntegrationEventLogEF/IntegrationEventLogEF.csproj b/src/BuildingBlocks/EventBus/IntegrationEventLogEF/IntegrationEventLogEF.csproj index cc3d51f6a..30225c299 100644 --- a/src/BuildingBlocks/EventBus/IntegrationEventLogEF/IntegrationEventLogEF.csproj +++ b/src/BuildingBlocks/EventBus/IntegrationEventLogEF/IntegrationEventLogEF.csproj @@ -12,7 +12,7 @@ - + diff --git a/src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks/Microsoft.Extensions.HealthChecks.csproj b/src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks/Microsoft.Extensions.HealthChecks.csproj index c0a9c571a..8ef22e156 100644 --- a/src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks/Microsoft.Extensions.HealthChecks.csproj +++ b/src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks/Microsoft.Extensions.HealthChecks.csproj @@ -10,7 +10,7 @@ - + diff --git a/src/BuildingBlocks/Resilience/Resilience.Http/Resilience.Http.csproj b/src/BuildingBlocks/Resilience/Resilience.Http/Resilience.Http.csproj index e472bb7a5..1f094380c 100644 --- a/src/BuildingBlocks/Resilience/Resilience.Http/Resilience.Http.csproj +++ b/src/BuildingBlocks/Resilience/Resilience.Http/Resilience.Http.csproj @@ -7,8 +7,8 @@ - - + + \ No newline at end of file diff --git a/src/Services/Basket/Basket.API/Basket.API.csproj b/src/Services/Basket/Basket.API/Basket.API.csproj index d2e8d5173..13f2830db 100644 --- a/src/Services/Basket/Basket.API/Basket.API.csproj +++ b/src/Services/Basket/Basket.API/Basket.API.csproj @@ -2,7 +2,7 @@ netcoreapp2.0 - $(PackageTargetFallback);netstandard1.6.1;dnxcore50;portable-net451+win8 + $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; ..\..\..\..\docker-compose.dcproj @@ -19,16 +19,16 @@ - - - - - - - - - - + + + + + + + + + + diff --git a/src/Services/Catalog/Catalog.API/Catalog.API.csproj b/src/Services/Catalog/Catalog.API/Catalog.API.csproj index 5cd6691ab..31b600c02 100644 --- a/src/Services/Catalog/Catalog.API/Catalog.API.csproj +++ b/src/Services/Catalog/Catalog.API/Catalog.API.csproj @@ -7,7 +7,7 @@ Catalog.API Catalog.API aspnet-Catalog.API-20161122013618 - $(PackageTargetFallback);dotnet5.6;portable-net45+win8 + $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; ..\..\..\..\docker-compose.dcproj @@ -28,24 +28,24 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + diff --git a/src/Services/Catalog/Catalog.API/Startup.cs b/src/Services/Catalog/Catalog.API/Startup.cs index c5784b6a4..39ebf519d 100644 --- a/src/Services/Catalog/Catalog.API/Startup.cs +++ b/src/Services/Catalog/Catalog.API/Startup.cs @@ -7,6 +7,7 @@ using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.EntityFrameworkCore; + using Microsoft.EntityFrameworkCore.Diagnostics; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.eShopOnContainers.BuildingBlocks.EventBus; using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions; diff --git a/src/Services/GracePeriod/GracePeriodManager/GracePeriodManager.csproj b/src/Services/GracePeriod/GracePeriodManager/GracePeriodManager.csproj index f239692b7..c37a06663 100644 --- a/src/Services/GracePeriod/GracePeriodManager/GracePeriodManager.csproj +++ b/src/Services/GracePeriod/GracePeriodManager/GracePeriodManager.csproj @@ -8,15 +8,15 @@ - - - - - - - - - + + + + + + + + + diff --git a/src/Services/Identity/Identity.API/Identity.API.csproj b/src/Services/Identity/Identity.API/Identity.API.csproj index 4f175503c..373e47a33 100644 --- a/src/Services/Identity/Identity.API/Identity.API.csproj +++ b/src/Services/Identity/Identity.API/Identity.API.csproj @@ -4,7 +4,7 @@ netcoreapp1.1 1.1.2 aspnet-eShopOnContainers.Identity-90487118-103c-4ff0-b9da-e5e26f7ab0c5 - $(PackageTargetFallback);dotnet5.6;portable-net45+win8 + $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; ..\..\..\..\docker-compose.dcproj @@ -34,9 +34,6 @@ - - All - diff --git a/src/Services/Location/Locations.API/Locations.API.csproj b/src/Services/Location/Locations.API/Locations.API.csproj index 01cb58ec5..2ede0db1f 100644 --- a/src/Services/Location/Locations.API/Locations.API.csproj +++ b/src/Services/Location/Locations.API/Locations.API.csproj @@ -13,19 +13,19 @@ - - - - - - + + + + + + - - - - - - + + + + + + diff --git a/src/Services/Marketing/Marketing.API/Marketing.API.csproj b/src/Services/Marketing/Marketing.API/Marketing.API.csproj index b8af9107a..0e886a2ea 100644 --- a/src/Services/Marketing/Marketing.API/Marketing.API.csproj +++ b/src/Services/Marketing/Marketing.API/Marketing.API.csproj @@ -4,7 +4,7 @@ netcoreapp2.0 ..\..\..\..\docker-compose.dcproj Microsoft.eShopOnContainers.Services.Marketing.API - portable-net45+win8 + $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; aspnet-Marketing.API-20161122013619 @@ -19,28 +19,27 @@ - - - - - - - + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + diff --git a/src/Services/Marketing/Marketing.API/Startup.cs b/src/Services/Marketing/Marketing.API/Startup.cs index a31055d39..909ca1235 100644 --- a/src/Services/Marketing/Marketing.API/Startup.cs +++ b/src/Services/Marketing/Marketing.API/Startup.cs @@ -23,6 +23,7 @@ using Polly; using System.Threading.Tasks; using System.Data.SqlClient; + using Microsoft.EntityFrameworkCore.Diagnostics; public class Startup { diff --git a/src/Services/Ordering/Ordering.API/Ordering.API.csproj b/src/Services/Ordering/Ordering.API/Ordering.API.csproj index 80c3d9068..13cdad1a0 100644 --- a/src/Services/Ordering/Ordering.API/Ordering.API.csproj +++ b/src/Services/Ordering/Ordering.API/Ordering.API.csproj @@ -3,7 +3,7 @@ netcoreapp2.0 aspnet-Ordering.API-20161122013547 - $(PackageTargetFallback);netstandard1.6.1;dnxcore50;portable-net451+win8 + $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; ..\..\..\..\docker-compose.dcproj @@ -32,31 +32,31 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - + - + diff --git a/src/Services/Ordering/Ordering.Domain/Ordering.Domain.csproj b/src/Services/Ordering/Ordering.Domain/Ordering.Domain.csproj index 187dc56fc..2673abf84 100644 --- a/src/Services/Ordering/Ordering.Domain/Ordering.Domain.csproj +++ b/src/Services/Ordering/Ordering.Domain/Ordering.Domain.csproj @@ -5,7 +5,7 @@ Ordering.Domain 2.0.0-preview1-25301-01 Ordering.Domain - $(PackageTargetFallback);dnxcore50 + $(AssetTargetFallback);dnxcore50; false false false @@ -14,7 +14,7 @@ - + diff --git a/src/Services/Ordering/Ordering.Infrastructure/Ordering.Infrastructure.csproj b/src/Services/Ordering/Ordering.Infrastructure/Ordering.Infrastructure.csproj index ea8d8c29b..f37446084 100644 --- a/src/Services/Ordering/Ordering.Infrastructure/Ordering.Infrastructure.csproj +++ b/src/Services/Ordering/Ordering.Infrastructure/Ordering.Infrastructure.csproj @@ -1,11 +1,10 @@  - netstandard1.4 + netstandard2.0 Ordering.Infrastructure Ordering.Infrastructure - 2.0.0-preview1-25301-01 - $(PackageTargetFallback);dnxcore50 + $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; false false false @@ -16,9 +15,9 @@ - - - + + + diff --git a/src/Services/Payment/Payment.API/Payment.API.csproj b/src/Services/Payment/Payment.API/Payment.API.csproj index 1bbb9696b..6152a78fa 100644 --- a/src/Services/Payment/Payment.API/Payment.API.csproj +++ b/src/Services/Payment/Payment.API/Payment.API.csproj @@ -3,7 +3,7 @@ netcoreapp2.0 ..\..\..\..\docker-compose.dcproj - portable-net45+win8 + $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; @@ -12,14 +12,14 @@ - - - - - + + + + + - - + + diff --git a/src/Web/WebMVC/ViewModels/ApplicationUser.cs b/src/Web/WebMVC/ViewModels/ApplicationUser.cs index 0602a9c95..23016a6db 100644 --- a/src/Web/WebMVC/ViewModels/ApplicationUser.cs +++ b/src/Web/WebMVC/ViewModels/ApplicationUser.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using System.ComponentModel.DataAnnotations; -using Microsoft.AspNetCore.Identity.EntityFrameworkCore; +using Microsoft.AspNetCore.Identity; namespace Microsoft.eShopOnContainers.WebMVC.ViewModels { diff --git a/src/Web/WebMVC/WebMVC.csproj b/src/Web/WebMVC/WebMVC.csproj index b8a57a359..d7f1cabdb 100644 --- a/src/Web/WebMVC/WebMVC.csproj +++ b/src/Web/WebMVC/WebMVC.csproj @@ -3,7 +3,7 @@ netcoreapp2.0 aspnet-Microsoft.eShopOnContainers-946ae052-8305-4a99-965b-ec8636ddbae3 - $(PackageTargetFallback);dotnet5.6;portable-net45+win8 + $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; ..\..\..\docker-compose.dcproj @@ -16,29 +16,26 @@ --> - - - - - - - - - - - - - + + + + + + + + + + + + + - - All - - - - - + + + + diff --git a/src/Web/WebMonolithic/eShopWeb/eShopWeb.csproj b/src/Web/WebMonolithic/eShopWeb/eShopWeb.csproj index 749087ce4..cf53a938a 100644 --- a/src/Web/WebMonolithic/eShopWeb/eShopWeb.csproj +++ b/src/Web/WebMonolithic/eShopWeb/eShopWeb.csproj @@ -21,7 +21,6 @@ - diff --git a/src/Web/WebSPA/WebSPA.csproj b/src/Web/WebSPA/WebSPA.csproj index c598d700e..155d65d95 100644 --- a/src/Web/WebSPA/WebSPA.csproj +++ b/src/Web/WebSPA/WebSPA.csproj @@ -3,7 +3,7 @@ netcoreapp2.0 aspnetcorespa-c23d27a4-eb88-4b18-9b77-2a93f3b15119 - $(PackageTargetFallback);dotnet5.6;portable-net45+win8 + $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; ..\..\..\docker-compose.dcproj false true @@ -25,29 +25,26 @@ - - - - - - - + + + + + + + - - - - - - - - - - - All - - - + + + + + + + + + + + diff --git a/src/Web/WebStatus/WebStatus.csproj b/src/Web/WebStatus/WebStatus.csproj index 409c7362f..56c5766f5 100644 --- a/src/Web/WebStatus/WebStatus.csproj +++ b/src/Web/WebStatus/WebStatus.csproj @@ -1,15 +1,15 @@  netcoreapp2.0 - $(PackageTargetFallback);portable-net45+win8+wp8+wpa81; + $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; ..\..\..\docker-compose.dcproj - + - + diff --git a/test/Services/FunctionalTests/FunctionalTests.csproj b/test/Services/FunctionalTests/FunctionalTests.csproj index 1bf5db148..f9f58a318 100644 --- a/test/Services/FunctionalTests/FunctionalTests.csproj +++ b/test/Services/FunctionalTests/FunctionalTests.csproj @@ -3,7 +3,7 @@ netcoreapp2.0 true - $(PackageTargetFallback);netstandard1.6.1;dnxcore50;portable-net451+win8 + $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; false false false diff --git a/test/Services/IntegrationTests/IntegrationTests.csproj b/test/Services/IntegrationTests/IntegrationTests.csproj index 8578b7adf..d787b10fc 100644 --- a/test/Services/IntegrationTests/IntegrationTests.csproj +++ b/test/Services/IntegrationTests/IntegrationTests.csproj @@ -5,7 +5,7 @@ FunctionalTests FunctionalTests true - $(PackageTargetFallback);netstandard1.6.1;dnxcore50;portable-net451+win8 + $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; false false false diff --git a/test/Services/UnitTest/UnitTest.csproj b/test/Services/UnitTest/UnitTest.csproj index e5a1cb835..ec396c982 100644 --- a/test/Services/UnitTest/UnitTest.csproj +++ b/test/Services/UnitTest/UnitTest.csproj @@ -3,7 +3,7 @@ netcoreapp2.0 true - $(PackageTargetFallback);netstandard1.6.1;dnxcore50;portable-net451+win8 + $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; false false false From 62a14e1006555c398241b4f6e7dec8654c519b10 Mon Sep 17 00:00:00 2001 From: Eduard Tomas Date: Tue, 11 Jul 2017 10:12:32 +0200 Subject: [PATCH 23/64] Upgrade IntegrationEventLogEF to netcore2 --- .../IntegrationEventLogEF.csproj | 16 ++++++++-------- .../Services/IntegrationEventLogService.cs | 1 + 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/BuildingBlocks/EventBus/IntegrationEventLogEF/IntegrationEventLogEF.csproj b/src/BuildingBlocks/EventBus/IntegrationEventLogEF/IntegrationEventLogEF.csproj index 30225c299..e1e24b9fe 100644 --- a/src/BuildingBlocks/EventBus/IntegrationEventLogEF/IntegrationEventLogEF.csproj +++ b/src/BuildingBlocks/EventBus/IntegrationEventLogEF/IntegrationEventLogEF.csproj @@ -1,22 +1,22 @@  - netcoreapp1.1 + netcoreapp2.0 Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF - - - - - - + + + + + + - + diff --git a/src/BuildingBlocks/EventBus/IntegrationEventLogEF/Services/IntegrationEventLogService.cs b/src/BuildingBlocks/EventBus/IntegrationEventLogEF/Services/IntegrationEventLogService.cs index bef74b452..5ac8bb862 100644 --- a/src/BuildingBlocks/EventBus/IntegrationEventLogEF/Services/IntegrationEventLogService.cs +++ b/src/BuildingBlocks/EventBus/IntegrationEventLogEF/Services/IntegrationEventLogService.cs @@ -6,6 +6,7 @@ using System.Data.Common; using System.Linq; using System.Threading.Tasks; using System; +using Microsoft.EntityFrameworkCore.Diagnostics; namespace Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF.Services { From 2e64a97b4cddaa9e1d5ce2138c2a53f64a7e06f5 Mon Sep 17 00:00:00 2001 From: Eduard Tomas Date: Wed, 12 Jul 2017 17:28:04 +0200 Subject: [PATCH 24/64] Changes for retrieving all claims under netcore2 --- .../Identity/Identity.API/Configuration/Config.cs | 1 + src/Web/WebMVC/Controllers/AccountController.cs | 13 ++++++++----- src/Web/WebMVC/Startup.cs | 1 + 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/Services/Identity/Identity.API/Configuration/Config.cs b/src/Services/Identity/Identity.API/Configuration/Config.cs index bce62b039..a4f804db6 100644 --- a/src/Services/Identity/Identity.API/Configuration/Config.cs +++ b/src/Services/Identity/Identity.API/Configuration/Config.cs @@ -96,6 +96,7 @@ namespace Identity.API.Configuration AllowAccessTokensViaBrowser = false, RequireConsent = false, AllowOfflineAccess = true, + AlwaysIncludeUserClaimsInIdToken = true, RedirectUris = new List { $"{clientsUrl["Mvc"]}/signin-oidc" diff --git a/src/Web/WebMVC/Controllers/AccountController.cs b/src/Web/WebMVC/Controllers/AccountController.cs index c00a94c72..25c42e8d7 100644 --- a/src/Web/WebMVC/Controllers/AccountController.cs +++ b/src/Web/WebMVC/Controllers/AccountController.cs @@ -6,6 +6,8 @@ using Microsoft.eShopOnContainers.WebMVC.Services; using Microsoft.AspNetCore.Http.Authentication; using System.Threading.Tasks; using Microsoft.AspNetCore.Authentication; +using Microsoft.AspNetCore.Authentication.OpenIdConnect; +using Microsoft.AspNetCore.Authentication.Cookies; namespace Microsoft.eShopOnContainers.WebMVC.Controllers { @@ -35,15 +37,16 @@ namespace Microsoft.eShopOnContainers.WebMVC.Controllers return RedirectToAction(nameof(CatalogController.Index), "Catalog"); } - public IActionResult Signout() + public async Task Signout() { - HttpContext.Authentication.SignOutAsync("Cookies"); - HttpContext.Authentication.SignOutAsync("oidc"); - + await HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme); + await HttpContext.SignOutAsync(OpenIdConnectDefaults.AuthenticationScheme); + // "Catalog" because UrlHelper doesn't support nameof() for controllers // https://github.com/aspnet/Mvc/issues/5853 var homeUrl = Url.Action(nameof(CatalogController.Index), "Catalog"); - return new SignOutResult("oidc", new AspNetCore.Authentication.AuthenticationProperties { RedirectUri = homeUrl }); + return new SignOutResult(OpenIdConnectDefaults.AuthenticationScheme, + new AspNetCore.Authentication.AuthenticationProperties { RedirectUri = homeUrl }); } } } diff --git a/src/Web/WebMVC/Startup.cs b/src/Web/WebMVC/Startup.cs index 3349d9530..90bc98ac1 100644 --- a/src/Web/WebMVC/Startup.cs +++ b/src/Web/WebMVC/Startup.cs @@ -100,6 +100,7 @@ namespace Microsoft.eShopOnContainers.WebMVC options.Scope.Add("orders"); options.Scope.Add("basket"); options.Scope.Add("marketing"); + options.Scope.Add("locations"); }); services.AddAuthentication(options => { From 2f1f1cd61671db902b411064b64266832b1e0722 Mon Sep 17 00:00:00 2001 From: Eduard Tomas Date: Thu, 13 Jul 2017 12:34:19 +0200 Subject: [PATCH 25/64] Address as EF Value object --- .../Ordering.Infrastructure/OrderingContext.cs | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/Services/Ordering/Ordering.Infrastructure/OrderingContext.cs b/src/Services/Ordering/Ordering.Infrastructure/OrderingContext.cs index 0c69fe566..42110a7f7 100644 --- a/src/Services/Ordering/Ordering.Infrastructure/OrderingContext.cs +++ b/src/Services/Ordering/Ordering.Infrastructure/OrderingContext.cs @@ -45,7 +45,6 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure { modelBuilder.Entity(ConfigureRequests); - modelBuilder.Entity
(ConfigureAddress); modelBuilder.Entity(ConfigurePayment); modelBuilder.Entity(ConfigureOrder); modelBuilder.Entity(ConfigureOrderItems); @@ -62,19 +61,6 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure requestConfiguration.Property(cr => cr.Time).IsRequired(); } - void ConfigureAddress(EntityTypeBuilder
addressConfiguration) - { - addressConfiguration.ToTable("address", DEFAULT_SCHEMA); - - // DDD Pattern comment: Implementing the Address Id as "Shadow property" - // becuase the Address is a Value-Object (VO) and an Id (Identity) is not desired for a VO - // EF Core just needs the Id so it is capable to store it in a database table - // See: https://docs.microsoft.com/en-us/ef/core/modeling/shadow-properties - addressConfiguration.Property("Id") - .IsRequired(); - - addressConfiguration.HasKey("Id"); - } void ConfigureBuyer(EntityTypeBuilder buyerConfiguration) { @@ -152,6 +138,8 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure orderConfiguration.Property(o => o.Id) .ForSqlServerUseSequenceHiLo("orderseq", DEFAULT_SCHEMA); + orderConfiguration.OwnsOne(o => o.Address); + orderConfiguration.Property("OrderDate").IsRequired(); orderConfiguration.Property("BuyerId").IsRequired(false); orderConfiguration.Property("OrderStatusId").IsRequired(); From eeda5bcb9def94c67fec7961a1895b272d0ed77c Mon Sep 17 00:00:00 2001 From: Eduard Tomas Date: Thu, 13 Jul 2017 13:42:29 +0200 Subject: [PATCH 26/64] Order.Address is a value object. It has no table and no ID --- .../Application/Queries/OrderQueries.cs | 8 +- ...0713111342_AdressAsValueObject.Designer.cs | 251 ++++++++++++++++++ .../20170713111342_AdressAsValueObject.cs | 146 ++++++++++ .../OrderingContextModelSnapshot.cs | 75 +++--- .../OrderingDbContextDesigner.cs | 29 ++ src/Services/Ordering/Ordering.API/Startup.cs | 16 +- .../OrderingContext.cs | 7 + 7 files changed, 485 insertions(+), 47 deletions(-) create mode 100644 src/Services/Ordering/Ordering.API/Infrastructure/Migrations/20170713111342_AdressAsValueObject.Designer.cs create mode 100644 src/Services/Ordering/Ordering.API/Infrastructure/Migrations/20170713111342_AdressAsValueObject.cs create mode 100644 src/Services/Ordering/Ordering.API/Infrastructure/OrderingDbContextDesigner.cs diff --git a/src/Services/Ordering/Ordering.API/Application/Queries/OrderQueries.cs b/src/Services/Ordering/Ordering.API/Application/Queries/OrderQueries.cs index 15036e154..a57c61334 100644 --- a/src/Services/Ordering/Ordering.API/Application/Queries/OrderQueries.cs +++ b/src/Services/Ordering/Ordering.API/Application/Queries/OrderQueries.cs @@ -26,11 +26,11 @@ connection.Open(); var result = await connection.QueryAsync( - @"select o.[Id] as ordernumber,o.OrderDate as date, o.Description as description, os.Name as status, - oi.ProductName as productname, oi.Units as units, oi.UnitPrice as unitprice, oi.PictureUrl as pictureurl, - a.Street as street, a.City as city, a.Country as country, a.State as state, a.ZipCode as zipcode + @"select o.[Id] as ordernumber,o.OrderDate as date, o.Description as description, + o.Address_City as city, o.Address_Country as country, o.Address_State as state, o.Address_Street as street, o.Address_ZipCode as zipcode, + os.Name as status, + oi.ProductName as productname, oi.Units as units, oi.UnitPrice as unitprice, oi.PictureUrl as pictureurl FROM ordering.Orders o - INNER JOIN ordering.Address a ON o.AddressId = a.Id LEFT JOIN ordering.Orderitems oi ON o.Id = oi.orderid LEFT JOIN ordering.orderstatus os on o.OrderStatusId = os.Id WHERE o.Id=@id" diff --git a/src/Services/Ordering/Ordering.API/Infrastructure/Migrations/20170713111342_AdressAsValueObject.Designer.cs b/src/Services/Ordering/Ordering.API/Infrastructure/Migrations/20170713111342_AdressAsValueObject.Designer.cs new file mode 100644 index 000000000..6e66bc9b4 --- /dev/null +++ b/src/Services/Ordering/Ordering.API/Infrastructure/Migrations/20170713111342_AdressAsValueObject.Designer.cs @@ -0,0 +1,251 @@ +// +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage; +using Microsoft.EntityFrameworkCore.Storage.Internal; +using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure; +using System; + +namespace Ordering.API.Migrations +{ + [DbContext(typeof(OrderingContext))] + [Migration("20170713111342_AdressAsValueObject")] + partial class AdressAsValueObject + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "2.0.0-preview2-25794") + .HasAnnotation("Relational:Sequence:.orderitemseq", "'orderitemseq', '', '1', '10', '', '', 'Int64', 'False'") + .HasAnnotation("Relational:Sequence:ordering.buyerseq", "'buyerseq', 'ordering', '1', '10', '', '', 'Int64', 'False'") + .HasAnnotation("Relational:Sequence:ordering.orderseq", "'orderseq', 'ordering', '1', '10', '', '', 'Int64', 'False'") + .HasAnnotation("Relational:Sequence:ordering.paymentseq", "'paymentseq', 'ordering', '1', '10', '', '', 'Int64', 'False'") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate.Buyer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasAnnotation("SqlServer:HiLoSequenceName", "buyerseq") + .HasAnnotation("SqlServer:HiLoSequenceSchema", "ordering") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo); + + b.Property("IdentityGuid") + .IsRequired() + .HasMaxLength(200); + + b.HasKey("Id"); + + b.HasIndex("IdentityGuid") + .IsUnique(); + + b.ToTable("buyers","ordering"); + }); + + modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate.CardType", b => + { + b.Property("Id") + .HasDefaultValue(1); + + b.Property("Name") + .IsRequired() + .HasMaxLength(200); + + b.HasKey("Id"); + + b.ToTable("cardtypes","ordering"); + }); + + modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate.PaymentMethod", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasAnnotation("SqlServer:HiLoSequenceName", "paymentseq") + .HasAnnotation("SqlServer:HiLoSequenceSchema", "ordering") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo); + + b.Property("Alias") + .IsRequired() + .HasMaxLength(200); + + b.Property("BuyerId"); + + b.Property("CardHolderName") + .IsRequired() + .HasMaxLength(200); + + b.Property("CardNumber") + .IsRequired() + .HasMaxLength(25); + + b.Property("CardTypeId"); + + b.Property("Expiration"); + + b.HasKey("Id"); + + b.HasIndex("BuyerId"); + + b.HasIndex("CardTypeId"); + + b.ToTable("paymentmethods","ordering"); + }); + + modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate.Order", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasAnnotation("SqlServer:HiLoSequenceName", "orderseq") + .HasAnnotation("SqlServer:HiLoSequenceSchema", "ordering") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo); + + b.Property("BuyerId"); + + b.Property("Description"); + + b.Property("OrderDate"); + + b.Property("OrderStatusId"); + + b.Property("PaymentMethodId"); + + b.HasKey("Id"); + + b.HasIndex("BuyerId"); + + b.HasIndex("OrderStatusId"); + + b.HasIndex("PaymentMethodId"); + + b.ToTable("orders","ordering"); + }); + + modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate.OrderItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasAnnotation("SqlServer:HiLoSequenceName", "orderitemseq") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo); + + b.Property("Discount"); + + b.Property("OrderId"); + + b.Property("PictureUrl"); + + b.Property("ProductId"); + + b.Property("ProductName") + .IsRequired(); + + b.Property("UnitPrice"); + + b.Property("Units"); + + b.HasKey("Id"); + + b.HasIndex("OrderId"); + + b.ToTable("orderItems","ordering"); + }); + + modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate.OrderStatus", b => + { + b.Property("Id") + .HasDefaultValue(1); + + b.Property("Name") + .IsRequired() + .HasMaxLength(200); + + b.HasKey("Id"); + + b.ToTable("orderstatus","ordering"); + }); + + modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Idempotency.ClientRequest", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Name") + .IsRequired(); + + b.Property("Time"); + + b.HasKey("Id"); + + b.ToTable("requests","ordering"); + }); + + modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate.Address", b => + { + b.Property("OrderId"); + + b.Property("City"); + + b.Property("Country"); + + b.Property("State"); + + b.Property("Street"); + + b.Property("ZipCode"); + + b.HasKey("OrderId"); + + b.ToTable("orders","ordering"); + }); + + modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate.PaymentMethod", b => + { + b.HasOne("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate.Buyer") + .WithMany("PaymentMethods") + .HasForeignKey("BuyerId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate.CardType", "CardType") + .WithMany() + .HasForeignKey("CardTypeId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate.Order", b => + { + b.HasOne("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate.Buyer") + .WithMany() + .HasForeignKey("BuyerId"); + + b.HasOne("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate.OrderStatus", "OrderStatus") + .WithMany() + .HasForeignKey("OrderStatusId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate.PaymentMethod") + .WithMany() + .HasForeignKey("PaymentMethodId") + .OnDelete(DeleteBehavior.Restrict); + }); + + modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate.OrderItem", b => + { + b.HasOne("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate.Order") + .WithMany("OrderItems") + .HasForeignKey("OrderId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate.Address", b => + { + b.HasOne("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate.Order") + .WithOne("Address") + .HasForeignKey("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate.Address", "OrderId") + .OnDelete(DeleteBehavior.Cascade); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/Services/Ordering/Ordering.API/Infrastructure/Migrations/20170713111342_AdressAsValueObject.cs b/src/Services/Ordering/Ordering.API/Infrastructure/Migrations/20170713111342_AdressAsValueObject.cs new file mode 100644 index 000000000..9f5d28d99 --- /dev/null +++ b/src/Services/Ordering/Ordering.API/Infrastructure/Migrations/20170713111342_AdressAsValueObject.cs @@ -0,0 +1,146 @@ +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using System; +using System.Collections.Generic; + +namespace Ordering.API.Migrations +{ + public partial class AdressAsValueObject : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_orders_address_AddressId", + schema: "ordering", + table: "orders"); + + migrationBuilder.DropForeignKey( + name: "FK_orders_paymentmethods_PaymentMethodId", + schema: "ordering", + table: "orders"); + + migrationBuilder.DropTable( + name: "address", + schema: "ordering"); + + migrationBuilder.DropIndex( + name: "IX_orders_AddressId", + schema: "ordering", + table: "orders"); + + migrationBuilder.DropColumn( + name: "AddressId", + schema: "ordering", + table: "orders"); + + migrationBuilder.AddColumn( + name: "Address_City", + schema: "ordering", + table: "orders", + type: "nvarchar(max)", + nullable: true); + + migrationBuilder.AddColumn( + name: "Address_Country", + schema: "ordering", + table: "orders", + type: "nvarchar(max)", + nullable: true); + + migrationBuilder.AddColumn( + name: "Address_State", + schema: "ordering", + table: "orders", + type: "nvarchar(max)", + nullable: true); + + migrationBuilder.AddColumn( + name: "Address_Street", + schema: "ordering", + table: "orders", + type: "nvarchar(max)", + nullable: true); + + migrationBuilder.AddColumn( + name: "Address_ZipCode", + schema: "ordering", + table: "orders", + type: "nvarchar(max)", + nullable: true); + + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_orders_paymentmethods_PaymentMethodId", + schema: "ordering", + table: "orders"); + + migrationBuilder.DropColumn( + name: "Address_City", + schema: "ordering", + table: "orders"); + + migrationBuilder.DropColumn( + name: "Address_Country", + schema: "ordering", + table: "orders"); + + migrationBuilder.DropColumn( + name: "Address_State", + schema: "ordering", + table: "orders"); + + migrationBuilder.DropColumn( + name: "Address_Street", + schema: "ordering", + table: "orders"); + + migrationBuilder.DropColumn( + name: "Address_ZipCode", + schema: "ordering", + table: "orders"); + + migrationBuilder.AddColumn( + name: "AddressId", + schema: "ordering", + table: "orders", + nullable: true); + + migrationBuilder.CreateTable( + name: "address", + schema: "ordering", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), + City = table.Column(nullable: true), + Country = table.Column(nullable: true), + State = table.Column(nullable: true), + Street = table.Column(nullable: true), + ZipCode = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_address", x => x.Id); + }); + + migrationBuilder.CreateIndex( + name: "IX_orders_AddressId", + schema: "ordering", + table: "orders", + column: "AddressId"); + + migrationBuilder.AddForeignKey( + name: "FK_orders_address_AddressId", + schema: "ordering", + table: "orders", + column: "AddressId", + principalSchema: "ordering", + principalTable: "address", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + } + } +} diff --git a/src/Services/Ordering/Ordering.API/Infrastructure/Migrations/OrderingContextModelSnapshot.cs b/src/Services/Ordering/Ordering.API/Infrastructure/Migrations/OrderingContextModelSnapshot.cs index fa342cf31..9e455568d 100644 --- a/src/Services/Ordering/Ordering.API/Infrastructure/Migrations/OrderingContextModelSnapshot.cs +++ b/src/Services/Ordering/Ordering.API/Infrastructure/Migrations/OrderingContextModelSnapshot.cs @@ -1,9 +1,12 @@ -using System; +// using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage; +using Microsoft.EntityFrameworkCore.Storage.Internal; using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure; +using System; namespace Ordering.API.Migrations { @@ -12,12 +15,13 @@ namespace Ordering.API.Migrations { protected override void BuildModel(ModelBuilder modelBuilder) { +#pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "1.1.1") - .HasAnnotation("SqlServer:Sequence:.orderitemseq", "'orderitemseq', '', '1', '10', '', '', 'Int64', 'False'") - .HasAnnotation("SqlServer:Sequence:ordering.buyerseq", "'buyerseq', 'ordering', '1', '10', '', '', 'Int64', 'False'") - .HasAnnotation("SqlServer:Sequence:ordering.orderseq", "'orderseq', 'ordering', '1', '10', '', '', 'Int64', 'False'") - .HasAnnotation("SqlServer:Sequence:ordering.paymentseq", "'paymentseq', 'ordering', '1', '10', '', '', 'Int64', 'False'") + .HasAnnotation("ProductVersion", "2.0.0-preview2-25794") + .HasAnnotation("Relational:Sequence:.orderitemseq", "'orderitemseq', '', '1', '10', '', '', 'Int64', 'False'") + .HasAnnotation("Relational:Sequence:ordering.buyerseq", "'buyerseq', 'ordering', '1', '10', '', '', 'Int64', 'False'") + .HasAnnotation("Relational:Sequence:ordering.orderseq", "'orderseq', 'ordering', '1', '10', '', '', 'Int64', 'False'") + .HasAnnotation("Relational:Sequence:ordering.paymentseq", "'paymentseq', 'ordering', '1', '10', '', '', 'Int64', 'False'") .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate.Buyer", b => @@ -89,26 +93,6 @@ namespace Ordering.API.Migrations b.ToTable("paymentmethods","ordering"); }); - modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate.Address", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("City"); - - b.Property("Country"); - - b.Property("State"); - - b.Property("Street"); - - b.Property("ZipCode"); - - b.HasKey("Id"); - - b.ToTable("address","ordering"); - }); - modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate.Order", b => { b.Property("Id") @@ -117,8 +101,6 @@ namespace Ordering.API.Migrations .HasAnnotation("SqlServer:HiLoSequenceSchema", "ordering") .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo); - b.Property("AddressId"); - b.Property("BuyerId"); b.Property("Description"); @@ -131,8 +113,6 @@ namespace Ordering.API.Migrations b.HasKey("Id"); - b.HasIndex("AddressId"); - b.HasIndex("BuyerId"); b.HasIndex("OrderStatusId"); @@ -200,6 +180,25 @@ namespace Ordering.API.Migrations b.ToTable("requests","ordering"); }); + modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate.Address", b => + { + b.Property("OrderId"); + + b.Property("City"); + + b.Property("Country"); + + b.Property("State"); + + b.Property("Street"); + + b.Property("ZipCode"); + + b.HasKey("OrderId"); + + b.ToTable("orders","ordering"); + }); + modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate.PaymentMethod", b => { b.HasOne("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate.Buyer") @@ -215,10 +214,6 @@ namespace Ordering.API.Migrations modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate.Order", b => { - b.HasOne("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate.Address", "Address") - .WithMany() - .HasForeignKey("AddressId"); - b.HasOne("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate.Buyer") .WithMany() .HasForeignKey("BuyerId"); @@ -230,7 +225,8 @@ namespace Ordering.API.Migrations b.HasOne("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate.PaymentMethod") .WithMany() - .HasForeignKey("PaymentMethodId"); + .HasForeignKey("PaymentMethodId") + .OnDelete(DeleteBehavior.Restrict); }); modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate.OrderItem", b => @@ -240,6 +236,15 @@ namespace Ordering.API.Migrations .HasForeignKey("OrderId") .OnDelete(DeleteBehavior.Cascade); }); + + modelBuilder.Entity("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate.Address", b => + { + b.HasOne("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate.Order") + .WithOne("Address") + .HasForeignKey("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate.Address", "OrderId") + .OnDelete(DeleteBehavior.Cascade); + }); +#pragma warning restore 612, 618 } } } diff --git a/src/Services/Ordering/Ordering.API/Infrastructure/OrderingDbContextDesigner.cs b/src/Services/Ordering/Ordering.API/Infrastructure/OrderingDbContextDesigner.cs new file mode 100644 index 000000000..5d14c55e6 --- /dev/null +++ b/src/Services/Ordering/Ordering.API/Infrastructure/OrderingDbContextDesigner.cs @@ -0,0 +1,29 @@ +using MediatR; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Design; +using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure; +using Microsoft.Extensions.Configuration; +using System; +using System.Collections.Generic; +using System.Reflection; +using System.Text; + +namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure +{ + public class OrderingDbContextDesigner : IDesignTimeDbContextFactory + { + + + public OrderingContext CreateDbContext(string[] args) + { + var options = new DbContextOptionsBuilder(); + options.UseSqlServer("Server=tcp:127.0.0.1,5433;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word;", + sqlServerOptionsAction: sqlOptions => + { + sqlOptions.MigrationsAssembly(typeof(Startup).GetTypeInfo().Assembly.GetName().Name); + }); + return OrderingContext.CreateForEFDesignTools(options.Options); + } + + } +} diff --git a/src/Services/Ordering/Ordering.API/Startup.cs b/src/Services/Ordering/Ordering.API/Startup.cs index 15a966c1a..33fcc0052 100644 --- a/src/Services/Ordering/Ordering.API/Startup.cs +++ b/src/Services/Ordering/Ordering.API/Startup.cs @@ -13,6 +13,7 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.Azure.ServiceBus; using Microsoft.EntityFrameworkCore; + using Microsoft.EntityFrameworkCore.Design; using Microsoft.eShopOnContainers.BuildingBlocks.EventBus; using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions; using Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ; @@ -58,11 +59,10 @@ // Add framework services. services.AddMvc(options => { - options.Filters.Add(typeof(HttpGlobalExceptionFilter)); + options.Filters.Add(typeof(HttpGlobalExceptionFilter)); }).AddControllersAsServices(); //Injecting Controllers themselves thru DI //For further info see: http://docs.autofac.org/en/latest/integration/aspnetcore.html#controllers-as-services - services.AddHealthChecks(checks => { var minutes = 1; @@ -72,7 +72,7 @@ } checks.AddSqlCheck("OrderingDb", Configuration["ConnectionString"], TimeSpan.FromMinutes(minutes)); }); - + services.AddEntityFrameworkSqlServer() .AddDbContext(options => { @@ -81,8 +81,8 @@ { sqlOptions.MigrationsAssembly(typeof(Startup).GetTypeInfo().Assembly.GetName().Name); sqlOptions.EnableRetryOnFailure(maxRetryCount: 5, maxRetryDelay: TimeSpan.FromSeconds(30), errorNumbersToAdd: null); - }); - }, + }); + }, ServiceLifetime.Scoped //Showing explicitly that the DbContext is shared across the HTTP request scope (graph of objects started in the HTTP request) ); @@ -113,8 +113,8 @@ services.AddSingleton(); services.AddTransient(); services.AddTransient>( - sp => (DbConnection c) => new IntegrationEventLogService(c)); - + sp => (DbConnection c) => new IntegrationEventLogService(c)); + services.AddTransient(); if (Configuration.GetValue("AzureServiceBusEnabled")) @@ -164,7 +164,7 @@ { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); - + app.UseCors("CorsPolicy"); ConfigureAuth(app); diff --git a/src/Services/Ordering/Ordering.Infrastructure/OrderingContext.cs b/src/Services/Ordering/Ordering.Infrastructure/OrderingContext.cs index 42110a7f7..85e2cb0f9 100644 --- a/src/Services/Ordering/Ordering.Infrastructure/OrderingContext.cs +++ b/src/Services/Ordering/Ordering.Infrastructure/OrderingContext.cs @@ -33,6 +33,13 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure private readonly IMediator _mediator; + + public static OrderingContext CreateForEFDesignTools(DbContextOptions options) + { + return new OrderingContext(options); + } + + private OrderingContext(DbContextOptions options) : base (options) { } public OrderingContext(DbContextOptions options, IMediator mediator) : base(options) { _mediator = mediator ?? throw new ArgumentNullException(nameof(mediator)); From 26a4701bf4545d1b4d47349e0737b7f0385f7559 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ram=C3=B3n=20Tom=C3=A1s?= Date: Tue, 22 Aug 2017 19:47:22 +0200 Subject: [PATCH 27/64] Fix Account Controller unittest --- test/Services/UnitTest/Account/AccountControllerTest.cs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/test/Services/UnitTest/Account/AccountControllerTest.cs b/test/Services/UnitTest/Account/AccountControllerTest.cs index 0fa4402d3..3a92ed4d4 100644 --- a/test/Services/UnitTest/Account/AccountControllerTest.cs +++ b/test/Services/UnitTest/Account/AccountControllerTest.cs @@ -1,16 +1,9 @@ -using Microsoft.AspNetCore.Authentication; -using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http.Authentication; using Microsoft.AspNetCore.Mvc; using Microsoft.eShopOnContainers.WebMVC.Controllers; -using Microsoft.eShopOnContainers.WebMVC.Services; -using Microsoft.eShopOnContainers.WebMVC.ViewModels; using Moq; -using System; -using System.Collections.Generic; using System.Security.Claims; -using System.Text; -using System.Threading.Tasks; using Xunit; namespace UnitTest.Account From 8288acf3a4a1d0adef917cb416b8ab42188a97e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ram=C3=B3n=20Tom=C3=A1s?= Date: Tue, 22 Aug 2017 22:36:23 +0200 Subject: [PATCH 28/64] Update projects from netcore 2.0.0 preview to 2.0.0 Fix netcore 2.0.0 breaking changes in authentication middleware --- .../Basket/Basket.API/Basket.API.csproj | 20 ++++----- .../Catalog/Catalog.API/Catalog.API.csproj | 36 ++++++++-------- .../GracePeriodManager.csproj | 18 ++++---- .../Locations.API/Locations.API.csproj | 25 +++++------ .../Marketing.API/Marketing.API.csproj | 40 +++++++++--------- .../Ordering/Ordering.API/Ordering.API.csproj | 34 +++++++-------- .../Ordering.Infrastructure.csproj | 6 +-- .../Payment/Payment.API/Payment.API.csproj | 14 +++---- src/Web/WebMVC/Startup.cs | 42 ++++++++++--------- src/Web/WebMVC/WebMVC.csproj | 35 ++++++++-------- src/Web/WebSPA/WebSPA.csproj | 36 ++++++++-------- src/Web/WebStatus/WebStatus.csproj | 5 +-- 12 files changed, 157 insertions(+), 154 deletions(-) diff --git a/src/Services/Basket/Basket.API/Basket.API.csproj b/src/Services/Basket/Basket.API/Basket.API.csproj index 57a807d3a..584838c8f 100644 --- a/src/Services/Basket/Basket.API/Basket.API.csproj +++ b/src/Services/Basket/Basket.API/Basket.API.csproj @@ -20,16 +20,16 @@ - - - - - - - - - - + + + + + + + + + + diff --git a/src/Services/Catalog/Catalog.API/Catalog.API.csproj b/src/Services/Catalog/Catalog.API/Catalog.API.csproj index 62816baf3..4c1edfa22 100644 --- a/src/Services/Catalog/Catalog.API/Catalog.API.csproj +++ b/src/Services/Catalog/Catalog.API/Catalog.API.csproj @@ -33,24 +33,24 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + diff --git a/src/Services/GracePeriod/GracePeriodManager/GracePeriodManager.csproj b/src/Services/GracePeriod/GracePeriodManager/GracePeriodManager.csproj index 567b61662..c376e88f6 100644 --- a/src/Services/GracePeriod/GracePeriodManager/GracePeriodManager.csproj +++ b/src/Services/GracePeriod/GracePeriodManager/GracePeriodManager.csproj @@ -8,15 +8,15 @@ - - - - - - - - - + + + + + + + + + diff --git a/src/Services/Location/Locations.API/Locations.API.csproj b/src/Services/Location/Locations.API/Locations.API.csproj index ca1f68f2a..3a53ee826 100644 --- a/src/Services/Location/Locations.API/Locations.API.csproj +++ b/src/Services/Location/Locations.API/Locations.API.csproj @@ -13,24 +13,25 @@ - - - - - - + + + + + + - - - - - - + + + + + + + diff --git a/src/Services/Marketing/Marketing.API/Marketing.API.csproj b/src/Services/Marketing/Marketing.API/Marketing.API.csproj index 703f82bc6..71adef034 100644 --- a/src/Services/Marketing/Marketing.API/Marketing.API.csproj +++ b/src/Services/Marketing/Marketing.API/Marketing.API.csproj @@ -19,27 +19,27 @@ - - - - - - - + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + diff --git a/src/Services/Ordering/Ordering.API/Ordering.API.csproj b/src/Services/Ordering/Ordering.API/Ordering.API.csproj index 3f6ce21d4..047579f6d 100644 --- a/src/Services/Ordering/Ordering.API/Ordering.API.csproj +++ b/src/Services/Ordering/Ordering.API/Ordering.API.csproj @@ -36,24 +36,24 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - + diff --git a/src/Services/Ordering/Ordering.Infrastructure/Ordering.Infrastructure.csproj b/src/Services/Ordering/Ordering.Infrastructure/Ordering.Infrastructure.csproj index f37446084..fdd0bfa53 100644 --- a/src/Services/Ordering/Ordering.Infrastructure/Ordering.Infrastructure.csproj +++ b/src/Services/Ordering/Ordering.Infrastructure/Ordering.Infrastructure.csproj @@ -15,9 +15,9 @@ - - - + + + diff --git a/src/Services/Payment/Payment.API/Payment.API.csproj b/src/Services/Payment/Payment.API/Payment.API.csproj index 9b1442c8e..46f2d81b9 100644 --- a/src/Services/Payment/Payment.API/Payment.API.csproj +++ b/src/Services/Payment/Payment.API/Payment.API.csproj @@ -12,14 +12,14 @@ - - - - - + + + + + - - + + diff --git a/src/Web/WebMVC/Startup.cs b/src/Web/WebMVC/Startup.cs index 0a9bd99e2..315be8973 100644 --- a/src/Web/WebMVC/Startup.cs +++ b/src/Web/WebMVC/Startup.cs @@ -83,26 +83,28 @@ namespace Microsoft.eShopOnContainers.WebMVC var useLoadTest = Configuration.GetValue("UseLoadTest"); var identityUrl = Configuration.GetValue("IdentityUrl"); var callBackUrl = Configuration.GetValue("CallBackUrl"); - // Add Authentication services - services.AddCookieAuthentication(CookieAuthenticationDefaults.AuthenticationScheme); - services.AddOpenIdConnectAuthentication(OpenIdConnectDefaults.AuthenticationScheme, options => - { - options.SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme; - options.Authority = identityUrl.ToString(); - options.PostLogoutRedirectUri = callBackUrl.ToString(); - options.ClientId = useLoadTest ? "mvctest" : "mvc"; - options.ClientSecret = "secret"; - options.ResponseType = useLoadTest ? "code id_token token" : "code id_token"; - options.SaveTokens = true; - options.GetClaimsFromUserInfoEndpoint = true; - options.RequireHttpsMetadata = false; - options.Scope.Add("openid"); - options.Scope.Add("profile"); - options.Scope.Add("orders"); - options.Scope.Add("basket"); - options.Scope.Add("marketing"); - options.Scope.Add("locations"); - }); + + // Add Authentication services + + services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme) + .AddCookie(CookieAuthenticationDefaults.AuthenticationScheme) + .AddOpenIdConnect(options => { + options.SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme; + options.Authority = identityUrl.ToString(); + options.SignedOutRedirectUri = callBackUrl.ToString(); + options.ClientId = useLoadTest ? "mvctest" : "mvc"; + options.ClientSecret = "secret"; + options.ResponseType = useLoadTest ? "code id_token token" : "code id_token"; + options.SaveTokens = true; + options.GetClaimsFromUserInfoEndpoint = true; + options.RequireHttpsMetadata = false; + options.Scope.Add("openid"); + options.Scope.Add("profile"); + options.Scope.Add("orders"); + options.Scope.Add("basket"); + options.Scope.Add("marketing"); + options.Scope.Add("locations"); + }); services.AddAuthentication(options => { options.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme; diff --git a/src/Web/WebMVC/WebMVC.csproj b/src/Web/WebMVC/WebMVC.csproj index ddd35c889..e6e11cb99 100644 --- a/src/Web/WebMVC/WebMVC.csproj +++ b/src/Web/WebMVC/WebMVC.csproj @@ -36,26 +36,27 @@ --> - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - + + + + diff --git a/src/Web/WebSPA/WebSPA.csproj b/src/Web/WebSPA/WebSPA.csproj index ca26a394b..1e3b2630a 100644 --- a/src/Web/WebSPA/WebSPA.csproj +++ b/src/Web/WebSPA/WebSPA.csproj @@ -28,26 +28,26 @@ - - - - - - - + + + + + + + - - - - - - - - - - - + + + + + + + + + + + diff --git a/src/Web/WebStatus/WebStatus.csproj b/src/Web/WebStatus/WebStatus.csproj index 56c5766f5..7939b146a 100644 --- a/src/Web/WebStatus/WebStatus.csproj +++ b/src/Web/WebStatus/WebStatus.csproj @@ -5,11 +5,10 @@ ..\..\..\docker-compose.dcproj - - + - + From 58f3b5b274ec76cad93a5b7f3912cbf2cf9ca3c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ram=C3=B3n=20Tom=C3=A1s?= Date: Wed, 23 Aug 2017 00:10:28 +0200 Subject: [PATCH 29/64] Removed GracePeriod microservice and added as a HostService --- docker-compose-windows.override.yml | 8 -- docker-compose-windows.prod.yml | 7 - docker-compose-windows.yml | 9 -- docker-compose.override.yml | 8 -- docker-compose.prod.yml | 8 -- docker-compose.yml | 9 -- eShopOnContainers-ServicesAndWebApps.sln | 56 +------- .../GracePeriodManager/.dockerignore | 3 - .../GracePeriod/GracePeriodManager/Dockerfile | 5 - .../GracePeriodManager/Dockerfile.nanowin | 8 -- .../GracePeriodManager.csproj | 36 ----- .../GracePeriodConfirmedIntegrationEvent.cs | 11 -- .../GracePeriod/GracePeriodManager/Program.cs | 130 ------------------ .../Services/IManagerService.cs | 7 - .../GracePeriodManager/appsettings.json | 15 -- .../GracePeriodManagerService.cs} | 55 ++++++-- .../GracePeriodManagerSettings.cs} | 7 +- .../HostedServices/HostedService.cs | 48 +++++++ src/Services/Ordering/Ordering.API/Startup.cs | 14 +- .../Ordering.API/graceperiodsettings.json | 6 + 20 files changed, 113 insertions(+), 337 deletions(-) delete mode 100644 src/Services/GracePeriod/GracePeriodManager/.dockerignore delete mode 100644 src/Services/GracePeriod/GracePeriodManager/Dockerfile delete mode 100644 src/Services/GracePeriod/GracePeriodManager/Dockerfile.nanowin delete mode 100644 src/Services/GracePeriod/GracePeriodManager/GracePeriodManager.csproj delete mode 100644 src/Services/GracePeriod/GracePeriodManager/IntegrationEvents/Events/GracePeriodConfirmedIntegrationEvent.cs delete mode 100644 src/Services/GracePeriod/GracePeriodManager/Program.cs delete mode 100644 src/Services/GracePeriod/GracePeriodManager/Services/IManagerService.cs delete mode 100644 src/Services/GracePeriod/GracePeriodManager/appsettings.json rename src/Services/{GracePeriod/GracePeriodManager/Services/ManagerService.cs => Ordering/Ordering.API/Infrastructure/HostedServices/GracePeriodManagerService.cs} (52%) rename src/Services/{GracePeriod/GracePeriodManager/ManagerSettings.cs => Ordering/Ordering.API/Infrastructure/HostedServices/GracePeriodManagerSettings.cs} (68%) create mode 100644 src/Services/Ordering/Ordering.API/Infrastructure/HostedServices/HostedService.cs create mode 100644 src/Services/Ordering/Ordering.API/graceperiodsettings.json diff --git a/docker-compose-windows.override.yml b/docker-compose-windows.override.yml index 4237d9c96..6c791b1a6 100644 --- a/docker-compose-windows.override.yml +++ b/docker-compose-windows.override.yml @@ -137,14 +137,6 @@ services: - AzureStorageEnabled=False ports: - "5110:80" - - graceperiodmanager: - environment: - - ASPNETCORE_ENVIRONMENT=Development - - ASPNETCORE_URLS=http://0.0.0.0:80 - - ConnectionString=${ESHOP_AZURE_ORDERING_DB:-Server=sql.data;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word} - - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} - - AzureServiceBusEnabled=False webstatus: environment: diff --git a/docker-compose-windows.prod.yml b/docker-compose-windows.prod.yml index 5dc00aa9a..d5ea2d1bc 100644 --- a/docker-compose-windows.prod.yml +++ b/docker-compose-windows.prod.yml @@ -118,13 +118,6 @@ services: - AzureStorageEnabled=False ports: - "5110:80" - - graceperiodmanager: - environment: - - ASPNETCORE_ENVIRONMENT=Production - - ASPNETCORE_URLS=http://0.0.0.0:80 - - ConnectionString=${ESHOP_AZURE_ORDERING_DB:-Server=sql.data;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word} - - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} sql.data: environment: diff --git a/docker-compose-windows.yml b/docker-compose-windows.yml index 6296f5ca7..190b823b6 100644 --- a/docker-compose-windows.yml +++ b/docker-compose-windows.yml @@ -106,15 +106,6 @@ services: ports: - "5672:5672" - graceperiodmanager: - image: eshop/graceperiodmanager:${TAG:-latest} - build: - context: ./src/Services/GracePeriod/GracePeriodManager - dockerfile: Dockerfile.nanowin - depends_on: - - sql.data - - rabbitmq - payment.api: image: eshop/payment.api:${TAG:-latest} build: diff --git a/docker-compose.override.yml b/docker-compose.override.yml index 1a0129ac3..c8375040d 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -82,14 +82,6 @@ services: - AzureStorageEnabled=False ports: - "5110:80" - - graceperiodmanager: - environment: - - ASPNETCORE_ENVIRONMENT=Development - - ASPNETCORE_URLS=http://0.0.0.0:80 - - ConnectionString=${ESHOP_AZURE_ORDERING_DB:-Server=sql.data;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word} - - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} - - AzureServiceBusEnabled=False webspa: environment: diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index cb53a1d00..f768b5872 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -88,14 +88,6 @@ services: ports: - "5110:80" - graceperiodmanager: - environment: - - ASPNETCORE_ENVIRONMENT=Production - - ASPNETCORE_URLS=http://0.0.0.0:80 - - ConnectionString=${ESHOP_AZURE_ORDERING_DB:-Server=sql.data;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word} - - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} - - AzureServiceBusEnabled=False - webspa: environment: - ASPNETCORE_ENVIRONMENT=Production diff --git a/docker-compose.yml b/docker-compose.yml index 253674b57..991a7b28b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -49,15 +49,6 @@ services: - identity.api - rabbitmq - graceperiodmanager: - image: eshop/graceperiodmanager:${TAG:-latest} - build: - context: ./src/Services/GracePeriod/GracePeriodManager - dockerfile: Dockerfile - depends_on: - - sql.data - - rabbitmq - webspa: image: eshop/webspa:${TAG:-latest} build: diff --git a/eShopOnContainers-ServicesAndWebApps.sln b/eShopOnContainers-ServicesAndWebApps.sln index 9dd6308a4..a01ca8a37 100644 --- a/eShopOnContainers-ServicesAndWebApps.sln +++ b/eShopOnContainers-ServicesAndWebApps.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.26430.6 +VisualStudioVersion = 15.0.26730.8 MinimumVisualStudioVersion = 10.0.40219.1 Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-compose.dcproj", "{FEA0C318-FFED-4D39-8781-265718CA43DD}" EndProject @@ -81,8 +81,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Health EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventBus.Tests", "src\BuildingBlocks\EventBus\EventBus.Tests\EventBus.Tests.csproj", "{4A980AC4-7205-46BF-8CCB-09E44D700FD4}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GracePeriodManager", "src\Services\GracePeriod\GracePeriodManager\GracePeriodManager.csproj", "{F6E0F0DD-1400-43C3-B5E0-7CC325728C47}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Location", "Location", "{41139F64-4046-4F16-96B7-D941D96FA9C6}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Locations.API", "src\Services\Location\Locations.API\Locations.API.csproj", "{E7581357-FC34-474C-B8F5-307EE3CE05EF}" @@ -1075,54 +1073,6 @@ Global {4A980AC4-7205-46BF-8CCB-09E44D700FD4}.Release|x64.Build.0 = Release|Any CPU {4A980AC4-7205-46BF-8CCB-09E44D700FD4}.Release|x86.ActiveCfg = Release|Any CPU {4A980AC4-7205-46BF-8CCB-09E44D700FD4}.Release|x86.Build.0 = Release|Any CPU - {F6E0F0DD-1400-43C3-B5E0-7CC325728C47}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU - {F6E0F0DD-1400-43C3-B5E0-7CC325728C47}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU - {F6E0F0DD-1400-43C3-B5E0-7CC325728C47}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU - {F6E0F0DD-1400-43C3-B5E0-7CC325728C47}.Ad-Hoc|ARM.Build.0 = Debug|Any CPU - {F6E0F0DD-1400-43C3-B5E0-7CC325728C47}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU - {F6E0F0DD-1400-43C3-B5E0-7CC325728C47}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU - {F6E0F0DD-1400-43C3-B5E0-7CC325728C47}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {F6E0F0DD-1400-43C3-B5E0-7CC325728C47}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU - {F6E0F0DD-1400-43C3-B5E0-7CC325728C47}.Ad-Hoc|x64.ActiveCfg = Debug|Any CPU - {F6E0F0DD-1400-43C3-B5E0-7CC325728C47}.Ad-Hoc|x64.Build.0 = Debug|Any CPU - {F6E0F0DD-1400-43C3-B5E0-7CC325728C47}.Ad-Hoc|x86.ActiveCfg = Debug|Any CPU - {F6E0F0DD-1400-43C3-B5E0-7CC325728C47}.Ad-Hoc|x86.Build.0 = Debug|Any CPU - {F6E0F0DD-1400-43C3-B5E0-7CC325728C47}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU - {F6E0F0DD-1400-43C3-B5E0-7CC325728C47}.AppStore|Any CPU.Build.0 = Debug|Any CPU - {F6E0F0DD-1400-43C3-B5E0-7CC325728C47}.AppStore|ARM.ActiveCfg = Debug|Any CPU - {F6E0F0DD-1400-43C3-B5E0-7CC325728C47}.AppStore|ARM.Build.0 = Debug|Any CPU - {F6E0F0DD-1400-43C3-B5E0-7CC325728C47}.AppStore|iPhone.ActiveCfg = Debug|Any CPU - {F6E0F0DD-1400-43C3-B5E0-7CC325728C47}.AppStore|iPhone.Build.0 = Debug|Any CPU - {F6E0F0DD-1400-43C3-B5E0-7CC325728C47}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {F6E0F0DD-1400-43C3-B5E0-7CC325728C47}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU - {F6E0F0DD-1400-43C3-B5E0-7CC325728C47}.AppStore|x64.ActiveCfg = Debug|Any CPU - {F6E0F0DD-1400-43C3-B5E0-7CC325728C47}.AppStore|x64.Build.0 = Debug|Any CPU - {F6E0F0DD-1400-43C3-B5E0-7CC325728C47}.AppStore|x86.ActiveCfg = Debug|Any CPU - {F6E0F0DD-1400-43C3-B5E0-7CC325728C47}.AppStore|x86.Build.0 = Debug|Any CPU - {F6E0F0DD-1400-43C3-B5E0-7CC325728C47}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F6E0F0DD-1400-43C3-B5E0-7CC325728C47}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F6E0F0DD-1400-43C3-B5E0-7CC325728C47}.Debug|ARM.ActiveCfg = Debug|Any CPU - {F6E0F0DD-1400-43C3-B5E0-7CC325728C47}.Debug|ARM.Build.0 = Debug|Any CPU - {F6E0F0DD-1400-43C3-B5E0-7CC325728C47}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {F6E0F0DD-1400-43C3-B5E0-7CC325728C47}.Debug|iPhone.Build.0 = Debug|Any CPU - {F6E0F0DD-1400-43C3-B5E0-7CC325728C47}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {F6E0F0DD-1400-43C3-B5E0-7CC325728C47}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {F6E0F0DD-1400-43C3-B5E0-7CC325728C47}.Debug|x64.ActiveCfg = Debug|Any CPU - {F6E0F0DD-1400-43C3-B5E0-7CC325728C47}.Debug|x64.Build.0 = Debug|Any CPU - {F6E0F0DD-1400-43C3-B5E0-7CC325728C47}.Debug|x86.ActiveCfg = Debug|Any CPU - {F6E0F0DD-1400-43C3-B5E0-7CC325728C47}.Debug|x86.Build.0 = Debug|Any CPU - {F6E0F0DD-1400-43C3-B5E0-7CC325728C47}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F6E0F0DD-1400-43C3-B5E0-7CC325728C47}.Release|Any CPU.Build.0 = Release|Any CPU - {F6E0F0DD-1400-43C3-B5E0-7CC325728C47}.Release|ARM.ActiveCfg = Release|Any CPU - {F6E0F0DD-1400-43C3-B5E0-7CC325728C47}.Release|ARM.Build.0 = Release|Any CPU - {F6E0F0DD-1400-43C3-B5E0-7CC325728C47}.Release|iPhone.ActiveCfg = Release|Any CPU - {F6E0F0DD-1400-43C3-B5E0-7CC325728C47}.Release|iPhone.Build.0 = Release|Any CPU - {F6E0F0DD-1400-43C3-B5E0-7CC325728C47}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {F6E0F0DD-1400-43C3-B5E0-7CC325728C47}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {F6E0F0DD-1400-43C3-B5E0-7CC325728C47}.Release|x64.ActiveCfg = Release|Any CPU - {F6E0F0DD-1400-43C3-B5E0-7CC325728C47}.Release|x64.Build.0 = Release|Any CPU - {F6E0F0DD-1400-43C3-B5E0-7CC325728C47}.Release|x86.ActiveCfg = Release|Any CPU - {F6E0F0DD-1400-43C3-B5E0-7CC325728C47}.Release|x86.Build.0 = Release|Any CPU {E7581357-FC34-474C-B8F5-307EE3CE05EF}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU {E7581357-FC34-474C-B8F5-307EE3CE05EF}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU {E7581357-FC34-474C-B8F5-307EE3CE05EF}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU @@ -1449,7 +1399,6 @@ Global {22A0F9C1-2D4A-4107-95B7-8459E6688BC5} = {A81ECBC2-6B00-4DCD-8388-469174033379} {4BD76717-3102-4969-8C2C-BAAA3F0263B6} = {A81ECBC2-6B00-4DCD-8388-469174033379} {4A980AC4-7205-46BF-8CCB-09E44D700FD4} = {807BB76E-B2BB-47A2-A57B-3D1B20FF5E7F} - {F6E0F0DD-1400-43C3-B5E0-7CC325728C47} = {0BD0DB92-2D98-44D9-9AC0-C59186D59B0B} {41139F64-4046-4F16-96B7-D941D96FA9C6} = {91CF7717-08AB-4E65-B10E-0B426F01E2E8} {E7581357-FC34-474C-B8F5-307EE3CE05EF} = {41139F64-4046-4F16-96B7-D941D96FA9C6} {88B22DBB-AA8F-4290-A454-2C109352C345} = {DB0EFB20-B024-4E5E-A75C-52143C131D25} @@ -1460,4 +1409,7 @@ Global {768C887F-C229-4B94-ACD8-0C7F65686524} = {A81ECBC2-6B00-4DCD-8388-469174033379} {969E793C-C413-490E-9C9D-B2B46DA5AF32} = {EF0337F2-ED00-4643-89FD-EE10863F1870} EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {25728519-5F0F-4973-8A64-0A81EB4EA8D9} + EndGlobalSection EndGlobal diff --git a/src/Services/GracePeriod/GracePeriodManager/.dockerignore b/src/Services/GracePeriod/GracePeriodManager/.dockerignore deleted file mode 100644 index d8f8175f6..000000000 --- a/src/Services/GracePeriod/GracePeriodManager/.dockerignore +++ /dev/null @@ -1,3 +0,0 @@ -* -!obj/Docker/publish/* -!obj/Docker/empty/ diff --git a/src/Services/GracePeriod/GracePeriodManager/Dockerfile b/src/Services/GracePeriod/GracePeriodManager/Dockerfile deleted file mode 100644 index 7a4f21a64..000000000 --- a/src/Services/GracePeriod/GracePeriodManager/Dockerfile +++ /dev/null @@ -1,5 +0,0 @@ -FROM microsoft/aspnetcore:2.0 -ARG source -WORKDIR /app -COPY ${source:-obj/Docker/publish} . -ENTRYPOINT ["dotnet", "GracePeriodManager.dll"] \ No newline at end of file diff --git a/src/Services/GracePeriod/GracePeriodManager/Dockerfile.nanowin b/src/Services/GracePeriod/GracePeriodManager/Dockerfile.nanowin deleted file mode 100644 index 9c664f4e4..000000000 --- a/src/Services/GracePeriod/GracePeriodManager/Dockerfile.nanowin +++ /dev/null @@ -1,8 +0,0 @@ -FROM microsoft/dotnet:1.1-runtime-nanoserver -SHELL ["powershell"] -ARG source -WORKDIR /app -RUN set-itemproperty -path 'HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters' -Name ServerPriorityTimeLimit -Value 0 -Type DWord -EXPOSE 80 -COPY ${source:-obj/Docker/publish} . -ENTRYPOINT ["dotnet", "Basket.API.dll"] diff --git a/src/Services/GracePeriod/GracePeriodManager/GracePeriodManager.csproj b/src/Services/GracePeriod/GracePeriodManager/GracePeriodManager.csproj deleted file mode 100644 index c376e88f6..000000000 --- a/src/Services/GracePeriod/GracePeriodManager/GracePeriodManager.csproj +++ /dev/null @@ -1,36 +0,0 @@ - - - - Exe - netcoreapp2.0 - - - - - - - - - - - - - - - - - - - - - - - - - - - Dockerfile - - - - \ No newline at end of file diff --git a/src/Services/GracePeriod/GracePeriodManager/IntegrationEvents/Events/GracePeriodConfirmedIntegrationEvent.cs b/src/Services/GracePeriod/GracePeriodManager/IntegrationEvents/Events/GracePeriodConfirmedIntegrationEvent.cs deleted file mode 100644 index fce04cd24..000000000 --- a/src/Services/GracePeriod/GracePeriodManager/IntegrationEvents/Events/GracePeriodConfirmedIntegrationEvent.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace GracePeriodManager.IntegrationEvents.Events -{ - using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events; - - public class GracePeriodConfirmedIntegrationEvent : IntegrationEvent - { - public int OrderId { get;} - - public GracePeriodConfirmedIntegrationEvent(int orderId) => OrderId = orderId; - } -} \ No newline at end of file diff --git a/src/Services/GracePeriod/GracePeriodManager/Program.cs b/src/Services/GracePeriod/GracePeriodManager/Program.cs deleted file mode 100644 index 88fb1547e..000000000 --- a/src/Services/GracePeriod/GracePeriodManager/Program.cs +++ /dev/null @@ -1,130 +0,0 @@ -namespace GracePeriodManager -{ - using System.IO; - using System; - using System.Threading.Tasks; - using Autofac.Extensions.DependencyInjection; - using Autofac; - using Microsoft.Extensions.Configuration; - using Microsoft.Extensions.DependencyInjection; - using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions; - using Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ; - using Microsoft.eShopOnContainers.BuildingBlocks.EventBus; - using Microsoft.Extensions.Logging; - using Microsoft.Extensions.Options; - using RabbitMQ.Client; - using Services; - using Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus; - using Microsoft.Azure.ServiceBus; - - public class Program - { - public static IConfigurationRoot Configuration { get; set; } - - public static void Main(string[] args) => MainAsync().Wait(); - - static async Task MainAsync() - { - StartUp(); - - IServiceCollection services = new ServiceCollection(); - var serviceProvider = ConfigureServices(services); - - var logger = serviceProvider.GetService(); - Configure(logger); - - var gracePeriodManagerService = serviceProvider - .GetRequiredService(); - var checkUpdateTime = serviceProvider - .GetRequiredService>().Value.CheckUpdateTime; - - while (true) - { - gracePeriodManagerService.CheckConfirmedGracePeriodOrders(); - await Task.Delay(checkUpdateTime); - } - } - - public static void StartUp() - { - var builder = new ConfigurationBuilder() - .SetBasePath(Directory.GetCurrentDirectory()) - .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) - .AddEnvironmentVariables(); - - Configuration = builder.Build(); - } - - public static IServiceProvider ConfigureServices(IServiceCollection services) - { - services.AddLogging() - .AddOptions() - .Configure(Configuration) - .AddSingleton(); - - if (Configuration.GetValue("AzureServiceBusEnabled")) - { - services.AddSingleton(sp => - { - var logger = sp.GetRequiredService>(); - - var serviceBusConnectionString = Configuration["EventBusConnection"]; - var serviceBusConnection = new ServiceBusConnectionStringBuilder(serviceBusConnectionString); - - return new DefaultServiceBusPersisterConnection(serviceBusConnection, logger); - }); - } - else - { - services.AddSingleton(sp => - { - var logger = sp.GetRequiredService>(); - - var factory = new ConnectionFactory() - { - HostName = Configuration["EventBusConnection"] - }; - - return new DefaultRabbitMQPersistentConnection(factory, logger); - }); - } - - RegisterEventBus(services); - - var container = new ContainerBuilder(); - container.Populate(services); - return new AutofacServiceProvider(container.Build()); - } - - public static void Configure(ILoggerFactory loggerFactory) - { - loggerFactory - .AddConsole(Configuration.GetSection("Logging")) - .AddConsole(LogLevel.Debug); - } - - private static void RegisterEventBus(IServiceCollection services) - { - if (Configuration.GetValue("AzureServiceBusEnabled")) - { - services.AddSingleton(sp => - { - var serviceBusPersisterConnection = sp.GetRequiredService(); - var iLifetimeScope = sp.GetRequiredService(); - var logger = sp.GetRequiredService>(); - var eventBusSubcriptionsManager = sp.GetRequiredService(); - var subscriptionClientName = Configuration["SubscriptionClientName"]; - - return new EventBusServiceBus(serviceBusPersisterConnection, logger, - eventBusSubcriptionsManager, subscriptionClientName, iLifetimeScope); - }); - } - else - { - services.AddSingleton(); - } - - services.AddSingleton(); - } - } -} \ No newline at end of file diff --git a/src/Services/GracePeriod/GracePeriodManager/Services/IManagerService.cs b/src/Services/GracePeriod/GracePeriodManager/Services/IManagerService.cs deleted file mode 100644 index 2362ccd00..000000000 --- a/src/Services/GracePeriod/GracePeriodManager/Services/IManagerService.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace GracePeriodManager.Services -{ - public interface IManagerService - { - void CheckConfirmedGracePeriodOrders(); - } -} \ No newline at end of file diff --git a/src/Services/GracePeriod/GracePeriodManager/appsettings.json b/src/Services/GracePeriod/GracePeriodManager/appsettings.json deleted file mode 100644 index 76703a77e..000000000 --- a/src/Services/GracePeriod/GracePeriodManager/appsettings.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "Logging": { - "IncludeScopes": false, - "LogLevel": { - "Default": "Debug", - "System": "Information", - "Microsoft": "Information" - } - }, - "ConnectionString": "Server=tcp:127.0.0.1,5433;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word;", - "GracePeriodTime": "1", - "CheckUpdateTime": "30000", - "AzureServiceBusEnabled": false, - "SubscriptionClientName": "GracePeriod" -} diff --git a/src/Services/GracePeriod/GracePeriodManager/Services/ManagerService.cs b/src/Services/Ordering/Ordering.API/Infrastructure/HostedServices/GracePeriodManagerService.cs similarity index 52% rename from src/Services/GracePeriod/GracePeriodManager/Services/ManagerService.cs rename to src/Services/Ordering/Ordering.API/Infrastructure/HostedServices/GracePeriodManagerService.cs index 973fda158..58408b2fd 100644 --- a/src/Services/GracePeriod/GracePeriodManager/Services/ManagerService.cs +++ b/src/Services/Ordering/Ordering.API/Infrastructure/HostedServices/GracePeriodManagerService.cs @@ -1,30 +1,56 @@ -namespace GracePeriodManager.Services +namespace Ordering.API.Infrastructure.HostedServices { using Dapper; - using GracePeriodManager.IntegrationEvents.Events; using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; + using Ordering.API.Application.IntegrationEvents.Events; + using System; using System.Collections.Generic; using System.Data.SqlClient; + using System.Threading; + using System.Threading.Tasks; - public class ManagerService : IManagerService + public class GracePeriodManagerService + : HostedService { - private readonly ManagerSettings _settings; + private readonly GracePeriodManagerSettings _settings; + private readonly ILogger _logger; private readonly IEventBus _eventBus; - private readonly ILogger _logger; - public ManagerService(IOptions settings, + public GracePeriodManagerService(IOptions settings, IEventBus eventBus, - ILogger logger) + ILogger logger) { - _settings = settings.Value; - _eventBus = eventBus; - _logger = logger; + _logger = logger ?? throw new ArgumentNullException(nameof(logger)); + _eventBus = eventBus ?? throw new ArgumentNullException(nameof(eventBus)); + + _settings = settings?.Value ?? throw new ArgumentNullException(nameof(settings)); } - public void CheckConfirmedGracePeriodOrders() + protected override async Task ExecuteAsync(CancellationToken cancellationToken) { + while (true) + { + if (cancellationToken.IsCancellationRequested) + { + break; + } + + CheckConfirmedGracePeriodOrders(); + + await Task.Delay(_settings.CheckUpdateTime, cancellationToken); + + continue; + } + + await Task.CompletedTask; + } + + private void CheckConfirmedGracePeriodOrders() + { + _logger.LogDebug($"Checking confirmed grace period orders"); + var orderIds = GetConfirmedGracePeriodOrders(); foreach (var orderId in orderIds) @@ -37,6 +63,7 @@ private IEnumerable GetConfirmedGracePeriodOrders() { IEnumerable orderIds = new List(); + using (var conn = new SqlConnection(_settings.ConnectionString)) { try @@ -46,16 +73,16 @@ @"SELECT Id FROM [Microsoft.eShopOnContainers.Services.OrderingDb].[ordering].[orders] WHERE DATEDIFF(minute, [OrderDate], GETDATE()) >= @GracePeriodTime AND [OrderStatusId] = 1", - new { GracePeriodTime = _settings.GracePeriodTime }); + new { GracePeriodTime = _settings.GracePeriodTime }); } catch (SqlException exception) { _logger.LogCritical($"FATAL ERROR: Database connections could not be opened: {exception.Message}"); } - + } return orderIds; } } -} \ No newline at end of file +} diff --git a/src/Services/GracePeriod/GracePeriodManager/ManagerSettings.cs b/src/Services/Ordering/Ordering.API/Infrastructure/HostedServices/GracePeriodManagerSettings.cs similarity index 68% rename from src/Services/GracePeriod/GracePeriodManager/ManagerSettings.cs rename to src/Services/Ordering/Ordering.API/Infrastructure/HostedServices/GracePeriodManagerSettings.cs index 44e0b56f7..2997c051d 100644 --- a/src/Services/GracePeriod/GracePeriodManager/ManagerSettings.cs +++ b/src/Services/Ordering/Ordering.API/Infrastructure/HostedServices/GracePeriodManagerSettings.cs @@ -1,6 +1,6 @@ -namespace GracePeriodManager +namespace Ordering.API.Infrastructure.HostedServices { - public class ManagerSettings + public class GracePeriodManagerSettings { public string ConnectionString { get; set; } @@ -9,5 +9,6 @@ public int GracePeriodTime { get; set; } public int CheckUpdateTime { get; set; } + } -} \ No newline at end of file +} diff --git a/src/Services/Ordering/Ordering.API/Infrastructure/HostedServices/HostedService.cs b/src/Services/Ordering/Ordering.API/Infrastructure/HostedServices/HostedService.cs new file mode 100644 index 000000000..98ee4907a --- /dev/null +++ b/src/Services/Ordering/Ordering.API/Infrastructure/HostedServices/HostedService.cs @@ -0,0 +1,48 @@ +using Microsoft.Extensions.Hosting; +using System.Threading; +using System.Threading.Tasks; + +namespace Ordering.API.Infrastructure.HostedServices +{ + public abstract class HostedService : IHostedService + { + // Example untested base class code kindly provided by David Fowler: https://gist.github.com/davidfowl/a7dd5064d9dcf35b6eae1a7953d615e3 + + private Task _executingTask; + private CancellationTokenSource _cts; + + public Task StartAsync(CancellationToken cancellationToken) + { + // Create a linked token so we can trigger cancellation outside of this token's cancellation + _cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); + + // Store the task we're executing + _executingTask = ExecuteAsync(_cts.Token); + + // If the task is completed then return it, otherwise it's running + return _executingTask.IsCompleted ? _executingTask : Task.CompletedTask; + } + + public async Task StopAsync(CancellationToken cancellationToken) + { + // Stop called without start + if (_executingTask == null) + { + return; + } + + // Signal cancellation to the executing method + _cts.Cancel(); + + // Wait until the task completes or the stop token triggers + await Task.WhenAny(_executingTask, Task.Delay(-1, cancellationToken)); + + // Throw if cancellation triggered + cancellationToken.ThrowIfCancellationRequested(); + } + + // Derived classes should override this and execute a long running method until + // cancellation is requested + protected abstract Task ExecuteAsync(CancellationToken cancellationToken); + } +} diff --git a/src/Services/Ordering/Ordering.API/Startup.cs b/src/Services/Ordering/Ordering.API/Startup.cs index 37ab2ac29..0d3f779c9 100644 --- a/src/Services/Ordering/Ordering.API/Startup.cs +++ b/src/Services/Ordering/Ordering.API/Startup.cs @@ -6,6 +6,7 @@ using global::Ordering.API.Application.IntegrationEvents; using global::Ordering.API.Application.IntegrationEvents.Events; using global::Ordering.API.Infrastructure.Filters; + using global::Ordering.API.Infrastructure.HostedServices; using Infrastructure; using Infrastructure.AutofacModules; using Infrastructure.Filters; @@ -14,7 +15,6 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.Azure.ServiceBus; using Microsoft.EntityFrameworkCore; - using Microsoft.EntityFrameworkCore.Design; using Microsoft.eShopOnContainers.BuildingBlocks.EventBus; using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions; using Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ; @@ -24,6 +24,7 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.HealthChecks; + using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; using Ordering.Infrastructure; using Polly; @@ -43,6 +44,7 @@ var builder = new ConfigurationBuilder() .SetBasePath(env.ContentRootPath) .AddJsonFile("settings.json", optional: true, reloadOnChange: true) + .AddJsonFile("graceperiodsettings.json", optional: true, reloadOnChange: true) .AddJsonFile($"settings.{env.EnvironmentName}.json", optional: true); if (env.IsDevelopment()) @@ -65,6 +67,10 @@ options.Filters.Add(typeof(HttpGlobalExceptionFilter)); }).AddControllersAsServices(); //Injecting Controllers themselves thru DI //For further info see: http://docs.autofac.org/en/latest/integration/aspnetcore.html#controllers-as-services + + // Configure GracePeriodManager Hosted Service + services.AddSingleton(); + services.Configure(Configuration); services.AddHealthChecks(checks => { @@ -207,7 +213,7 @@ private void ConfigureEventBus(IApplicationBuilder app) { - var eventBus = app.ApplicationServices.GetRequiredService(); + var eventBus = app.ApplicationServices.GetRequiredService(); eventBus.Subscribe>(); eventBus.Subscribe>(); @@ -232,7 +238,7 @@ { if (Configuration.GetValue("AzureServiceBusEnabled")) { - services.AddSingleton(sp => + services.AddSingleton(sp => { var serviceBusPersisterConnection = sp.GetRequiredService(); var iLifetimeScope = sp.GetRequiredService(); @@ -246,7 +252,7 @@ } else { - services.AddSingleton(); + services.AddSingleton(); } services.AddSingleton(); diff --git a/src/Services/Ordering/Ordering.API/graceperiodsettings.json b/src/Services/Ordering/Ordering.API/graceperiodsettings.json new file mode 100644 index 000000000..1c9d30e5e --- /dev/null +++ b/src/Services/Ordering/Ordering.API/graceperiodsettings.json @@ -0,0 +1,6 @@ +{ + "ConnectionString": "Server=tcp:127.0.0.1,5433;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word;", + "GracePeriodTime": "1", + "CheckUpdateTime": "30000" +} + From 4161efdd7084449f9047d0fa02184e9266402111 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ram=C3=B3n=20Tom=C3=A1s?= Date: Wed, 23 Aug 2017 16:40:28 +0200 Subject: [PATCH 30/64] Update authentication middleware Update global to sdk 2.0.0 --- global.json | 2 +- src/Web/WebMVC/Startup.cs | 38 ++++++++++++++++++-------------------- 2 files changed, 19 insertions(+), 21 deletions(-) diff --git a/global.json b/global.json index 7d2a1589c..bfd985e30 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,5 @@ { "sdk": { - "version":"2.0.0-preview2-006497" + "version":"2.0.0" } } \ No newline at end of file diff --git a/src/Web/WebMVC/Startup.cs b/src/Web/WebMVC/Startup.cs index 315be8973..ebf303f1b 100644 --- a/src/Web/WebMVC/Startup.cs +++ b/src/Web/WebMVC/Startup.cs @@ -86,30 +86,28 @@ namespace Microsoft.eShopOnContainers.WebMVC // Add Authentication services - services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme) - .AddCookie(CookieAuthenticationDefaults.AuthenticationScheme) - .AddOpenIdConnect(options => { - options.SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme; - options.Authority = identityUrl.ToString(); - options.SignedOutRedirectUri = callBackUrl.ToString(); - options.ClientId = useLoadTest ? "mvctest" : "mvc"; - options.ClientSecret = "secret"; - options.ResponseType = useLoadTest ? "code id_token token" : "code id_token"; - options.SaveTokens = true; - options.GetClaimsFromUserInfoEndpoint = true; - options.RequireHttpsMetadata = false; - options.Scope.Add("openid"); - options.Scope.Add("profile"); - options.Scope.Add("orders"); - options.Scope.Add("basket"); - options.Scope.Add("marketing"); - options.Scope.Add("locations"); - }); - services.AddAuthentication(options => { options.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme; options.DefaultSignInScheme = CookieAuthenticationDefaults.AuthenticationScheme; options.DefaultAuthenticateScheme = CookieAuthenticationDefaults.AuthenticationScheme; + }) + .AddCookie(CookieAuthenticationDefaults.AuthenticationScheme) + .AddOpenIdConnect(options => { + options.SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme; + options.Authority = identityUrl.ToString(); + options.SignedOutRedirectUri = callBackUrl.ToString(); + options.ClientId = useLoadTest ? "mvctest" : "mvc"; + options.ClientSecret = "secret"; + options.ResponseType = useLoadTest ? "code id_token token" : "code id_token"; + options.SaveTokens = true; + options.GetClaimsFromUserInfoEndpoint = true; + options.RequireHttpsMetadata = false; + options.Scope.Add("openid"); + options.Scope.Add("profile"); + options.Scope.Add("orders"); + options.Scope.Add("basket"); + options.Scope.Add("marketing"); + options.Scope.Add("locations"); }); } From 2a7dafd97e0f174da8091b6ab4173816c585d2c9 Mon Sep 17 00:00:00 2001 From: Cesar De la Torre Date: Wed, 23 Aug 2017 11:16:26 -0700 Subject: [PATCH 31/64] Fixed Build Container version to microsoft/aspnetcore-build:2.0 (v2.0) --- docker-compose.ci.build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.ci.build.yml b/docker-compose.ci.build.yml index 2a4c88724..7b9838cf4 100644 --- a/docker-compose.ci.build.yml +++ b/docker-compose.ci.build.yml @@ -2,7 +2,7 @@ version: '2.1' services: ci-build: - image: microsoft/aspnetcore-build:1.1.2 + image: microsoft/aspnetcore-build:2.0 volumes: - .:/src - ./cli-linux:/cli-linux From 01469da7d3314367e4ff58ef5cc0affca97bf9ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ram=C3=B3n=20Tom=C3=A1s?= Date: Thu, 24 Aug 2017 15:41:11 +0200 Subject: [PATCH 32/64] Fixed bug Swagger is not working for the services #290 --- src/Services/Basket/Basket.API/Basket.API.csproj | 1 + src/Services/Catalog/Catalog.API/Catalog.API.csproj | 1 + src/Services/Location/Locations.API/Locations.API.csproj | 1 + src/Services/Ordering/Ordering.API/Ordering.API.csproj | 1 + 4 files changed, 4 insertions(+) diff --git a/src/Services/Basket/Basket.API/Basket.API.csproj b/src/Services/Basket/Basket.API/Basket.API.csproj index 584838c8f..c418c56a5 100644 --- a/src/Services/Basket/Basket.API/Basket.API.csproj +++ b/src/Services/Basket/Basket.API/Basket.API.csproj @@ -17,6 +17,7 @@ + diff --git a/src/Services/Catalog/Catalog.API/Catalog.API.csproj b/src/Services/Catalog/Catalog.API/Catalog.API.csproj index 4c1edfa22..3257ea917 100644 --- a/src/Services/Catalog/Catalog.API/Catalog.API.csproj +++ b/src/Services/Catalog/Catalog.API/Catalog.API.csproj @@ -38,6 +38,7 @@ + diff --git a/src/Services/Location/Locations.API/Locations.API.csproj b/src/Services/Location/Locations.API/Locations.API.csproj index 3a53ee826..90588c8f7 100644 --- a/src/Services/Location/Locations.API/Locations.API.csproj +++ b/src/Services/Location/Locations.API/Locations.API.csproj @@ -15,6 +15,7 @@ + diff --git a/src/Services/Ordering/Ordering.API/Ordering.API.csproj b/src/Services/Ordering/Ordering.API/Ordering.API.csproj index 047579f6d..134b65030 100644 --- a/src/Services/Ordering/Ordering.API/Ordering.API.csproj +++ b/src/Services/Ordering/Ordering.API/Ordering.API.csproj @@ -39,6 +39,7 @@ + From 0369d8a9586215e35ea4e449363a27cdc8d8d09d Mon Sep 17 00:00:00 2001 From: Cesar De la Torre Date: Thu, 24 Aug 2017 19:33:08 -0700 Subject: [PATCH 33/64] Workaround (dotnet CLI set with verbosity minimal) so we don't get stdout errors when compiling from the Docker Linux "build containers" when doing the CLI build. Related bug: https://github.com/Microsoft/msbuild/issues/2153#issuecomment-305375162 --- cli-linux/build-bits-linux.sh | 5 ++--- docker-compose.ci.build.yml | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/cli-linux/build-bits-linux.sh b/cli-linux/build-bits-linux.sh index 75ace0938..bcb3b9f06 100755 --- a/cli-linux/build-bits-linux.sh +++ b/cli-linux/build-bits-linux.sh @@ -16,7 +16,6 @@ declare -a projectList=( "$path/Services/Location/Locations.API" "$path/Services/Marketing/Marketing.API" "$path/Services/Payment/Payment.API" - "$path/Services/GracePeriod/GracePeriodManager" "$path/Web/WebMVC" "$path/Web/WebStatus" ) @@ -32,9 +31,9 @@ do pushd $path/$project rm -rf obj/Docker/publish echo -e "\e[33m\tRestoring project $project" - dotnet restore + dotnet restore --verbosity minimal echo -e "\e[33m\tBuilding and publishing $project" - dotnet publish -o obj/Docker/publish + dotnet publish -c Release -o obj/Docker/publish --verbosity minimal popd done diff --git a/docker-compose.ci.build.yml b/docker-compose.ci.build.yml index 7b9838cf4..02fe39637 100644 --- a/docker-compose.ci.build.yml +++ b/docker-compose.ci.build.yml @@ -11,7 +11,7 @@ services: # Next line is using the .sln file to compile all the projects. # Sometime there is an issue in msbuild exits the process before finishing building the bits: (https://github.com/Microsoft/msbuild/issues/2153) # Random error: error MSB4017: The build stopped unexpectedly be cause of an unexpected logger failure. - #command: /bin/bash -c "pushd ./src/Web/WebSPA && npm rebuild node-sass && popd && dotnet restore ./eShopOnContainers-ServicesAndWebApps.sln && dotnet publish ./eShopOnContainers-ServicesAndWebApps.sln -c Release -o ./obj/Docker/publish" + #command: /bin/bash -c "pushd ./src/Web/WebSPA && npm rebuild node-sass && popd && dotnet restore ./eShopOnContainers-ServicesAndWebApps.sln --verbosity minimal && dotnet publish ./eShopOnContainers-ServicesAndWebApps.sln -c Release -o ./obj/Docker/publish --verbosity minimal" # NOTE: Using build-bits-linux.sh from Linux build container exits before ending. command: /bin/bash -c "pushd ./src/Web/WebSPA && npm rebuild node-sass && popd && pushd /cli-linux && ./build-bits-linux.sh /src" From fb7217c92982519ad7fdc5c68f0081663ad8b883 Mon Sep 17 00:00:00 2001 From: Cesar De la Torre Date: Fri, 25 Aug 2017 19:39:22 -0700 Subject: [PATCH 34/64] Added aditional script to delete images created by VS --- cli-windows/delete-vs-and-eshop-images.ps1 | 46 ++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 cli-windows/delete-vs-and-eshop-images.ps1 diff --git a/cli-windows/delete-vs-and-eshop-images.ps1 b/cli-windows/delete-vs-and-eshop-images.ps1 new file mode 100644 index 000000000..f37dc6ea4 --- /dev/null +++ b/cli-windows/delete-vs-and-eshop-images.ps1 @@ -0,0 +1,46 @@ + # Delete all containers + Write-Host "Deleting all running containers in the local Docker Host" + docker rm $(docker ps -a -q) -f + +$eShopImagesToDelete = docker images --filter=reference="eshop/*" -q +If (-Not $eShopImagesToDelete) {Write-Host "Not deleting eShop images as there are no eShop images in the current local Docker repo."} +Else +{ + # Delete all eshop images + Write-Host "Deleting eShop images in local Docker repo" + Write-Host $eShopImagesToDelete + docker rmi $(docker images --filter=reference="eshop/*" -q) -f +} + +$VSImagesToDelete = docker images --filter=reference="catalog.api:dev" -q +If (-Not $VSImagesToDelete) {Write-Host "Not deleting VS images as there are no VS images in the current local Docker repo."} +Else +{ + # Delete all eshop images + Write-Host "Deleting images created by VS in local Docker repo" + Write-Host $VSImagesToDelete + docker rmi $(docker images --filter=reference="*:dev" -q) -f + + #docker rmi $(docker images --filter=reference="eshop/payment.api:dev" -q) -f + #docker rmi $(docker images --filter=reference="eshop/webspa:dev" -q) -f + #docker rmi $(docker images --filter=reference="eshop/webmvc:dev" -q) -f + #docker rmi $(docker images --filter=reference="eshop/catalog.api:dev" -q) -f + #docker rmi $(docker images --filter=reference="eshop/marketing.api:dev" -q) -f + #docker rmi $(docker images --filter=reference="eshop/ordering.api:dev" -q) -f + #docker rmi $(docker images --filter=reference="eshop/basket.api:dev" -q) -f + #docker rmi $(docker images --filter=reference="eshop/identity.api:dev" -q) -f + #docker rmi $(docker images --filter=reference="eshop/locations.api:dev" -q) -f + #docker rmi $(docker images --filter=reference="eshop/webstatus:dev" -q) -f +} + +# DELETE ALL IMAGES AND CONTAINERS + +# Delete all containers +# docker rm $(docker ps -a -q) -f + +# Delete all images +# docker rmi $(docker images -q) + +#Filter by image name (Has to be complete, cannot be a wildcard) +#docker ps -q --filter=ancestor=eshop/identity.api:dev + From 8dc176add96bdc15baa78a981cef99bcef3e68c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ram=C3=B3n=20Tom=C3=A1s?= Date: Sat, 26 Aug 2017 22:55:24 +0200 Subject: [PATCH 35/64] Fixed issue #291ordering.api fails after submitting orders --- .../Infrastructure/AutofacModules/ApplicationModule.cs | 7 +++++++ .../Infrastructure/AutofacModules/MediatorModule.cs | 9 ++------- src/Services/Ordering/Ordering.API/Ordering.API.csproj | 2 +- src/Services/Ordering/Ordering.API/Startup.cs | 4 +++- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/Services/Ordering/Ordering.API/Infrastructure/AutofacModules/ApplicationModule.cs b/src/Services/Ordering/Ordering.API/Infrastructure/AutofacModules/ApplicationModule.cs index 1e6b4c788..dbda8bc14 100644 --- a/src/Services/Ordering/Ordering.API/Infrastructure/AutofacModules/ApplicationModule.cs +++ b/src/Services/Ordering/Ordering.API/Infrastructure/AutofacModules/ApplicationModule.cs @@ -1,9 +1,12 @@ using Autofac; +using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions; +using Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands; using Microsoft.eShopOnContainers.Services.Ordering.API.Application.Queries; using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate; using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate; using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Idempotency; using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Repositories; +using System.Reflection; namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.AutofacModules { @@ -38,6 +41,10 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.Autof builder.RegisterType() .As() .InstancePerLifetimeScope(); + + builder.RegisterAssemblyTypes(typeof(CreateOrderCommandHandler).GetTypeInfo().Assembly) + .AsClosedTypesOf(typeof(IIntegrationEventHandler<>)); + } } } diff --git a/src/Services/Ordering/Ordering.API/Infrastructure/AutofacModules/MediatorModule.cs b/src/Services/Ordering/Ordering.API/Infrastructure/AutofacModules/MediatorModule.cs index 86e18668b..b23f6812a 100644 --- a/src/Services/Ordering/Ordering.API/Infrastructure/AutofacModules/MediatorModule.cs +++ b/src/Services/Ordering/Ordering.API/Infrastructure/AutofacModules/MediatorModule.cs @@ -21,16 +21,11 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.Autof // Register all the Command classes (they implement IAsyncRequestHandler) in assembly holding the Commands builder.RegisterAssemblyTypes(typeof(CreateOrderCommand).GetTypeInfo().Assembly) - .As(o => o.GetInterfaces() - .Where(i => i.IsClosedTypeOf(typeof(IAsyncRequestHandler<,>))) - .Select(i => new KeyedService("IAsyncRequestHandler", i))); + .AsClosedTypesOf(typeof(IAsyncRequestHandler<,>)); // Register all the event classes (they implement IAsyncNotificationHandler) in assembly holding the Commands builder.RegisterAssemblyTypes(typeof(ValidateOrAddBuyerAggregateWhenOrderStartedDomainEventHandler).GetTypeInfo().Assembly) - .As(o => o.GetInterfaces() - .Where(i => i.IsClosedTypeOf(typeof(IAsyncNotificationHandler<>))) - .Select(i => new KeyedService("IAsyncNotificationHandler", i))) - .AsImplementedInterfaces(); + .AsClosedTypesOf(typeof(IAsyncNotificationHandler<>)); builder diff --git a/src/Services/Ordering/Ordering.API/Ordering.API.csproj b/src/Services/Ordering/Ordering.API/Ordering.API.csproj index 134b65030..ce6a77ca6 100644 --- a/src/Services/Ordering/Ordering.API/Ordering.API.csproj +++ b/src/Services/Ordering/Ordering.API/Ordering.API.csproj @@ -34,7 +34,7 @@ - + diff --git a/src/Services/Ordering/Ordering.API/Startup.cs b/src/Services/Ordering/Ordering.API/Startup.cs index 0d3f779c9..3f2bbe43b 100644 --- a/src/Services/Ordering/Ordering.API/Startup.cs +++ b/src/Services/Ordering/Ordering.API/Startup.cs @@ -67,11 +67,13 @@ options.Filters.Add(typeof(HttpGlobalExceptionFilter)); }).AddControllersAsServices(); //Injecting Controllers themselves thru DI //For further info see: http://docs.autofac.org/en/latest/integration/aspnetcore.html#controllers-as-services - + // Configure GracePeriodManager Hosted Service services.AddSingleton(); services.Configure(Configuration); + services.AddTransient(); + services.AddHealthChecks(checks => { var minutes = 1; From 4e37f0df271b784227ef77e88ff585e3e00baad2 Mon Sep 17 00:00:00 2001 From: Unai Zorrilla Castro Date: Tue, 29 Aug 2017 10:20:13 +0200 Subject: [PATCH 36/64] Migrate Building Blocks to .NETStandard2.0 and .NETCoreApp2.0. Fix packages references. Update Basket.API to new templates on .NETCoreApp2.0 --- .../DataProtection/DataProtection.csproj | 12 +- .../EventBus.Tests/EventBus.Tests.csproj | 4 +- .../EventBus/EventBus/EventBus.csproj | 2 +- .../EventBusRabbitMQ/EventBusRabbitMQ.cs | 5 +- .../EventBusRabbitMQ/EventBusRabbitMQ.csproj | 12 +- .../DefaultServiceBusPersisterConnection.cs | 1 - .../EventBusServiceBus/EventBusServiceBus.cs | 1 - .../EventBusServiceBus.csproj | 6 +- .../IServiceBusPersisterConnection.cs | 2 +- .../IntegrationEventLogEF.csproj | 15 ++- .../Microsoft.AspNetCore.HealthChecks.csproj | 4 +- ...xtensions.HealthChecks.AzureStorage.csproj | 8 +- ...t.Extensions.HealthChecks.SqlServer.csproj | 4 +- .../Microsoft.Extensions.HealthChecks.csproj | 4 +- .../Resilience.Http/Resilience.Http.csproj | 6 +- .../Basket/Basket.API/Basket.API.csproj | 17 +-- .../Controllers/BasketController.cs | 19 ++-- .../Exceptions/BasketDomainException.cs | 3 - .../FailingMiddlewareAppBuilderExtensions.cs | 3 - .../Filters/AuthorizeCheckOperationFilter.cs | 2 - .../Filters/ValidateModelStateFilter.cs | 4 +- .../Middlewares/FailingMiddleware.cs | 1 - .../Middlewares/FailingOptions.cs | 5 +- .../OrderStartedIntegrationEventHandler.cs | 1 - .../UserCheckoutAcceptedIntegrationEvent.cs | 3 - .../Basket/Basket.API/Model/BasketCheckout.cs | 3 - src/Services/Basket/Basket.API/Program.cs | 22 ++-- .../Basket.API/Services/IIdentityService.cs | 7 +- .../Basket.API/Services/IdentityService.cs | 3 - src/Services/Basket/Basket.API/Startup.cs | 105 ++++++++---------- 30 files changed, 111 insertions(+), 173 deletions(-) diff --git a/src/BuildingBlocks/DataProtection/DataProtection/DataProtection.csproj b/src/BuildingBlocks/DataProtection/DataProtection/DataProtection.csproj index 2f519fc95..41281cf54 100644 --- a/src/BuildingBlocks/DataProtection/DataProtection/DataProtection.csproj +++ b/src/BuildingBlocks/DataProtection/DataProtection/DataProtection.csproj @@ -1,19 +1,13 @@  - netstandard1.5 + netstandard2.0 Microsoft.eShopOnContainers.BuildingBlocks - - - + - + \ No newline at end of file diff --git a/src/BuildingBlocks/EventBus/EventBus.Tests/EventBus.Tests.csproj b/src/BuildingBlocks/EventBus/EventBus.Tests/EventBus.Tests.csproj index 8589f6035..48f96ab59 100644 --- a/src/BuildingBlocks/EventBus/EventBus.Tests/EventBus.Tests.csproj +++ b/src/BuildingBlocks/EventBus/EventBus.Tests/EventBus.Tests.csproj @@ -1,11 +1,11 @@  - netstandard1.5 + netstandard2.0 - + diff --git a/src/BuildingBlocks/EventBus/EventBus/EventBus.csproj b/src/BuildingBlocks/EventBus/EventBus/EventBus.csproj index 1fc8e48cf..22a2d3091 100644 --- a/src/BuildingBlocks/EventBus/EventBus/EventBus.csproj +++ b/src/BuildingBlocks/EventBus/EventBus/EventBus.csproj @@ -1,7 +1,7 @@  - netstandard1.5 + netstandard2.0 Microsoft.eShopOnContainers.BuildingBlocks.EventBus diff --git a/src/BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.cs b/src/BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.cs index 07a130f22..f438623a6 100644 --- a/src/BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.cs +++ b/src/BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.cs @@ -11,10 +11,7 @@ using RabbitMQ.Client; using RabbitMQ.Client.Events; using RabbitMQ.Client.Exceptions; using System; -using System.Collections.Generic; -using System.Linq; using System.Net.Sockets; -using System.Reflection; using System.Text; using System.Threading.Tasks; @@ -184,7 +181,7 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ }; channel.BasicConsume(queue: _queueName, - noAck: true, + autoAck: false, consumer: consumer); channel.CallbackException += (sender, ea) => diff --git a/src/BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.csproj b/src/BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.csproj index f033ad159..6966a57f1 100644 --- a/src/BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.csproj +++ b/src/BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.csproj @@ -1,17 +1,17 @@  - netstandard1.5 + netstandard2.0 Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ - - + + - - - + + + diff --git a/src/BuildingBlocks/EventBus/EventBusServiceBus/DefaultServiceBusPersisterConnection.cs b/src/BuildingBlocks/EventBus/EventBusServiceBus/DefaultServiceBusPersisterConnection.cs index db1b6b390..a3f563c2f 100644 --- a/src/BuildingBlocks/EventBus/EventBusServiceBus/DefaultServiceBusPersisterConnection.cs +++ b/src/BuildingBlocks/EventBus/EventBusServiceBus/DefaultServiceBusPersisterConnection.cs @@ -1,7 +1,6 @@ using Microsoft.Azure.ServiceBus; using Microsoft.Extensions.Logging; using System; -using System.IO; namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus { diff --git a/src/BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.cs b/src/BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.cs index 1458b7198..03a3d1139 100644 --- a/src/BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.cs +++ b/src/BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.cs @@ -9,7 +9,6 @@ using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; - using System.Reflection; using System.Text; using System.Threading.Tasks; diff --git a/src/BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.csproj b/src/BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.csproj index 1db35be68..07c7a7607 100644 --- a/src/BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.csproj +++ b/src/BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.csproj @@ -1,14 +1,14 @@  - netcoreapp1.1 + netstandard2.0 Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus - + - + diff --git a/src/BuildingBlocks/EventBus/EventBusServiceBus/IServiceBusPersisterConnection.cs b/src/BuildingBlocks/EventBus/EventBusServiceBus/IServiceBusPersisterConnection.cs index 283031247..52737cef7 100644 --- a/src/BuildingBlocks/EventBus/EventBusServiceBus/IServiceBusPersisterConnection.cs +++ b/src/BuildingBlocks/EventBus/EventBusServiceBus/IServiceBusPersisterConnection.cs @@ -1,7 +1,7 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus { - using System; using Microsoft.Azure.ServiceBus; + using System; public interface IServiceBusPersisterConnection : IDisposable { diff --git a/src/BuildingBlocks/EventBus/IntegrationEventLogEF/IntegrationEventLogEF.csproj b/src/BuildingBlocks/EventBus/IntegrationEventLogEF/IntegrationEventLogEF.csproj index e1e24b9fe..8d5c8f0ad 100644 --- a/src/BuildingBlocks/EventBus/IntegrationEventLogEF/IntegrationEventLogEF.csproj +++ b/src/BuildingBlocks/EventBus/IntegrationEventLogEF/IntegrationEventLogEF.csproj @@ -1,22 +1,21 @@  - netcoreapp2.0 + netstandard2.0 Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF - - - - - - + + + + + - + diff --git a/src/BuildingBlocks/HealthChecks/src/Microsoft.AspNetCore.HealthChecks/Microsoft.AspNetCore.HealthChecks.csproj b/src/BuildingBlocks/HealthChecks/src/Microsoft.AspNetCore.HealthChecks/Microsoft.AspNetCore.HealthChecks.csproj index 023554e60..0f6b99f32 100644 --- a/src/BuildingBlocks/HealthChecks/src/Microsoft.AspNetCore.HealthChecks/Microsoft.AspNetCore.HealthChecks.csproj +++ b/src/BuildingBlocks/HealthChecks/src/Microsoft.AspNetCore.HealthChecks/Microsoft.AspNetCore.HealthChecks.csproj @@ -1,7 +1,7 @@  - netstandard1.3 + netstandard2.0 @@ -9,7 +9,7 @@ - + diff --git a/src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks.AzureStorage/Microsoft.Extensions.HealthChecks.AzureStorage.csproj b/src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks.AzureStorage/Microsoft.Extensions.HealthChecks.AzureStorage.csproj index 24d5ce92b..110ef7497 100644 --- a/src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks.AzureStorage/Microsoft.Extensions.HealthChecks.AzureStorage.csproj +++ b/src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks.AzureStorage/Microsoft.Extensions.HealthChecks.AzureStorage.csproj @@ -1,7 +1,7 @@  - netstandard1.3 + netstandard2.0 $(PackageTargetFallback);net46 false false @@ -17,11 +17,11 @@ - + - - + + diff --git a/src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks.SqlServer/Microsoft.Extensions.HealthChecks.SqlServer.csproj b/src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks.SqlServer/Microsoft.Extensions.HealthChecks.SqlServer.csproj index 35aacef13..60017a85f 100644 --- a/src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks.SqlServer/Microsoft.Extensions.HealthChecks.SqlServer.csproj +++ b/src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks.SqlServer/Microsoft.Extensions.HealthChecks.SqlServer.csproj @@ -1,7 +1,7 @@  - netstandard1.3 + netstandard2.0 @@ -9,7 +9,7 @@ - + diff --git a/src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks/Microsoft.Extensions.HealthChecks.csproj b/src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks/Microsoft.Extensions.HealthChecks.csproj index 8ef22e156..80e8026b0 100644 --- a/src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks/Microsoft.Extensions.HealthChecks.csproj +++ b/src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks/Microsoft.Extensions.HealthChecks.csproj @@ -1,7 +1,7 @@  - netstandard1.3 + netstandard2.0 @@ -9,7 +9,7 @@ - + diff --git a/src/BuildingBlocks/Resilience/Resilience.Http/Resilience.Http.csproj b/src/BuildingBlocks/Resilience/Resilience.Http/Resilience.Http.csproj index 1f094380c..e1c32cff2 100644 --- a/src/BuildingBlocks/Resilience/Resilience.Http/Resilience.Http.csproj +++ b/src/BuildingBlocks/Resilience/Resilience.Http/Resilience.Http.csproj @@ -1,14 +1,14 @@  - netstandard1.4 + netstandard2.0 Microsoft.eShopOnContainers.BuildingBlocks.Resilience.Http - + - + \ No newline at end of file diff --git a/src/Services/Basket/Basket.API/Basket.API.csproj b/src/Services/Basket/Basket.API/Basket.API.csproj index c418c56a5..8864c9d06 100644 --- a/src/Services/Basket/Basket.API/Basket.API.csproj +++ b/src/Services/Basket/Basket.API/Basket.API.csproj @@ -16,24 +16,9 @@ + - - - - - - - - - - - - - - - - diff --git a/src/Services/Basket/Basket.API/Controllers/BasketController.cs b/src/Services/Basket/Basket.API/Controllers/BasketController.cs index 9219cfad3..dff9ba54a 100644 --- a/src/Services/Basket/Basket.API/Controllers/BasketController.cs +++ b/src/Services/Basket/Basket.API/Controllers/BasketController.cs @@ -1,15 +1,12 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc; -using Microsoft.eShopOnContainers.Services.Basket.API.Model; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Http; -using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions; -using Basket.API.IntegrationEvents.Events; -using Microsoft.eShopOnContainers.Services.Basket.API.Services; +using Basket.API.IntegrationEvents.Events; using Basket.API.Model; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions; +using Microsoft.eShopOnContainers.Services.Basket.API.Model; +using Microsoft.eShopOnContainers.Services.Basket.API.Services; +using System; +using System.Threading.Tasks; namespace Microsoft.eShopOnContainers.Services.Basket.API.Controllers { diff --git a/src/Services/Basket/Basket.API/Infrastructure/Exceptions/BasketDomainException.cs b/src/Services/Basket/Basket.API/Infrastructure/Exceptions/BasketDomainException.cs index 199409ecc..e0f2df6fa 100644 --- a/src/Services/Basket/Basket.API/Infrastructure/Exceptions/BasketDomainException.cs +++ b/src/Services/Basket/Basket.API/Infrastructure/Exceptions/BasketDomainException.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; namespace Basket.API.Infrastructure.Exceptions { diff --git a/src/Services/Basket/Basket.API/Infrastructure/Exceptions/FailingMiddlewareAppBuilderExtensions.cs b/src/Services/Basket/Basket.API/Infrastructure/Exceptions/FailingMiddlewareAppBuilderExtensions.cs index 935bb79a8..a09f32f76 100644 --- a/src/Services/Basket/Basket.API/Infrastructure/Exceptions/FailingMiddlewareAppBuilderExtensions.cs +++ b/src/Services/Basket/Basket.API/Infrastructure/Exceptions/FailingMiddlewareAppBuilderExtensions.cs @@ -1,8 +1,5 @@ using Microsoft.AspNetCore.Builder; using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; namespace Basket.API.Infrastructure.Middlewares { diff --git a/src/Services/Basket/Basket.API/Infrastructure/Filters/AuthorizeCheckOperationFilter.cs b/src/Services/Basket/Basket.API/Infrastructure/Filters/AuthorizeCheckOperationFilter.cs index f27a3c209..7caa9740d 100644 --- a/src/Services/Basket/Basket.API/Infrastructure/Filters/AuthorizeCheckOperationFilter.cs +++ b/src/Services/Basket/Basket.API/Infrastructure/Filters/AuthorizeCheckOperationFilter.cs @@ -1,10 +1,8 @@ using Microsoft.AspNetCore.Authorization; using Swashbuckle.AspNetCore.Swagger; using Swashbuckle.AspNetCore.SwaggerGen; -using System; using System.Collections.Generic; using System.Linq; -using System.Threading.Tasks; namespace Basket.API.Infrastructure.Filters { diff --git a/src/Services/Basket/Basket.API/Infrastructure/Filters/ValidateModelStateFilter.cs b/src/Services/Basket/Basket.API/Infrastructure/Filters/ValidateModelStateFilter.cs index 8ef72edb6..3e4c3e072 100644 --- a/src/Services/Basket/Basket.API/Infrastructure/Filters/ValidateModelStateFilter.cs +++ b/src/Services/Basket/Basket.API/Infrastructure/Filters/ValidateModelStateFilter.cs @@ -1,6 +1,6 @@ -using System.Linq; -using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Filters; +using System.Linq; namespace Basket.API.Infrastructure.Filters { diff --git a/src/Services/Basket/Basket.API/Infrastructure/Middlewares/FailingMiddleware.cs b/src/Services/Basket/Basket.API/Infrastructure/Middlewares/FailingMiddleware.cs index 05acd0d2c..875749b5f 100644 --- a/src/Services/Basket/Basket.API/Infrastructure/Middlewares/FailingMiddleware.cs +++ b/src/Services/Basket/Basket.API/Infrastructure/Middlewares/FailingMiddleware.cs @@ -1,6 +1,5 @@ using Microsoft.AspNetCore.Http; using System; -using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; diff --git a/src/Services/Basket/Basket.API/Infrastructure/Middlewares/FailingOptions.cs b/src/Services/Basket/Basket.API/Infrastructure/Middlewares/FailingOptions.cs index b31207e00..45989832c 100644 --- a/src/Services/Basket/Basket.API/Infrastructure/Middlewares/FailingOptions.cs +++ b/src/Services/Basket/Basket.API/Infrastructure/Middlewares/FailingOptions.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; +using System.Collections.Generic; namespace Basket.API.Infrastructure.Middlewares { diff --git a/src/Services/Basket/Basket.API/IntegrationEvents/EventHandling/OrderStartedIntegrationEventHandler.cs b/src/Services/Basket/Basket.API/IntegrationEvents/EventHandling/OrderStartedIntegrationEventHandler.cs index f6e7de1b0..19ae1b594 100644 --- a/src/Services/Basket/Basket.API/IntegrationEvents/EventHandling/OrderStartedIntegrationEventHandler.cs +++ b/src/Services/Basket/Basket.API/IntegrationEvents/EventHandling/OrderStartedIntegrationEventHandler.cs @@ -1,6 +1,5 @@ using Basket.API.IntegrationEvents.Events; using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions; -using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events; using Microsoft.eShopOnContainers.Services.Basket.API.Model; using System; using System.Threading.Tasks; diff --git a/src/Services/Basket/Basket.API/IntegrationEvents/Events/UserCheckoutAcceptedIntegrationEvent.cs b/src/Services/Basket/Basket.API/IntegrationEvents/Events/UserCheckoutAcceptedIntegrationEvent.cs index 4c02612c5..e3665451c 100644 --- a/src/Services/Basket/Basket.API/IntegrationEvents/Events/UserCheckoutAcceptedIntegrationEvent.cs +++ b/src/Services/Basket/Basket.API/IntegrationEvents/Events/UserCheckoutAcceptedIntegrationEvent.cs @@ -1,9 +1,6 @@ using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events; using Microsoft.eShopOnContainers.Services.Basket.API.Model; using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; namespace Basket.API.IntegrationEvents.Events { diff --git a/src/Services/Basket/Basket.API/Model/BasketCheckout.cs b/src/Services/Basket/Basket.API/Model/BasketCheckout.cs index 5241a3672..410700773 100644 --- a/src/Services/Basket/Basket.API/Model/BasketCheckout.cs +++ b/src/Services/Basket/Basket.API/Model/BasketCheckout.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; namespace Basket.API.Model { diff --git a/src/Services/Basket/Basket.API/Program.cs b/src/Services/Basket/Basket.API/Program.cs index 7753ef537..53b6f311f 100644 --- a/src/Services/Basket/Basket.API/Program.cs +++ b/src/Services/Basket/Basket.API/Program.cs @@ -1,7 +1,8 @@ using Basket.API.Infrastructure.Middlewares; +using Microsoft.AspNetCore; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; -using System.Collections.Generic; +using Microsoft.Extensions.Logging; using System.IO; namespace Microsoft.eShopOnContainers.Services.Basket.API @@ -10,19 +11,24 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API { public static void Main(string[] args) { - var host = new WebHostBuilder() - .UseKestrel() + BuildWebHost(args).Run(); + } + + public static IWebHost BuildWebHost(string[] args) => + WebHost.CreateDefaultBuilder(args) .UseFailing(options => { - options.ConfigPath = "/Failing"; + options.ConfigPath = "/Failing"; }) .UseHealthChecks("/hc") .UseContentRoot(Directory.GetCurrentDirectory()) - .UseIISIntegration() .UseStartup() + .ConfigureLogging((hostingContext, builder) => + { + builder.AddConfiguration(hostingContext.Configuration.GetSection("Logging")); + builder.AddConsole(); + builder.AddDebug(); + }) .Build(); - - host.Run(); - } } } diff --git a/src/Services/Basket/Basket.API/Services/IIdentityService.cs b/src/Services/Basket/Basket.API/Services/IIdentityService.cs index 8cc7bd848..fe84e23d5 100644 --- a/src/Services/Basket/Basket.API/Services/IIdentityService.cs +++ b/src/Services/Basket/Basket.API/Services/IIdentityService.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace Microsoft.eShopOnContainers.Services.Basket.API.Services +namespace Microsoft.eShopOnContainers.Services.Basket.API.Services { public interface IIdentityService { diff --git a/src/Services/Basket/Basket.API/Services/IdentityService.cs b/src/Services/Basket/Basket.API/Services/IdentityService.cs index 08d1ffffa..d187be8d6 100644 --- a/src/Services/Basket/Basket.API/Services/IdentityService.cs +++ b/src/Services/Basket/Basket.API/Services/IdentityService.cs @@ -1,9 +1,6 @@  using Microsoft.AspNetCore.Http; using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; namespace Microsoft.eShopOnContainers.Services.Basket.API.Services { diff --git a/src/Services/Basket/Basket.API/Startup.cs b/src/Services/Basket/Basket.API/Startup.cs index 18e21e209..e2a2b6e3e 100644 --- a/src/Services/Basket/Basket.API/Startup.cs +++ b/src/Services/Basket/Basket.API/Startup.cs @@ -6,10 +6,11 @@ using Basket.API.IntegrationEvents.Events; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; +using Microsoft.Azure.ServiceBus; using Microsoft.eShopOnContainers.BuildingBlocks.EventBus; using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions; using Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ; -using Microsoft.eShopOnContainers.Services.Basket.API.Auth.Server; +using Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus; using Microsoft.eShopOnContainers.Services.Basket.API.IntegrationEvents.EventHandling; using Microsoft.eShopOnContainers.Services.Basket.API.IntegrationEvents.Events; using Microsoft.eShopOnContainers.Services.Basket.API.Model; @@ -21,31 +22,22 @@ using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using RabbitMQ.Client; using StackExchange.Redis; -using System; -using System.Linq; -using System.Net; -using System.Threading.Tasks; - -using Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus; -using Microsoft.Azure.ServiceBus; using Swashbuckle.AspNetCore.Swagger; +using System; using System.Collections.Generic; +using System.Threading.Tasks; namespace Microsoft.eShopOnContainers.Services.Basket.API { public class Startup { - public Startup(IHostingEnvironment env) + public Startup(IConfiguration configuration) { - var builder = new ConfigurationBuilder() - .SetBasePath(env.ContentRootPath) - .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) - .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true) - .AddEnvironmentVariables(); - Configuration = builder.Build(); + Configuration = configuration; } - public IConfigurationRoot Configuration { get; } + public IConfiguration Configuration { get; } + // This method gets called by the runtime. Use this method to add services to the container. public IServiceProvider ConfigureServices(IServiceCollection services) @@ -55,6 +47,7 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API { options.Filters.Add(typeof(HttpGlobalExceptionFilter)); options.Filters.Add(typeof(ValidateModelStateFilter)); + }).AddControllersAsServices(); services.AddHealthChecks(checks => @@ -66,6 +59,15 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API services.Configure(Configuration); + services.AddAuthentication() + .AddJwtBearer(options => + { + options.Authority = Configuration.GetValue("IdentityUrl"); + options.Audience = "basket"; + options.RequireHttpsMetadata = false; + + }); + //By connecting here we are making sure that our service //cannot start until redis is ready. This might slow down startup, //but given that there is a delay on resolving the ip address @@ -75,7 +77,8 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API services.AddSingleton(sp => { var settings = sp.GetRequiredService>().Value; - ConfigurationOptions configuration = ConfigurationOptions.Parse(settings.ConnectionString, true); + var configuration = ConfigurationOptions.Parse(settings.ConnectionString, true); + configuration.ResolveDns = true; return ConnectionMultiplexer.Connect(configuration); @@ -111,11 +114,10 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API RegisterEventBus(services); - services.AddSwaggerGen(options => { options.DescribeAllEnumsAsStrings(); - options.SwaggerDoc("v1", new Swashbuckle.AspNetCore.Swagger.Info + options.SwaggerDoc("v1", new Info { Title = "Basket HTTP API", Version = "v1", @@ -154,9 +156,32 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API var container = new ContainerBuilder(); container.Populate(services); + return new AutofacServiceProvider(container.Build()); } + + + // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. + public void Configure(IApplicationBuilder app, IHostingEnvironment env) + { + app.UseStaticFiles(); + app.UseCors("CorsPolicy"); + app.UseAuthentication(); + app.UseMvcWithDefaultRoute(); + + app.UseSwagger() + .UseSwaggerUI(c => + { + c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1"); + c.ConfigureOAuth2("basketswaggerui", "", "", "Basket Swagger UI"); + }); + + ConfigureEventBus(app); + + } + + private void RegisterEventBus(IServiceCollection services) { if (Configuration.GetValue("AzureServiceBusEnabled")) @@ -169,7 +194,7 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API var eventBusSubcriptionsManager = sp.GetRequiredService(); var subscriptionClientName = Configuration["SubscriptionClientName"]; - return new EventBusServiceBus(serviceBusPersisterConnection, logger, + return new EventBusServiceBus(serviceBusPersisterConnection, logger, eventBusSubcriptionsManager, subscriptionClientName, iLifetimeScope); }); } @@ -184,46 +209,10 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API services.AddTransient(); } - // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. - public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) - { - loggerFactory.AddConsole(Configuration.GetSection("Logging")); - loggerFactory.AddDebug(); - - app.UseStaticFiles(); - - // Use frameworks - app.UseCors("CorsPolicy"); - - ConfigureAuth(app); - - app.UseMvcWithDefaultRoute(); - - app.UseSwagger() - .UseSwaggerUI(c => - { - c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1"); - c.ConfigureOAuth2("basketswaggerui", "", "", "Basket Swagger UI"); - }); - - ConfigureEventBus(app); - - } - - protected virtual void ConfigureAuth(IApplicationBuilder app) - { - var identityUrl = Configuration.GetValue("IdentityUrl"); - app.UseIdentityServerAuthentication(new IdentityServerAuthenticationOptions - { - Authority = identityUrl.ToString(), - ApiName = "basket", - RequireHttpsMetadata = false - }); - } - - protected virtual void ConfigureEventBus(IApplicationBuilder app) + private void ConfigureEventBus(IApplicationBuilder app) { var eventBus = app.ApplicationServices.GetRequiredService(); + eventBus.Subscribe(); eventBus.Subscribe(); } From 360456f051669f30f6688429308393cdd7fc24b7 Mon Sep 17 00:00:00 2001 From: Unai Zorrilla Castro Date: Tue, 29 Aug 2017 11:01:27 +0200 Subject: [PATCH 37/64] Migrated Marketing.API and Locations.API to .NETCoreApp2.0. Update Startup and Program to new .NETCoreApp2.0 templates --- .../Controllers/HomeController.cs | 6 +- .../Repositories/ILocationsRepository.cs | 2 +- .../Services/LocationsService.cs | 2 +- .../Locations.API/Locations.API.csproj | 22 +------ .../Location/Locations.API/Model/Locations.cs | 2 +- .../Location/Locations.API/Program.cs | 21 ++++-- .../Location/Locations.API/Startup.cs | 59 +++++------------ .../ViewModel/LocationRequest.cs | 7 +- .../Marketing.API/Marketing.API.csproj | 28 +------- .../Marketing/Marketing.API/Program.cs | 21 ++++-- .../Marketing/Marketing.API/Startup.cs | 66 +++++++------------ 11 files changed, 80 insertions(+), 156 deletions(-) diff --git a/src/Services/Location/Locations.API/Controllers/HomeController.cs b/src/Services/Location/Locations.API/Controllers/HomeController.cs index e7cea3cca..15cb07404 100644 --- a/src/Services/Location/Locations.API/Controllers/HomeController.cs +++ b/src/Services/Location/Locations.API/Controllers/HomeController.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc; // For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 diff --git a/src/Services/Location/Locations.API/Infrastructure/Repositories/ILocationsRepository.cs b/src/Services/Location/Locations.API/Infrastructure/Repositories/ILocationsRepository.cs index e2d7f9ea2..cd50fa987 100644 --- a/src/Services/Location/Locations.API/Infrastructure/Repositories/ILocationsRepository.cs +++ b/src/Services/Location/Locations.API/Infrastructure/Repositories/ILocationsRepository.cs @@ -1,9 +1,9 @@ namespace Microsoft.eShopOnContainers.Services.Locations.API.Infrastructure.Repositories { using Microsoft.eShopOnContainers.Services.Locations.API.Model; - using ViewModel; using System.Collections.Generic; using System.Threading.Tasks; + using ViewModel; public interface ILocationsRepository { diff --git a/src/Services/Location/Locations.API/Infrastructure/Services/LocationsService.cs b/src/Services/Location/Locations.API/Infrastructure/Services/LocationsService.cs index 81bc16489..771a075d2 100644 --- a/src/Services/Location/Locations.API/Infrastructure/Services/LocationsService.cs +++ b/src/Services/Location/Locations.API/Infrastructure/Services/LocationsService.cs @@ -1,9 +1,9 @@ namespace Microsoft.eShopOnContainers.Services.Locations.API.Infrastructure.Services { - using Microsoft.eShopOnContainers.Services.Locations.API.IntegrationEvents.Events; using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions; using Microsoft.eShopOnContainers.Services.Locations.API.Infrastructure.Exceptions; using Microsoft.eShopOnContainers.Services.Locations.API.Infrastructure.Repositories; + using Microsoft.eShopOnContainers.Services.Locations.API.IntegrationEvents.Events; using Microsoft.eShopOnContainers.Services.Locations.API.Model; using Microsoft.eShopOnContainers.Services.Locations.API.ViewModel; using System; diff --git a/src/Services/Location/Locations.API/Locations.API.csproj b/src/Services/Location/Locations.API/Locations.API.csproj index 90588c8f7..b1b322708 100644 --- a/src/Services/Location/Locations.API/Locations.API.csproj +++ b/src/Services/Location/Locations.API/Locations.API.csproj @@ -11,22 +11,7 @@ - - - - - - - - - - - - - - - - + @@ -35,10 +20,7 @@ - - - - + diff --git a/src/Services/Location/Locations.API/Model/Locations.cs b/src/Services/Location/Locations.API/Model/Locations.cs index df521b9b7..7c0580fc6 100644 --- a/src/Services/Location/Locations.API/Model/Locations.cs +++ b/src/Services/Location/Locations.API/Model/Locations.cs @@ -1,9 +1,9 @@ namespace Microsoft.eShopOnContainers.Services.Locations.API.Model { using MongoDB.Bson; + using MongoDB.Bson.Serialization.Attributes; using MongoDB.Driver.GeoJsonObjectModel; using System.Collections.Generic; - using MongoDB.Bson.Serialization.Attributes; public class Locations { diff --git a/src/Services/Location/Locations.API/Program.cs b/src/Services/Location/Locations.API/Program.cs index 8a4a486cb..7ebc0ab8a 100644 --- a/src/Services/Location/Locations.API/Program.cs +++ b/src/Services/Location/Locations.API/Program.cs @@ -1,6 +1,8 @@ -using System.IO; +using Microsoft.AspNetCore; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Logging; +using System.IO; namespace Microsoft.eShopOnContainers.Services.Locations.API { @@ -8,14 +10,19 @@ namespace Microsoft.eShopOnContainers.Services.Locations.API { public static void Main(string[] args) { - var host = new WebHostBuilder() - .UseKestrel() + BuildWebHost(args).Run(); + } + + public static IWebHost BuildWebHost(string[] args) => + WebHost.CreateDefaultBuilder(args) .UseHealthChecks("/hc") .UseContentRoot(Directory.GetCurrentDirectory()) .UseStartup() - .Build(); - - host.Run(); - } + .ConfigureLogging((hostingContext, builder) => + { + builder.AddConfiguration(hostingContext.Configuration.GetSection("Logging")); + builder.AddConsole(); + builder.AddDebug(); + }).Build(); } } diff --git a/src/Services/Location/Locations.API/Startup.cs b/src/Services/Location/Locations.API/Startup.cs index 34fd8cb75..7d235ed0f 100644 --- a/src/Services/Location/Locations.API/Startup.cs +++ b/src/Services/Location/Locations.API/Startup.cs @@ -3,58 +3,51 @@ using Autofac.Extensions.DependencyInjection; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; +using Microsoft.Azure.ServiceBus; using Microsoft.eShopOnContainers.BuildingBlocks.EventBus; using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions; using Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ; +using Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus; using Microsoft.eShopOnContainers.Services.Locations.API.Infrastructure; using Microsoft.eShopOnContainers.Services.Locations.API.Infrastructure.Filters; using Microsoft.eShopOnContainers.Services.Locations.API.Infrastructure.Repositories; using Microsoft.eShopOnContainers.Services.Locations.API.Infrastructure.Services; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.HealthChecks; using Microsoft.Extensions.Logging; using RabbitMQ.Client; -using System.Reflection; -using System; -using Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus; -using Microsoft.Azure.ServiceBus; -using System.Collections.Generic; using Swashbuckle.AspNetCore.Swagger; -using Microsoft.Extensions.HealthChecks; +using System; +using System.Collections.Generic; using System.Threading.Tasks; namespace Microsoft.eShopOnContainers.Services.Locations.API { public class Startup { - public IConfigurationRoot Configuration { get; } - - public Startup(IHostingEnvironment env) + public Startup(IConfiguration configuration) { - var builder = new ConfigurationBuilder() - .SetBasePath(env.ContentRootPath) - .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) - .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true); - - if (env.IsDevelopment()) - { - builder.AddUserSecrets(typeof(Startup).GetTypeInfo().Assembly); - } - - builder.AddEnvironmentVariables(); - - Configuration = builder.Build(); + Configuration = configuration; } - // This method gets called by the runtime. Use this method to add services to the container. + public IConfiguration Configuration { get; } + public IServiceProvider ConfigureServices(IServiceCollection services) { - // Add framework services. services.AddMvc(options => { options.Filters.Add(typeof(HttpGlobalExceptionFilter)); }).AddControllersAsServices(); + services.AddAuthentication() + .AddJwtBearer(options => + { + options.Authority = Configuration.GetValue("IdentityUrl"); + options.Audience = "locations"; + options.RequireHttpsMetadata = false; + }); + services.Configure(Configuration); if (Configuration.GetValue("AzureServiceBusEnabled")) @@ -143,14 +136,9 @@ namespace Microsoft.eShopOnContainers.Services.Locations.API // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { - //Configure logs - - loggerFactory.AddConsole(Configuration.GetSection("Logging")); - loggerFactory.AddDebug(); - app.UseCors("CorsPolicy"); - ConfigureAuth(app); + app.UseAuthentication(); app.UseMvcWithDefaultRoute(); @@ -165,17 +153,6 @@ namespace Microsoft.eShopOnContainers.Services.Locations.API .Wait(); } - protected virtual void ConfigureAuth(IApplicationBuilder app) - { - var identityUrl = Configuration.GetValue("IdentityUrl"); - app.UseIdentityServerAuthentication(new IdentityServerAuthenticationOptions - { - Authority = identityUrl.ToString(), - ApiName = "locations", - RequireHttpsMetadata = false - }); - } - private void RegisterEventBus(IServiceCollection services) { if (Configuration.GetValue("AzureServiceBusEnabled")) diff --git a/src/Services/Location/Locations.API/ViewModel/LocationRequest.cs b/src/Services/Location/Locations.API/ViewModel/LocationRequest.cs index 8619bfc0f..5301cee87 100644 --- a/src/Services/Location/Locations.API/ViewModel/LocationRequest.cs +++ b/src/Services/Location/Locations.API/ViewModel/LocationRequest.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace Microsoft.eShopOnContainers.Services.Locations.API.ViewModel +namespace Microsoft.eShopOnContainers.Services.Locations.API.ViewModel { public class LocationRequest { diff --git a/src/Services/Marketing/Marketing.API/Marketing.API.csproj b/src/Services/Marketing/Marketing.API/Marketing.API.csproj index 71adef034..b834eab2d 100644 --- a/src/Services/Marketing/Marketing.API/Marketing.API.csproj +++ b/src/Services/Marketing/Marketing.API/Marketing.API.csproj @@ -18,28 +18,7 @@ - - - - - - - - - - - - - - - - - - - - - - + @@ -47,10 +26,7 @@ - - - - + diff --git a/src/Services/Marketing/Marketing.API/Program.cs b/src/Services/Marketing/Marketing.API/Program.cs index dbde65b27..197573518 100644 --- a/src/Services/Marketing/Marketing.API/Program.cs +++ b/src/Services/Marketing/Marketing.API/Program.cs @@ -1,21 +1,28 @@ namespace Microsoft.eShopOnContainers.Services.Marketing.API { - using System.IO; using AspNetCore.Hosting; + using Microsoft.AspNetCore; + using Microsoft.Extensions.Logging; + using System.IO; public class Program { public static void Main(string[] args) { - var host = new WebHostBuilder() - .UseKestrel() + BuildWebHost(args).Run(); + } + + public static IWebHost BuildWebHost(string[] args) => + WebHost.CreateDefaultBuilder(args) .UseHealthChecks("/hc") .UseContentRoot(Directory.GetCurrentDirectory()) .UseStartup() .UseWebRoot("Pics") - .Build(); - - host.Run(); - } + .ConfigureLogging((hostingContext, builder) => + { + builder.AddConfiguration(hostingContext.Configuration.GetSection("Logging")); + builder.AddConsole(); + builder.AddDebug(); + }).Build(); } } diff --git a/src/Services/Marketing/Marketing.API/Startup.cs b/src/Services/Marketing/Marketing.API/Startup.cs index e5fa1a451..3a7eab78a 100644 --- a/src/Services/Marketing/Marketing.API/Startup.cs +++ b/src/Services/Marketing/Marketing.API/Startup.cs @@ -1,58 +1,45 @@ namespace Microsoft.eShopOnContainers.Services.Marketing.API { - using Autofac; - using Autofac.Extensions.DependencyInjection; - using IntegrationEvents.Events; using AspNetCore.Builder; using AspNetCore.Hosting; using AspNetCore.Http; + using Autofac; + using Autofac.Extensions.DependencyInjection; using Azure.ServiceBus; - using EntityFrameworkCore; - using EntityFrameworkCore.Infrastructure; using BuildingBlocks.EventBus; using BuildingBlocks.EventBus.Abstractions; using BuildingBlocks.EventBusRabbitMQ; using BuildingBlocks.EventBusServiceBus; + using EntityFrameworkCore; + using Extensions.Configuration; + using Extensions.DependencyInjection; + using Extensions.HealthChecks; + using Extensions.Logging; using Infrastructure; using Infrastructure.Filters; using Infrastructure.Repositories; using Infrastructure.Services; - using Extensions.Configuration; - using Extensions.DependencyInjection; - using Extensions.Logging; + using IntegrationEvents.Events; + using Marketing.API.IntegrationEvents.Handlers; + using Microsoft.EntityFrameworkCore.Diagnostics; using Polly; using RabbitMQ.Client; + using Swashbuckle.AspNetCore.Swagger; using System; + using System.Collections.Generic; using System.Data.SqlClient; using System.Reflection; using System.Threading.Tasks; - using Extensions.HealthChecks; - using Marketing.API.IntegrationEvents.Handlers; - using Microsoft.EntityFrameworkCore.Diagnostics; - using Swashbuckle.AspNetCore.Swagger; - using System.Collections.Generic; public class Startup { - public Startup(IHostingEnvironment env) + public Startup(IConfiguration configuration) { - var builder = new ConfigurationBuilder() - .SetBasePath(env.ContentRootPath) - .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) - .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true) - .AddEnvironmentVariables(); - - if (env.IsDevelopment()) - { - builder.AddUserSecrets(typeof(Startup).GetTypeInfo().Assembly); - } - - builder.AddEnvironmentVariables(); - - Configuration = builder.Build(); + Configuration = configuration; } - public IConfigurationRoot Configuration { get; } + public IConfiguration Configuration { get; } + // This method gets called by the runtime. Use this method to add services to the container. public IServiceProvider ConfigureServices(IServiceCollection services) @@ -65,6 +52,14 @@ services.Configure(Configuration); + services.AddAuthentication() + .AddJwtBearer(options => + { + options.Authority = Configuration.GetValue("IdentityUrl"); + options.Audience = "marketing"; + options.RequireHttpsMetadata = false; + }); + services.AddHealthChecks(checks => { checks.AddValueTaskCheck("HTTP Endpoint", () => new ValueTask(HealthCheckResult.Healthy("Ok"))); @@ -179,7 +174,7 @@ app.UseCors("CorsPolicy"); - ConfigureAuth(app); + app.UseAuthentication(); app.UseMvcWithDefaultRoute(); @@ -198,17 +193,6 @@ ConfigureEventBus(app); } - protected virtual void ConfigureAuth(IApplicationBuilder app) - { - var identityUrl = Configuration.GetValue("IdentityUrl"); - app.UseIdentityServerAuthentication(new IdentityServerAuthenticationOptions - { - Authority = identityUrl.ToString(), - ApiName = "marketing", - RequireHttpsMetadata = false - }); - } - private void RegisterEventBus(IServiceCollection services) { if (Configuration.GetValue("AzureServiceBusEnabled")) From 0c41218c2c23439c824d9c6549ce42f2f55d8614 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ram=C3=B3n=20Tom=C3=A1s?= Date: Tue, 29 Aug 2017 11:02:18 +0200 Subject: [PATCH 38/64] Include aspnetcore.all metapackage --- .../Ordering/Ordering.API/Ordering.API.csproj | 25 ++--------------- src/Services/Ordering/Ordering.API/Program.cs | 16 ++++------- src/Services/Ordering/Ordering.API/Startup.cs | 28 +++++++++++++------ 3 files changed, 29 insertions(+), 40 deletions(-) diff --git a/src/Services/Ordering/Ordering.API/Ordering.API.csproj b/src/Services/Ordering/Ordering.API/Ordering.API.csproj index ce6a77ca6..4b02a4abd 100644 --- a/src/Services/Ordering/Ordering.API/Ordering.API.csproj +++ b/src/Services/Ordering/Ordering.API/Ordering.API.csproj @@ -36,32 +36,13 @@ - - - - - - - - - - - - - - - - - - - + - - - + + diff --git a/src/Services/Ordering/Ordering.API/Program.cs b/src/Services/Ordering/Ordering.API/Program.cs index ba92a2da9..3ee6f6500 100644 --- a/src/Services/Ordering/Ordering.API/Program.cs +++ b/src/Services/Ordering/Ordering.API/Program.cs @@ -1,6 +1,5 @@ -using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore; using Microsoft.AspNetCore.Hosting; -using System.IO; namespace Microsoft.eShopOnContainers.Services.Ordering.API { @@ -8,15 +7,12 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API { public static void Main(string[] args) { - var host = new WebHostBuilder() - .UseKestrel() - .UseHealthChecks("/hc") - .UseContentRoot(Directory.GetCurrentDirectory()) - .UseIISIntegration() + BuildWebHost(args).Run(); + } + + public static IWebHost BuildWebHost(string[] args) => + WebHost.CreateDefaultBuilder(args) .UseStartup() .Build(); - - host.Run(); - } } } diff --git a/src/Services/Ordering/Ordering.API/Startup.cs b/src/Services/Ordering/Ordering.API/Startup.cs index 3f2bbe43b..c793a3950 100644 --- a/src/Services/Ordering/Ordering.API/Startup.cs +++ b/src/Services/Ordering/Ordering.API/Startup.cs @@ -11,6 +11,7 @@ using Infrastructure.AutofacModules; using Infrastructure.Filters; using Infrastructure.Services; + using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Azure.ServiceBus; @@ -170,7 +171,7 @@ } RegisterEventBus(services); - + ConfigureAuthService(services); services.AddOptions(); //configure autofac @@ -225,22 +226,33 @@ eventBus.Subscribe>(); } - protected virtual void ConfigureAuth(IApplicationBuilder app) + private void ConfigureAuthService(IServiceCollection services) { var identityUrl = Configuration.GetValue("IdentityUrl"); - app.UseIdentityServerAuthentication(new IdentityServerAuthenticationOptions + + services.AddAuthentication(options => { - Authority = identityUrl.ToString(), - ApiName = "orders", - RequireHttpsMetadata = false + options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme; + options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme; + + }).AddJwtBearer(options => + { + options.Authority = identityUrl; + options.RequireHttpsMetadata = false; + options.Audience = "orders"; }); } + protected virtual void ConfigureAuth(IApplicationBuilder app) + { + app.UseAuthentication(); + } + private void RegisterEventBus(IServiceCollection services) { if (Configuration.GetValue("AzureServiceBusEnabled")) { - services.AddSingleton(sp => + services.AddSingleton(sp => { var serviceBusPersisterConnection = sp.GetRequiredService(); var iLifetimeScope = sp.GetRequiredService(); @@ -254,7 +266,7 @@ } else { - services.AddSingleton(); + services.AddSingleton(); } services.AddSingleton(); From c4454b005b05e0c5fad673d771c249b8ea5ee73a Mon Sep 17 00:00:00 2001 From: Unai Zorrilla Castro Date: Tue, 29 Aug 2017 11:17:09 +0200 Subject: [PATCH 39/64] Migrated Payment.API to .NETCoreApp2.0. Update Startup and Program to new template. Minor refactorings. Remove unused PaymentController.cs --- .../Marketing/Marketing.API/Startup.cs | 5 +- .../Controllers/PaymentController.cs | 46 ------------------- ...ToStockConfirmedIntegrationEventHandler.cs | 8 ++-- .../Payment/Payment.API/Payment.API.csproj | 12 +---- src/Services/Payment/Payment.API/Program.cs | 22 ++++++--- src/Services/Payment/Payment.API/Startup.cs | 37 ++++++--------- 6 files changed, 38 insertions(+), 92 deletions(-) delete mode 100644 src/Services/Payment/Payment.API/Controllers/PaymentController.cs diff --git a/src/Services/Marketing/Marketing.API/Startup.cs b/src/Services/Marketing/Marketing.API/Startup.cs index 3a7eab78a..952594556 100644 --- a/src/Services/Marketing/Marketing.API/Startup.cs +++ b/src/Services/Marketing/Marketing.API/Startup.cs @@ -167,11 +167,8 @@ } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. - public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) + public void Configure(IApplicationBuilder app, IHostingEnvironment env,ILoggerFactory loggerFactory) { - loggerFactory.AddConsole(Configuration.GetSection("Logging")); - loggerFactory.AddDebug(); - app.UseCors("CorsPolicy"); app.UseAuthentication(); diff --git a/src/Services/Payment/Payment.API/Controllers/PaymentController.cs b/src/Services/Payment/Payment.API/Controllers/PaymentController.cs deleted file mode 100644 index 60ccca2a6..000000000 --- a/src/Services/Payment/Payment.API/Controllers/PaymentController.cs +++ /dev/null @@ -1,46 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc; - -// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 - -namespace Payment.API.Controllers -{ - [Route("api/v1/[controller]")] - public class PaymentController : Controller - { - // GET: api/values - [HttpGet] - public IEnumerable Get() - { - return new string[] { "value1", "value2" }; - } - - // GET api/values/5 - [HttpGet("{id}")] - public string Get(int id) - { - return "value"; - } - - // POST api/values - [HttpPost] - public void Post([FromBody]string value) - { - } - - // PUT api/values/5 - [HttpPut("{id}")] - public void Put(int id, [FromBody]string value) - { - } - - // DELETE api/values/5 - [HttpDelete("{id}")] - public void Delete(int id) - { - } - } -} diff --git a/src/Services/Payment/Payment.API/IntegrationEvents/EventHandling/OrderStatusChangedToStockConfirmedIntegrationEventHandler.cs b/src/Services/Payment/Payment.API/IntegrationEvents/EventHandling/OrderStatusChangedToStockConfirmedIntegrationEventHandler.cs index bf2e4c1ca..c70a32093 100644 --- a/src/Services/Payment/Payment.API/IntegrationEvents/EventHandling/OrderStatusChangedToStockConfirmedIntegrationEventHandler.cs +++ b/src/Services/Payment/Payment.API/IntegrationEvents/EventHandling/OrderStatusChangedToStockConfirmedIntegrationEventHandler.cs @@ -1,10 +1,10 @@ namespace Payment.API.IntegrationEvents.EventHandling { using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions; - using System.Threading.Tasks; - using Payment.API.IntegrationEvents.Events; - using Microsoft.Extensions.Options; using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events; + using Microsoft.Extensions.Options; + using Payment.API.IntegrationEvents.Events; + using System.Threading.Tasks; public class OrderStatusChangedToStockConfirmedIntegrationEventHandler : IIntegrationEventHandler @@ -39,6 +39,8 @@ } _eventBus.Publish(orderPaymentIntegrationEvent); + + await Task.CompletedTask; } } } \ No newline at end of file diff --git a/src/Services/Payment/Payment.API/Payment.API.csproj b/src/Services/Payment/Payment.API/Payment.API.csproj index 46f2d81b9..49dd3d149 100644 --- a/src/Services/Payment/Payment.API/Payment.API.csproj +++ b/src/Services/Payment/Payment.API/Payment.API.csproj @@ -11,19 +11,11 @@ - - - - - - - - - + - + diff --git a/src/Services/Payment/Payment.API/Program.cs b/src/Services/Payment/Payment.API/Program.cs index 8ad35dce2..c45d786b9 100644 --- a/src/Services/Payment/Payment.API/Program.cs +++ b/src/Services/Payment/Payment.API/Program.cs @@ -1,6 +1,8 @@ -using System.IO; +using Microsoft.AspNetCore; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Logging; +using System.IO; namespace Payment.API { @@ -8,13 +10,19 @@ namespace Payment.API { public static void Main(string[] args) { - var host = new WebHostBuilder() - .UseKestrel() + BuildWebHost(args).Run(); + } + + public static IWebHost BuildWebHost(string[] args) => + WebHost.CreateDefaultBuilder(args) + .UseContentRoot(Directory.GetCurrentDirectory()) .UseStartup() - .Build(); - - host.Run(); - } + .ConfigureLogging((hostingContext, builder) => + { + builder.AddConfiguration(hostingContext.Configuration.GetSection("Logging")); + builder.AddConsole(); + builder.AddDebug(); + }).Build(); } } diff --git a/src/Services/Payment/Payment.API/Startup.cs b/src/Services/Payment/Payment.API/Startup.cs index 9cba1415d..5e87c4e19 100644 --- a/src/Services/Payment/Payment.API/Startup.cs +++ b/src/Services/Payment/Payment.API/Startup.cs @@ -2,41 +2,38 @@ using Autofac.Extensions.DependencyInjection; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; +using Microsoft.Azure.ServiceBus; +using Microsoft.eShopOnContainers.BuildingBlocks.EventBus; +using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions; +using Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ; +using Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; -using System; -using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions; -using Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ; -using RabbitMQ.Client; -using Microsoft.eShopOnContainers.BuildingBlocks.EventBus; -using Payment.API.IntegrationEvents.Events; using Payment.API.IntegrationEvents.EventHandling; -using Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus; -using Microsoft.Azure.ServiceBus; +using Payment.API.IntegrationEvents.Events; +using RabbitMQ.Client; +using System; namespace Payment.API { public class Startup { - public Startup(IHostingEnvironment env) + public Startup(IConfiguration configuration) { - var builder = new ConfigurationBuilder() - .SetBasePath(env.ContentRootPath) - .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) - .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true) - .AddEnvironmentVariables(); - Configuration = builder.Build(); + Configuration = configuration; } - public IConfigurationRoot Configuration { get; } + public IConfiguration Configuration { get; } // This method gets called by the runtime. Use this method to add services to the container. public IServiceProvider ConfigureServices(IServiceCollection services) { // Add framework services. services.AddMvc(); + services.Configure(Configuration); + if (Configuration.GetValue("AzureServiceBusEnabled")) { services.AddSingleton(sp => @@ -84,14 +81,10 @@ namespace Payment.API } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. - public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) - { - loggerFactory.AddConsole(Configuration.GetSection("Logging")); - loggerFactory.AddDebug(); - + public void Configure(IApplicationBuilder app, IHostingEnvironment env) + { app.UseMvcWithDefaultRoute(); - app.UseSwagger() .UseSwaggerUI(c => { From 116d5b55bb142b959e9d7607893b2a21f30fdc0b Mon Sep 17 00:00:00 2001 From: Unai Zorrilla Castro Date: Tue, 29 Aug 2017 11:28:21 +0200 Subject: [PATCH 40/64] Updated Startup and Program to use new .NETCoreApp2.0 templates.Minor Refactorings --- .../WebStatus/Controllers/HomeController.cs | 9 +++---- .../HealthCheckBuilderExtensions.cs | 4 ---- src/Web/WebStatus/Program.cs | 24 ++++++++++++------- src/Web/WebStatus/Startup.cs | 18 +++++--------- .../Viewmodels/HealthStatusViewModel.cs | 9 +++---- .../WebStatus/Viewmodels/NamedCheckResult.cs | 5 +--- 6 files changed, 30 insertions(+), 39 deletions(-) diff --git a/src/Web/WebStatus/Controllers/HomeController.cs b/src/Web/WebStatus/Controllers/HomeController.cs index cd59c44d2..7f139843a 100644 --- a/src/Web/WebStatus/Controllers/HomeController.cs +++ b/src/Web/WebStatus/Controllers/HomeController.cs @@ -1,10 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.Options; +using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.HealthChecks; +using System.Threading.Tasks; using WebStatus.Viewmodels; namespace WebStatus.Controllers @@ -29,6 +25,7 @@ namespace WebStatus.Controllers } ViewBag.RefreshSeconds = 60; + return View(data); } diff --git a/src/Web/WebStatus/Extensions/HealthCheckBuilderExtensions.cs b/src/Web/WebStatus/Extensions/HealthCheckBuilderExtensions.cs index c0655b753..a6076df52 100644 --- a/src/Web/WebStatus/Extensions/HealthCheckBuilderExtensions.cs +++ b/src/Web/WebStatus/Extensions/HealthCheckBuilderExtensions.cs @@ -1,8 +1,5 @@ using Microsoft.Extensions.HealthChecks; using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; namespace WebStatus.Extensions { @@ -17,6 +14,5 @@ namespace WebStatus.Extensions return builder; } - } } diff --git a/src/Web/WebStatus/Program.cs b/src/Web/WebStatus/Program.cs index f0df7ee22..6a895f9e7 100644 --- a/src/Web/WebStatus/Program.cs +++ b/src/Web/WebStatus/Program.cs @@ -1,5 +1,7 @@ -using System.IO; +using Microsoft.AspNetCore; using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Logging; +using System.IO; namespace WebStatus { @@ -7,14 +9,18 @@ namespace WebStatus { public static void Main(string[] args) { - var host = new WebHostBuilder() - .UseKestrel() - .UseContentRoot(Directory.GetCurrentDirectory()) - .UseIISIntegration() - .UseStartup() - .Build(); - - host.Run(); + BuildWebHost(args).Run(); } + + public static IWebHost BuildWebHost(string[] args) => + WebHost.CreateDefaultBuilder(args) + .UseContentRoot(Directory.GetCurrentDirectory()) + .UseStartup() + .ConfigureLogging((hostingContext, builder) => + { + builder.AddConfiguration(hostingContext.Configuration.GetSection("Logging")); + builder.AddConsole(); + builder.AddDebug(); + }).Build(); } } diff --git a/src/Web/WebStatus/Startup.cs b/src/Web/WebStatus/Startup.cs index 244f81787..eb559acd9 100644 --- a/src/Web/WebStatus/Startup.cs +++ b/src/Web/WebStatus/Startup.cs @@ -13,22 +13,18 @@ namespace WebStatus { public class Startup { - public Startup(IHostingEnvironment env) + public Startup(IConfiguration configuration) { - var builder = new ConfigurationBuilder() - .SetBasePath(env.ContentRootPath) - .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) - .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true) - .AddEnvironmentVariables(); - Configuration = builder.Build(); + Configuration = configuration; } - public IConfigurationRoot Configuration { get; } + public IConfiguration Configuration { get; } // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddOptions(); + // Add framework services. services.AddHealthChecks(checks => { @@ -47,15 +43,13 @@ namespace WebStatus checks.AddUrlCheckIfNotNull(Configuration["mvc"], TimeSpan.FromMinutes(minutes)); checks.AddUrlCheckIfNotNull(Configuration["spa"], TimeSpan.FromMinutes(minutes)); }); + services.AddMvc(); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. - public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) + public void Configure(IApplicationBuilder app, IHostingEnvironment env) { - loggerFactory.AddConsole(Configuration.GetSection("Logging")); - loggerFactory.AddDebug(); - if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); diff --git a/src/Web/WebStatus/Viewmodels/HealthStatusViewModel.cs b/src/Web/WebStatus/Viewmodels/HealthStatusViewModel.cs index d30acc460..08126ce4f 100644 --- a/src/Web/WebStatus/Viewmodels/HealthStatusViewModel.cs +++ b/src/Web/WebStatus/Viewmodels/HealthStatusViewModel.cs @@ -1,22 +1,23 @@ using Microsoft.Extensions.HealthChecks; -using System; using System.Collections.Generic; using System.Linq; -using System.Threading.Tasks; namespace WebStatus.Viewmodels { public class HealthStatusViewModel { private readonly CheckStatus _overall; + private readonly Dictionary _results; public CheckStatus OverallStatus => _overall; + public IEnumerable Results => _results.Select(kvp => new NamedCheckResult(kvp.Key, kvp.Value)); + private HealthStatusViewModel() => _results = new Dictionary(); + public HealthStatusViewModel(CheckStatus overall) : this() => _overall = overall; + public void AddResult(string name, IHealthCheckResult result) => _results.Add(name, result); - - } } diff --git a/src/Web/WebStatus/Viewmodels/NamedCheckResult.cs b/src/Web/WebStatus/Viewmodels/NamedCheckResult.cs index e856504c7..f6a9cd316 100644 --- a/src/Web/WebStatus/Viewmodels/NamedCheckResult.cs +++ b/src/Web/WebStatus/Viewmodels/NamedCheckResult.cs @@ -1,14 +1,11 @@ using Microsoft.Extensions.HealthChecks; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; namespace WebStatus.Viewmodels { public class NamedCheckResult { public string Name { get; } + public IHealthCheckResult Result { get; } public NamedCheckResult(string name, IHealthCheckResult result) From acefa6446597d732ba547088ac2d4953cd2ca89f Mon Sep 17 00:00:00 2001 From: Unai Zorrilla Castro Date: Tue, 29 Aug 2017 11:40:23 +0200 Subject: [PATCH 41/64] Updated Program and Startup to new .NETCoreApp2.0 templates. Minor refactorings --- src/Web/WebMVC/Program.cs | 26 ++++++++++++++++---------- src/Web/WebMVC/Startup.cs | 14 +++++--------- src/Web/WebMVC/WebMVC.csproj | 27 ++++----------------------- 3 files changed, 25 insertions(+), 42 deletions(-) diff --git a/src/Web/WebMVC/Program.cs b/src/Web/WebMVC/Program.cs index 654ae7677..ec711b2ae 100644 --- a/src/Web/WebMVC/Program.cs +++ b/src/Web/WebMVC/Program.cs @@ -1,4 +1,6 @@ -using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Logging; using System.IO; namespace Microsoft.eShopOnContainers.WebMVC @@ -7,15 +9,19 @@ namespace Microsoft.eShopOnContainers.WebMVC { public static void Main(string[] args) { - var host = new WebHostBuilder() - .UseKestrel() - .UseHealthChecks("/hc") - .UseContentRoot(Directory.GetCurrentDirectory()) - .UseIISIntegration() - .UseStartup() - .Build(); - - host.Run(); + BuildWebHost(args).Run(); } + + public static IWebHost BuildWebHost(string[] args) => + WebHost.CreateDefaultBuilder(args) + .UseContentRoot(Directory.GetCurrentDirectory()) + .UseHealthChecks("/hc") + .UseStartup() + .ConfigureLogging((hostingContext, builder) => + { + builder.AddConfiguration(hostingContext.Configuration.GetSection("Logging")); + builder.AddConsole(); + builder.AddDebug(); + }).Build(); } } diff --git a/src/Web/WebMVC/Startup.cs b/src/Web/WebMVC/Startup.cs index ebf303f1b..1791e8da1 100644 --- a/src/Web/WebMVC/Startup.cs +++ b/src/Web/WebMVC/Startup.cs @@ -20,17 +20,12 @@ namespace Microsoft.eShopOnContainers.WebMVC { public class Startup { - public Startup(IHostingEnvironment env) + public Startup(IConfiguration configuration) { - var builder = new ConfigurationBuilder() - .SetBasePath(env.ContentRootPath) - .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) // Settings for the application - .AddEnvironmentVariables(); // override settings with environment variables set in compose. - - Configuration = builder.Build(); + Configuration = configuration; } - public IConfigurationRoot Configuration { get; } + public IConfiguration Configuration { get; } // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) @@ -135,7 +130,8 @@ namespace Microsoft.eShopOnContainers.WebMVC app.UseAuthentication(); var log = loggerFactory.CreateLogger("identity"); - WebContextSeed.Seed(app, env, loggerFactory); + + WebContextSeed.Seed(app, env, loggerFactory); app.UseMvc(routes => { diff --git a/src/Web/WebMVC/WebMVC.csproj b/src/Web/WebMVC/WebMVC.csproj index e6e11cb99..7f45a64f9 100644 --- a/src/Web/WebMVC/WebMVC.csproj +++ b/src/Web/WebMVC/WebMVC.csproj @@ -36,27 +36,8 @@ --> - - - - - - - - - - - - - - - - - - - - - + + @@ -66,8 +47,8 @@ - - + + From 364c07a528f2c9d0b3be93127e335cdc953effcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ram=C3=B3n=20Tom=C3=A1s?= Date: Tue, 29 Aug 2017 12:03:20 +0200 Subject: [PATCH 42/64] Included AspnetCore.all metapackage --- ...xtensions.HealthChecks.AzureStorage.csproj | 1 - .../Catalog/Catalog.API/Catalog.API.csproj | 24 ++------------- src/Services/Catalog/Catalog.API/Program.cs | 30 +++++++++++-------- .../Ordering/Ordering.API/Ordering.API.csproj | 2 +- src/Services/Ordering/Ordering.API/Program.cs | 10 +++++++ src/Web/WebSPA/WebSPA.csproj | 1 + 6 files changed, 32 insertions(+), 36 deletions(-) diff --git a/src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks.AzureStorage/Microsoft.Extensions.HealthChecks.AzureStorage.csproj b/src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks.AzureStorage/Microsoft.Extensions.HealthChecks.AzureStorage.csproj index 110ef7497..0007d0be6 100644 --- a/src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks.AzureStorage/Microsoft.Extensions.HealthChecks.AzureStorage.csproj +++ b/src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks.AzureStorage/Microsoft.Extensions.HealthChecks.AzureStorage.csproj @@ -2,7 +2,6 @@ netstandard2.0 - $(PackageTargetFallback);net46 false false false diff --git a/src/Services/Catalog/Catalog.API/Catalog.API.csproj b/src/Services/Catalog/Catalog.API/Catalog.API.csproj index 3257ea917..7f55b6432 100644 --- a/src/Services/Catalog/Catalog.API/Catalog.API.csproj +++ b/src/Services/Catalog/Catalog.API/Catalog.API.csproj @@ -7,7 +7,6 @@ Catalog.API Catalog.API aspnet-Catalog.API-20161122013618 - $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; ..\..\..\..\docker-compose.dcproj @@ -33,32 +32,13 @@ - - - - - - - - - - - - - - - - - - - - + - + diff --git a/src/Services/Catalog/Catalog.API/Program.cs b/src/Services/Catalog/Catalog.API/Program.cs index 93c151cf2..2de3600b9 100644 --- a/src/Services/Catalog/Catalog.API/Program.cs +++ b/src/Services/Catalog/Catalog.API/Program.cs @@ -1,5 +1,6 @@ -using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore; using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Logging; using System.IO; namespace Microsoft.eShopOnContainers.Services.Catalog.API @@ -8,16 +9,21 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API { public static void Main(string[] args) { - var host = new WebHostBuilder() - .UseKestrel() - .UseHealthChecks("/hc") - .UseIISIntegration() - .UseContentRoot(Directory.GetCurrentDirectory()) - .UseWebRoot("Pics") - .UseStartup() - .Build(); - - host.Run(); + BuildWebHost(args).Run(); } + + public static IWebHost BuildWebHost(string[] args) => + WebHost.CreateDefaultBuilder(args) + .UseStartup() + .UseHealthChecks("/hc") + .UseContentRoot(Directory.GetCurrentDirectory()) + .UseWebRoot("Pics") + .ConfigureLogging((hostingContext, builder) => + { + builder.AddConfiguration(hostingContext.Configuration.GetSection("Logging")); + builder.AddConsole(); + builder.AddDebug(); + }) + .Build(); } -} +} \ No newline at end of file diff --git a/src/Services/Ordering/Ordering.API/Ordering.API.csproj b/src/Services/Ordering/Ordering.API/Ordering.API.csproj index 4b02a4abd..80ea309d8 100644 --- a/src/Services/Ordering/Ordering.API/Ordering.API.csproj +++ b/src/Services/Ordering/Ordering.API/Ordering.API.csproj @@ -46,7 +46,7 @@ - + diff --git a/src/Services/Ordering/Ordering.API/Program.cs b/src/Services/Ordering/Ordering.API/Program.cs index 3ee6f6500..382ba2594 100644 --- a/src/Services/Ordering/Ordering.API/Program.cs +++ b/src/Services/Ordering/Ordering.API/Program.cs @@ -1,5 +1,7 @@ using Microsoft.AspNetCore; using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Logging; +using System.IO; namespace Microsoft.eShopOnContainers.Services.Ordering.API { @@ -13,6 +15,14 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API public static IWebHost BuildWebHost(string[] args) => WebHost.CreateDefaultBuilder(args) .UseStartup() + .UseHealthChecks("/hc") + .UseContentRoot(Directory.GetCurrentDirectory()) + .ConfigureLogging((hostingContext, builder) => + { + builder.AddConfiguration(hostingContext.Configuration.GetSection("Logging")); + builder.AddConsole(); + builder.AddDebug(); + }) .Build(); } } diff --git a/src/Web/WebSPA/WebSPA.csproj b/src/Web/WebSPA/WebSPA.csproj index 1e3b2630a..e4447a126 100644 --- a/src/Web/WebSPA/WebSPA.csproj +++ b/src/Web/WebSPA/WebSPA.csproj @@ -28,6 +28,7 @@ + From cd78d98436c1b3209838f929dbea3f58cde522e3 Mon Sep 17 00:00:00 2001 From: Unai Zorrilla Castro Date: Tue, 29 Aug 2017 12:12:45 +0200 Subject: [PATCH 43/64] Updated Identity.API to preview version of IdentityServer4, Fix breaking changes. Not well tested --- .../Controllers/AccountController.cs | 28 +++++++------- .../Identity/Identity.API/Identity.API.csproj | 38 ++++--------------- .../Identity.API/Models/ApplicationUser.cs | 6 +-- src/Services/Identity/Identity.API/Program.cs | 26 ++++++++----- src/Services/Identity/Identity.API/Startup.cs | 31 +++++---------- src/Web/WebMVC/WebMVC.csproj | 1 - 6 files changed, 48 insertions(+), 82 deletions(-) diff --git a/src/Services/Identity/Identity.API/Controllers/AccountController.cs b/src/Services/Identity/Identity.API/Controllers/AccountController.cs index 641f39522..6b56b3467 100644 --- a/src/Services/Identity/Identity.API/Controllers/AccountController.cs +++ b/src/Services/Identity/Identity.API/Controllers/AccountController.cs @@ -2,26 +2,24 @@ // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. +using Identity.API.Models; +using Identity.API.Models.AccountViewModels; +using Identity.API.Services; using IdentityModel; -using IdentityServer4.Quickstart.UI.Models; +using IdentityServer4.Models; using IdentityServer4.Services; -using Microsoft.AspNetCore.Http.Authentication; +using IdentityServer4.Stores; +using Microsoft.AspNetCore.Authentication; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; using System; -using System.Collections.Generic; using System.Linq; using System.Security.Claims; using System.Text.Encodings.Web; using System.Threading.Tasks; -using IdentityServer4.Models; -using IdentityServer4.Stores; -using Identity.API.Services; -using Identity.API.Models; -using Microsoft.Extensions.Logging; -using Microsoft.AspNetCore.Authorization; -using Identity.API.Models.AccountViewModels; -using Microsoft.AspNetCore.Identity; -using Microsoft.AspNetCore.Authentication; + namespace IdentityServer4.Quickstart.UI.Controllers { @@ -194,7 +192,7 @@ namespace IdentityServer4.Quickstart.UI.Controllers try { // hack: try/catch to handle social providers that throw - await HttpContext.Authentication.SignOutAsync(idp, new AuthenticationProperties { RedirectUri = url }); + await HttpContext.SignOutAsync(idp, new AuthenticationProperties { RedirectUri = url }); } catch(Exception ex) { @@ -203,7 +201,7 @@ namespace IdentityServer4.Quickstart.UI.Controllers } // delete authentication cookie - await HttpContext.Authentication.SignOutAsync(); + await HttpContext.SignOutAsync(); // set this so UI rendering sees an anonymous user HttpContext.User = new ClaimsPrincipal(new ClaimsIdentity()); @@ -217,7 +215,7 @@ namespace IdentityServer4.Quickstart.UI.Controllers public async Task DeviceLogOut(string redirectUrl) { // delete authentication cookie - await HttpContext.Authentication.SignOutAsync(); + await HttpContext.SignOutAsync(); // set this so UI rendering sees an anonymous user HttpContext.User = new ClaimsPrincipal(new ClaimsIdentity()); diff --git a/src/Services/Identity/Identity.API/Identity.API.csproj b/src/Services/Identity/Identity.API/Identity.API.csproj index 7c221e858..49f9b4c2e 100644 --- a/src/Services/Identity/Identity.API/Identity.API.csproj +++ b/src/Services/Identity/Identity.API/Identity.API.csproj @@ -1,10 +1,10 @@  - netcoreapp1.1 - 1.1.2 + netcoreapp2.0 + 2.0.0 aspnet-eShopOnContainers.Identity-90487118-103c-4ff0-b9da-e5e26f7ab0c5 - $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; + ..\..\..\..\docker-compose.dcproj @@ -16,30 +16,8 @@ - - - - - - - - - - - - All - - - All - - - - - - - - - + + @@ -52,9 +30,9 @@ - - - + + + diff --git a/src/Services/Identity/Identity.API/Models/ApplicationUser.cs b/src/Services/Identity/Identity.API/Models/ApplicationUser.cs index b520c333b..1c1f7bda1 100644 --- a/src/Services/Identity/Identity.API/Models/ApplicationUser.cs +++ b/src/Services/Identity/Identity.API/Models/ApplicationUser.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Identity.EntityFrameworkCore; +using Microsoft.AspNetCore.Identity; using System.ComponentModel.DataAnnotations; namespace Identity.API.Models diff --git a/src/Services/Identity/Identity.API/Program.cs b/src/Services/Identity/Identity.API/Program.cs index 2f731c045..9a035bd93 100644 --- a/src/Services/Identity/Identity.API/Program.cs +++ b/src/Services/Identity/Identity.API/Program.cs @@ -1,4 +1,6 @@ -using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Logging; using System.IO; namespace eShopOnContainers.Identity @@ -7,15 +9,19 @@ namespace eShopOnContainers.Identity { public static void Main(string[] args) { - var host = new WebHostBuilder() - .UseKestrel() - .UseHealthChecks("/hc") - .UseContentRoot(Directory.GetCurrentDirectory()) - .UseIISIntegration() - .UseStartup() - .Build(); - - host.Run(); + BuildWebHost(args).Run(); } + + public static IWebHost BuildWebHost(string[] args) => + WebHost.CreateDefaultBuilder(args) + .UseContentRoot(Directory.GetCurrentDirectory()) + .UseHealthChecks("/hc") + .UseStartup() + .ConfigureLogging((hostingContext, builder) => + { + builder.AddConfiguration(hostingContext.Configuration.GetSection("Logging")); + builder.AddConsole(); + builder.AddDebug(); + }).Build(); } } diff --git a/src/Services/Identity/Identity.API/Startup.cs b/src/Services/Identity/Identity.API/Startup.cs index 5b0a216de..711c4b9c1 100644 --- a/src/Services/Identity/Identity.API/Startup.cs +++ b/src/Services/Identity/Identity.API/Startup.cs @@ -1,4 +1,6 @@ -using Identity.API.Certificate; +using Autofac; +using Autofac.Extensions.DependencyInjection; +using Identity.API.Certificate; using Identity.API.Configuration; using Identity.API.Data; using Identity.API.Models; @@ -9,16 +11,12 @@ using IdentityServer4.Services; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Identity; -using Microsoft.AspNetCore.Identity.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; using Microsoft.eShopOnContainers.BuildingBlocks; using Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.HealthChecks; -using Identity.API.Certificate; -using Autofac.Extensions.DependencyInjection; -using Autofac; using Microsoft.Extensions.Logging; using System; using System.Collections.Generic; @@ -30,24 +28,13 @@ namespace eShopOnContainers.Identity { public class Startup { - public Startup(IHostingEnvironment env) + public Startup(IConfiguration configuration) { - var builder = new ConfigurationBuilder() - .SetBasePath(env.ContentRootPath) - .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) - .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true); - - if (env.IsDevelopment()) - { - // For more details on using the user secret store see http://go.microsoft.com/fwlink/?LinkID=532709 - builder.AddUserSecrets(); - } - - builder.AddEnvironmentVariables(); - Configuration = builder.Build(); + Configuration = configuration; } - public IConfigurationRoot Configuration { get; } + public IConfiguration Configuration { get; } + // This method gets called by the runtime. Use this method to add services to the container. public IServiceProvider ConfigureServices(IServiceCollection services) @@ -136,9 +123,11 @@ namespace eShopOnContainers.Identity await next(); }); - app.UseIdentity(); + // Adds IdentityServer + app.UseAuthentication(); + app.UseIdentityServer(); app.UseMvc(routes => diff --git a/src/Web/WebMVC/WebMVC.csproj b/src/Web/WebMVC/WebMVC.csproj index 7f45a64f9..5e73cdfda 100644 --- a/src/Web/WebMVC/WebMVC.csproj +++ b/src/Web/WebMVC/WebMVC.csproj @@ -37,7 +37,6 @@ - From e20223b6e2376822349a740022d9f8d7ccb3a53b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ram=C3=B3n=20Tom=C3=A1s?= Date: Tue, 29 Aug 2017 12:14:10 +0200 Subject: [PATCH 44/64] Included Aspnetcore.all metapackage --- src/Web/WebSPA/Program.cs | 25 ++++++++++++++++--------- src/Web/WebSPA/Startup.cs | 11 +++++------ src/Web/WebSPA/WebSPA.csproj | 26 +++----------------------- 3 files changed, 24 insertions(+), 38 deletions(-) diff --git a/src/Web/WebSPA/Program.cs b/src/Web/WebSPA/Program.cs index 12c29d8c2..92a6af2da 100644 --- a/src/Web/WebSPA/Program.cs +++ b/src/Web/WebSPA/Program.cs @@ -1,5 +1,7 @@ -using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore; +using Microsoft.AspNetCore.Hosting; using System.IO; +using Microsoft.Extensions.Logging; namespace eShopConContainers.WebSPA { @@ -7,15 +9,20 @@ namespace eShopConContainers.WebSPA { public static void Main(string[] args) { - var host = new WebHostBuilder() - .UseKestrel() + BuildWebHost(args).Run(); + } + + public static IWebHost BuildWebHost(string[] args) => + WebHost.CreateDefaultBuilder(args) + .UseStartup() .UseHealthChecks("/hc") .UseContentRoot(Directory.GetCurrentDirectory()) - .UseIISIntegration() - .UseStartup() - .Build(); - - host.Run(); - } + .ConfigureLogging((hostingContext, builder) => + { + builder.AddConfiguration(hostingContext.Configuration.GetSection("Logging")); + builder.AddConsole(); + builder.AddDebug(); + }) + .Build(); } } diff --git a/src/Web/WebSPA/Startup.cs b/src/Web/WebSPA/Startup.cs index 9eed6dc10..22511c135 100644 --- a/src/Web/WebSPA/Startup.cs +++ b/src/Web/WebSPA/Startup.cs @@ -1,16 +1,15 @@ -using System; -using System.IO; +using eShopOnContainers.WebSPA; using Microsoft.AspNetCore.Antiforgery; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.Http; +using Microsoft.eShopOnContainers.BuildingBlocks; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Logging; using Microsoft.Extensions.HealthChecks; +using Microsoft.Extensions.Logging; using Newtonsoft.Json.Serialization; -using eShopOnContainers.WebSPA; -using Microsoft.eShopOnContainers.BuildingBlocks; +using System; +using System.IO; using WebSPA.Infrastructure; namespace eShopConContainers.WebSPA diff --git a/src/Web/WebSPA/WebSPA.csproj b/src/Web/WebSPA/WebSPA.csproj index e4447a126..1efcb89e6 100644 --- a/src/Web/WebSPA/WebSPA.csproj +++ b/src/Web/WebSPA/WebSPA.csproj @@ -3,7 +3,6 @@ netcoreapp2.0 aspnetcorespa-c23d27a4-eb88-4b18-9b77-2a93f3b15119 - $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; ..\..\..\docker-compose.dcproj false true @@ -29,26 +28,7 @@ - - - - - - - - - - - - - - - - - - - @@ -62,9 +42,9 @@ - - - + + + From 6ac34cbdaaf51a8e15dee1ddc36b7a77c1016ff8 Mon Sep 17 00:00:00 2001 From: Unai Zorrilla Castro Date: Tue, 29 Aug 2017 12:48:04 +0200 Subject: [PATCH 45/64] Update functional tests --- src/Services/Basket/Basket.API/Startup.cs | 9 ++++++++- src/Services/Location/Locations.API/Startup.cs | 7 ++++++- src/Services/Marketing/Marketing.API/Startup.cs | 7 ++++++- test/Services/FunctionalTests/FunctionalTests.csproj | 7 +++---- .../Services/Basket/BasketTestsStartup.cs | 3 ++- .../Services/Location/LocationsTestsStartup.cs | 5 ++++- .../Services/Marketing/MarketingTestsStartup.cs | 8 ++++---- 7 files changed, 33 insertions(+), 13 deletions(-) diff --git a/src/Services/Basket/Basket.API/Startup.cs b/src/Services/Basket/Basket.API/Startup.cs index e2a2b6e3e..01314b38e 100644 --- a/src/Services/Basket/Basket.API/Startup.cs +++ b/src/Services/Basket/Basket.API/Startup.cs @@ -167,7 +167,9 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API { app.UseStaticFiles(); app.UseCors("CorsPolicy"); - app.UseAuthentication(); + + ConfigureAuth(app); + app.UseMvcWithDefaultRoute(); app.UseSwagger() @@ -216,5 +218,10 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API eventBus.Subscribe(); eventBus.Subscribe(); } + + protected virtual void ConfigureAuth(IApplicationBuilder app) + { + app.UseAuthentication(); + } } } diff --git a/src/Services/Location/Locations.API/Startup.cs b/src/Services/Location/Locations.API/Startup.cs index 7d235ed0f..9c2881f07 100644 --- a/src/Services/Location/Locations.API/Startup.cs +++ b/src/Services/Location/Locations.API/Startup.cs @@ -138,7 +138,7 @@ namespace Microsoft.eShopOnContainers.Services.Locations.API { app.UseCors("CorsPolicy"); - app.UseAuthentication(); + ConfigureAuth(app); app.UseMvcWithDefaultRoute(); @@ -176,5 +176,10 @@ namespace Microsoft.eShopOnContainers.Services.Locations.API services.AddSingleton(); } + + protected virtual void ConfigureAuth(IApplicationBuilder app) + { + app.UseAuthentication(); + } } } diff --git a/src/Services/Marketing/Marketing.API/Startup.cs b/src/Services/Marketing/Marketing.API/Startup.cs index 952594556..76ff4b380 100644 --- a/src/Services/Marketing/Marketing.API/Startup.cs +++ b/src/Services/Marketing/Marketing.API/Startup.cs @@ -171,7 +171,7 @@ { app.UseCors("CorsPolicy"); - app.UseAuthentication(); + ConfigureAuth(app); app.UseMvcWithDefaultRoute(); @@ -243,5 +243,10 @@ } ); } + + protected virtual void ConfigureAuth(IApplicationBuilder app) + { + app.UseAuthentication(); + } } } diff --git a/test/Services/FunctionalTests/FunctionalTests.csproj b/test/Services/FunctionalTests/FunctionalTests.csproj index f9f58a318..99cf123a2 100644 --- a/test/Services/FunctionalTests/FunctionalTests.csproj +++ b/test/Services/FunctionalTests/FunctionalTests.csproj @@ -3,7 +3,7 @@ netcoreapp2.0 true - $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; + false false false @@ -45,9 +45,8 @@ - - - + + diff --git a/test/Services/FunctionalTests/Services/Basket/BasketTestsStartup.cs b/test/Services/FunctionalTests/Services/Basket/BasketTestsStartup.cs index 2beb73bd1..a6695c12f 100644 --- a/test/Services/FunctionalTests/Services/Basket/BasketTestsStartup.cs +++ b/test/Services/FunctionalTests/Services/Basket/BasketTestsStartup.cs @@ -2,12 +2,13 @@ using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.eShopOnContainers.Services.Basket.API; +using Microsoft.Extensions.Configuration; namespace FunctionalTests.Services.Basket { public class BasketTestsStartup : Startup { - public BasketTestsStartup(IHostingEnvironment env) : base(env) + public BasketTestsStartup(IConfiguration configuration) : base(configuration) { } diff --git a/test/Services/FunctionalTests/Services/Location/LocationsTestsStartup.cs b/test/Services/FunctionalTests/Services/Location/LocationsTestsStartup.cs index b80408388..fce808759 100644 --- a/test/Services/FunctionalTests/Services/Location/LocationsTestsStartup.cs +++ b/test/Services/FunctionalTests/Services/Location/LocationsTestsStartup.cs @@ -4,12 +4,13 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; using Microsoft.eShopOnContainers.Services.Locations.API; + using Microsoft.Extensions.Configuration; using System.Security.Claims; using System.Threading.Tasks; public class LocationsTestsStartup : Startup { - public LocationsTestsStartup(IHostingEnvironment env) : base(env) + public LocationsTestsStartup(IConfiguration configuration) : base(configuration) { } @@ -28,6 +29,7 @@ class LocationAuthorizeMiddleware { private readonly RequestDelegate _next; + public LocationAuthorizeMiddleware(RequestDelegate rd) { _next = rd; @@ -38,6 +40,7 @@ var identity = new ClaimsIdentity("cookies"); identity.AddClaim(new Claim("sub", "4611ce3f-380d-4db5-8d76-87a8689058ed")); httpContext.User.AddIdentity(identity); + await _next.Invoke(httpContext); } } diff --git a/test/Services/FunctionalTests/Services/Marketing/MarketingTestsStartup.cs b/test/Services/FunctionalTests/Services/Marketing/MarketingTestsStartup.cs index e43db6646..ae5f4453b 100644 --- a/test/Services/FunctionalTests/Services/Marketing/MarketingTestsStartup.cs +++ b/test/Services/FunctionalTests/Services/Marketing/MarketingTestsStartup.cs @@ -1,13 +1,13 @@ namespace FunctionalTests.Services.Marketing { - using Microsoft.eShopOnContainers.Services.Marketing.API; - using Microsoft.AspNetCore.Hosting; - using Microsoft.AspNetCore.Builder; using FunctionalTests.Middleware; + using Microsoft.AspNetCore.Builder; + using Microsoft.eShopOnContainers.Services.Marketing.API; + using Microsoft.Extensions.Configuration; public class MarketingTestsStartup : Startup { - public MarketingTestsStartup(IHostingEnvironment env) : base(env) + public MarketingTestsStartup(IConfiguration configuration) : base(configuration) { } From 9ed7325e0e8925c22c5d8e62bc126801a3ca8b1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ram=C3=B3n=20Tom=C3=A1s?= Date: Tue, 29 Aug 2017 18:11:30 +0200 Subject: [PATCH 46/64] Downgrade Identity.api version due to compatibility issues Updated Test project version Fix issue Idsrv token --- docker-compose.override.yml | 2 + .../DataProtection/DataProtection.csproj | 6 +-- .../Microsoft.AspNetCore.HealthChecks.csproj | 4 +- ...t.Extensions.HealthChecks.SqlServer.csproj | 4 +- .../Microsoft.Extensions.HealthChecks.csproj | 4 +- src/Services/Basket/Basket.API/Startup.cs | 43 +++++++++++++------ src/Services/Catalog/Catalog.API/Startup.cs | 20 ++------- .../Controllers/AccountController.cs | 41 ++++++++++-------- .../Identity/Identity.API/Identity.API.csproj | 38 ++++++++++++---- .../Identity.API/Models/ApplicationUser.cs | 6 ++- src/Services/Identity/Identity.API/Program.cs | 24 ++++------- src/Services/Identity/Identity.API/Startup.cs | 35 +++++++++------ .../Location/Locations.API/Startup.cs | 30 +++++++++---- .../Marketing/Marketing.API/Startup.cs | 32 ++++++++++---- .../GracePeriodManagerService.cs | 5 ++- .../GracePeriodManagerSettings.cs | 14 ------ .../Ordering/Ordering.API/OrderingSettings.cs | 7 +++ src/Services/Ordering/Ordering.API/Startup.cs | 24 +++-------- .../Ordering.API/graceperiodsettings.json | 6 --- .../Ordering/Ordering.API/settings.json | 4 +- src/Web/WebMVC/Startup.cs | 5 +-- src/Web/WebSPA/Startup.cs | 16 +++---- .../Services/Basket/BasketTestsStartup.cs | 3 +- .../Location/LocationsTestsStartup.cs | 3 +- .../Marketing/MarketingTestsStartup.cs | 3 +- .../Services/Ordering/OrderingTestsStartup.cs | 3 +- .../Services/Basket/BasketTestsStartup.cs | 3 +- .../Locations/LocationsTestsStartup.cs | 3 +- .../Marketing/MarketingTestsStartup.cs | 3 +- .../Services/Ordering/OrderingTestsStartup.cs | 3 +- 30 files changed, 225 insertions(+), 169 deletions(-) delete mode 100644 src/Services/Ordering/Ordering.API/Infrastructure/HostedServices/GracePeriodManagerSettings.cs delete mode 100644 src/Services/Ordering/Ordering.API/graceperiodsettings.json diff --git a/docker-compose.override.yml b/docker-compose.override.yml index c8375040d..6870b617f 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -61,6 +61,8 @@ services: - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} - UseCustomizationData=True - AzureServiceBusEnabled=False + - GracePeriodTime=1 + - CheckUpdateTime=30000 ports: - "5102:80" diff --git a/src/BuildingBlocks/DataProtection/DataProtection/DataProtection.csproj b/src/BuildingBlocks/DataProtection/DataProtection/DataProtection.csproj index 41281cf54..c5266d0a9 100644 --- a/src/BuildingBlocks/DataProtection/DataProtection/DataProtection.csproj +++ b/src/BuildingBlocks/DataProtection/DataProtection/DataProtection.csproj @@ -1,13 +1,13 @@  - netstandard2.0 + netstandard1.5 Microsoft.eShopOnContainers.BuildingBlocks - + - + \ No newline at end of file diff --git a/src/BuildingBlocks/HealthChecks/src/Microsoft.AspNetCore.HealthChecks/Microsoft.AspNetCore.HealthChecks.csproj b/src/BuildingBlocks/HealthChecks/src/Microsoft.AspNetCore.HealthChecks/Microsoft.AspNetCore.HealthChecks.csproj index 0f6b99f32..023554e60 100644 --- a/src/BuildingBlocks/HealthChecks/src/Microsoft.AspNetCore.HealthChecks/Microsoft.AspNetCore.HealthChecks.csproj +++ b/src/BuildingBlocks/HealthChecks/src/Microsoft.AspNetCore.HealthChecks/Microsoft.AspNetCore.HealthChecks.csproj @@ -1,7 +1,7 @@  - netstandard2.0 + netstandard1.3 @@ -9,7 +9,7 @@ - + diff --git a/src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks.SqlServer/Microsoft.Extensions.HealthChecks.SqlServer.csproj b/src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks.SqlServer/Microsoft.Extensions.HealthChecks.SqlServer.csproj index 60017a85f..35aacef13 100644 --- a/src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks.SqlServer/Microsoft.Extensions.HealthChecks.SqlServer.csproj +++ b/src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks.SqlServer/Microsoft.Extensions.HealthChecks.SqlServer.csproj @@ -1,7 +1,7 @@  - netstandard2.0 + netstandard1.3 @@ -9,7 +9,7 @@ - + diff --git a/src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks/Microsoft.Extensions.HealthChecks.csproj b/src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks/Microsoft.Extensions.HealthChecks.csproj index 80e8026b0..8ef22e156 100644 --- a/src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks/Microsoft.Extensions.HealthChecks.csproj +++ b/src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks/Microsoft.Extensions.HealthChecks.csproj @@ -1,7 +1,7 @@  - netstandard2.0 + netstandard1.3 @@ -9,7 +9,7 @@ - + diff --git a/src/Services/Basket/Basket.API/Startup.cs b/src/Services/Basket/Basket.API/Startup.cs index e2a2b6e3e..a00477f1e 100644 --- a/src/Services/Basket/Basket.API/Startup.cs +++ b/src/Services/Basket/Basket.API/Startup.cs @@ -3,6 +3,7 @@ using Autofac.Extensions.DependencyInjection; using Basket.API.Infrastructure.Filters; using Basket.API.IntegrationEvents.EventHandling; using Basket.API.IntegrationEvents.Events; +using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; @@ -25,6 +26,7 @@ using StackExchange.Redis; using Swashbuckle.AspNetCore.Swagger; using System; using System.Collections.Generic; +using System.IdentityModel.Tokens.Jwt; using System.Threading.Tasks; namespace Microsoft.eShopOnContainers.Services.Basket.API @@ -50,6 +52,8 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API }).AddControllersAsServices(); + ConfigureAuthService(services); + services.AddHealthChecks(checks => { checks.AddValueTaskCheck("HTTP Endpoint", () => new ValueTask(HealthCheckResult.Healthy("Ok")), @@ -57,16 +61,7 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API ); }); - services.Configure(Configuration); - - services.AddAuthentication() - .AddJwtBearer(options => - { - options.Authority = Configuration.GetValue("IdentityUrl"); - options.Audience = "basket"; - options.RequireHttpsMetadata = false; - - }); + services.Configure(Configuration); //By connecting here we are making sure that our service //cannot start until redis is ready. This might slow down startup, @@ -151,7 +146,7 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API services.AddSingleton(); services.AddTransient(); services.AddTransient(); - + services.AddOptions(); var container = new ContainerBuilder(); @@ -167,7 +162,7 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API { app.UseStaticFiles(); app.UseCors("CorsPolicy"); - app.UseAuthentication(); + ConfigureAuth(app); app.UseMvcWithDefaultRoute(); app.UseSwagger() @@ -181,6 +176,30 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API } + private void ConfigureAuthService(IServiceCollection services) + { + // prevent from mapping "sub" claim to nameidentifier. + JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Clear(); + + var identityUrl = Configuration.GetValue("IdentityUrl"); + + services.AddAuthentication(options => + { + options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme; + options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme; + + }).AddJwtBearer(options => + { + options.Authority = identityUrl; + options.RequireHttpsMetadata = false; + options.Audience = "basket"; + }); + } + + protected virtual void ConfigureAuth(IApplicationBuilder app) + { + app.UseAuthentication(); + } private void RegisterEventBus(IServiceCollection services) { diff --git a/src/Services/Catalog/Catalog.API/Startup.cs b/src/Services/Catalog/Catalog.API/Startup.cs index 7f64e9a88..64754c3ab 100644 --- a/src/Services/Catalog/Catalog.API/Startup.cs +++ b/src/Services/Catalog/Catalog.API/Startup.cs @@ -36,25 +36,13 @@ public class Startup { - public IConfigurationRoot Configuration { get; } - - public Startup(IHostingEnvironment env) + public Startup(IConfiguration configuration) { - var builder = new ConfigurationBuilder() - .SetBasePath(env.ContentRootPath) - .AddJsonFile($"settings.json", optional: false, reloadOnChange: true) - .AddJsonFile($"settings.{env.EnvironmentName}.json", optional: true); - - if (env.IsDevelopment()) - { - builder.AddUserSecrets(typeof(Startup).GetTypeInfo().Assembly); - } - - builder.AddEnvironmentVariables(); - - Configuration = builder.Build(); + Configuration = configuration; } + public IConfiguration Configuration { get; } + public IServiceProvider ConfigureServices(IServiceCollection services) { // Add framework services. diff --git a/src/Services/Identity/Identity.API/Controllers/AccountController.cs b/src/Services/Identity/Identity.API/Controllers/AccountController.cs index 6b56b3467..02b50129f 100644 --- a/src/Services/Identity/Identity.API/Controllers/AccountController.cs +++ b/src/Services/Identity/Identity.API/Controllers/AccountController.cs @@ -2,24 +2,26 @@ // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. -using Identity.API.Models; -using Identity.API.Models.AccountViewModels; -using Identity.API.Services; using IdentityModel; -using IdentityServer4.Models; +using IdentityServer4.Quickstart.UI.Models; using IdentityServer4.Services; -using IdentityServer4.Stores; -using Microsoft.AspNetCore.Authentication; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Identity; +using Microsoft.AspNetCore.Http.Authentication; using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.Logging; using System; +using System.Collections.Generic; using System.Linq; using System.Security.Claims; using System.Text.Encodings.Web; using System.Threading.Tasks; - +using IdentityServer4.Models; +using IdentityServer4.Stores; +using Identity.API.Services; +using Identity.API.Models; +using Microsoft.Extensions.Logging; +using Microsoft.AspNetCore.Authorization; +using Identity.API.Models.AccountViewModels; +using Microsoft.AspNetCore.Identity; +using Microsoft.AspNetCore.Authentication; namespace IdentityServer4.Quickstart.UI.Controllers { @@ -38,12 +40,12 @@ namespace IdentityServer4.Quickstart.UI.Controllers private readonly UserManager _userManager; public AccountController( - + //InMemoryUserLoginService loginService, ILoginService loginService, IIdentityServerInteractionService interaction, IClientStore clientStore, - ILoggerFactory loggerFactory, + ILoggerFactory loggerFactory, UserManager userManager) { _loginService = loginService; @@ -84,7 +86,7 @@ namespace IdentityServer4.Quickstart.UI.Controllers var user = await _loginService.FindByUsername(model.Email); if (await _loginService.ValidateCredentials(user, model.Password)) { - AuthenticationProperties props = null; + AuthenticationProperties props = null; if (model.RememberMe) { props = new AuthenticationProperties @@ -192,16 +194,16 @@ namespace IdentityServer4.Quickstart.UI.Controllers try { // hack: try/catch to handle social providers that throw - await HttpContext.SignOutAsync(idp, new AuthenticationProperties { RedirectUri = url }); + await HttpContext.Authentication.SignOutAsync(idp, new AuthenticationProperties { RedirectUri = url }); } - catch(Exception ex) + catch (Exception ex) { _logger.LogCritical(ex.Message); } } // delete authentication cookie - await HttpContext.SignOutAsync(); + await HttpContext.Authentication.SignOutAsync(); // set this so UI rendering sees an anonymous user HttpContext.User = new ClaimsPrincipal(new ClaimsIdentity()); @@ -215,7 +217,7 @@ namespace IdentityServer4.Quickstart.UI.Controllers public async Task DeviceLogOut(string redirectUrl) { // delete authentication cookie - await HttpContext.SignOutAsync(); + await HttpContext.Authentication.SignOutAsync(); // set this so UI rendering sees an anonymous user HttpContext.User = new ClaimsPrincipal(new ClaimsIdentity()); @@ -238,7 +240,7 @@ namespace IdentityServer4.Quickstart.UI.Controllers // start challenge and roundtrip the return URL var props = new AuthenticationProperties { - RedirectUri = returnUrl, + RedirectUri = returnUrl, Items = { { "scheme", provider } } }; return new ChallengeResult(provider, props); @@ -291,7 +293,8 @@ namespace IdentityServer4.Quickstart.UI.Controllers } } - if (returnUrl != null) { + if (returnUrl != null) + { if (HttpContext.User.Identity.IsAuthenticated) return Redirect(returnUrl); else diff --git a/src/Services/Identity/Identity.API/Identity.API.csproj b/src/Services/Identity/Identity.API/Identity.API.csproj index 49f9b4c2e..7c221e858 100644 --- a/src/Services/Identity/Identity.API/Identity.API.csproj +++ b/src/Services/Identity/Identity.API/Identity.API.csproj @@ -1,10 +1,10 @@  - netcoreapp2.0 - 2.0.0 + netcoreapp1.1 + 1.1.2 aspnet-eShopOnContainers.Identity-90487118-103c-4ff0-b9da-e5e26f7ab0c5 - + $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; ..\..\..\..\docker-compose.dcproj @@ -16,8 +16,30 @@ - - + + + + + + + + + + + + All + + + All + + + + + + + + + @@ -30,9 +52,9 @@ - - - + + + diff --git a/src/Services/Identity/Identity.API/Models/ApplicationUser.cs b/src/Services/Identity/Identity.API/Models/ApplicationUser.cs index 1c1f7bda1..b520c333b 100644 --- a/src/Services/Identity/Identity.API/Models/ApplicationUser.cs +++ b/src/Services/Identity/Identity.API/Models/ApplicationUser.cs @@ -1,4 +1,8 @@ -using Microsoft.AspNetCore.Identity; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Identity.EntityFrameworkCore; using System.ComponentModel.DataAnnotations; namespace Identity.API.Models diff --git a/src/Services/Identity/Identity.API/Program.cs b/src/Services/Identity/Identity.API/Program.cs index 9a035bd93..2f731c045 100644 --- a/src/Services/Identity/Identity.API/Program.cs +++ b/src/Services/Identity/Identity.API/Program.cs @@ -1,6 +1,4 @@ -using Microsoft.AspNetCore; -using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.Logging; +using Microsoft.AspNetCore.Hosting; using System.IO; namespace eShopOnContainers.Identity @@ -9,19 +7,15 @@ namespace eShopOnContainers.Identity { public static void Main(string[] args) { - BuildWebHost(args).Run(); - } - - public static IWebHost BuildWebHost(string[] args) => - WebHost.CreateDefaultBuilder(args) - .UseContentRoot(Directory.GetCurrentDirectory()) + var host = new WebHostBuilder() + .UseKestrel() .UseHealthChecks("/hc") + .UseContentRoot(Directory.GetCurrentDirectory()) + .UseIISIntegration() .UseStartup() - .ConfigureLogging((hostingContext, builder) => - { - builder.AddConfiguration(hostingContext.Configuration.GetSection("Logging")); - builder.AddConsole(); - builder.AddDebug(); - }).Build(); + .Build(); + + host.Run(); + } } } diff --git a/src/Services/Identity/Identity.API/Startup.cs b/src/Services/Identity/Identity.API/Startup.cs index 711c4b9c1..a07cd69c2 100644 --- a/src/Services/Identity/Identity.API/Startup.cs +++ b/src/Services/Identity/Identity.API/Startup.cs @@ -1,6 +1,4 @@ -using Autofac; -using Autofac.Extensions.DependencyInjection; -using Identity.API.Certificate; +using Identity.API.Certificate; using Identity.API.Configuration; using Identity.API.Data; using Identity.API.Models; @@ -11,12 +9,16 @@ using IdentityServer4.Services; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Identity; +using Microsoft.AspNetCore.Identity.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; using Microsoft.eShopOnContainers.BuildingBlocks; using Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.HealthChecks; +using Identity.API.Certificate; +using Autofac.Extensions.DependencyInjection; +using Autofac; using Microsoft.Extensions.Logging; using System; using System.Collections.Generic; @@ -28,17 +30,28 @@ namespace eShopOnContainers.Identity { public class Startup { - public Startup(IConfiguration configuration) + public Startup(IHostingEnvironment env) { - Configuration = configuration; + var builder = new ConfigurationBuilder() + .SetBasePath(env.ContentRootPath) + .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) + .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true); + + if (env.IsDevelopment()) + { + // For more details on using the user secret store see http://go.microsoft.com/fwlink/?LinkID=532709 + builder.AddUserSecrets(); + } + + builder.AddEnvironmentVariables(); + Configuration = builder.Build(); } - public IConfiguration Configuration { get; } - + public IConfigurationRoot Configuration { get; } // This method gets called by the runtime. Use this method to add services to the container. public IServiceProvider ConfigureServices(IServiceCollection services) - { + { // Add framework services. services.AddDbContext(options => @@ -81,7 +94,7 @@ namespace eShopOnContainers.Identity // Adds IdentityServer services.AddIdentityServer(x => x.IssuerUri = "null") - .AddSigningCredential(Certificate.Get()) + .AddSigningCredential(Certificate.Get()) .AddAspNetIdentity() .AddConfigurationStore(builder => builder.UseSqlServer(connectionString, options => @@ -123,11 +136,9 @@ namespace eShopOnContainers.Identity await next(); }); - + app.UseIdentity(); // Adds IdentityServer - app.UseAuthentication(); - app.UseIdentityServer(); app.UseMvc(routes => diff --git a/src/Services/Location/Locations.API/Startup.cs b/src/Services/Location/Locations.API/Startup.cs index 7d235ed0f..eb2077c8c 100644 --- a/src/Services/Location/Locations.API/Startup.cs +++ b/src/Services/Location/Locations.API/Startup.cs @@ -20,6 +20,7 @@ using RabbitMQ.Client; using Swashbuckle.AspNetCore.Swagger; using System; using System.Collections.Generic; +using System.IdentityModel.Tokens.Jwt; using System.Threading.Tasks; namespace Microsoft.eShopOnContainers.Services.Locations.API @@ -40,13 +41,7 @@ namespace Microsoft.eShopOnContainers.Services.Locations.API options.Filters.Add(typeof(HttpGlobalExceptionFilter)); }).AddControllersAsServices(); - services.AddAuthentication() - .AddJwtBearer(options => - { - options.Authority = Configuration.GetValue("IdentityUrl"); - options.Audience = "locations"; - options.RequireHttpsMetadata = false; - }); + ConfigureAuthService(services); services.Configure(Configuration); @@ -138,7 +133,7 @@ namespace Microsoft.eShopOnContainers.Services.Locations.API { app.UseCors("CorsPolicy"); - app.UseAuthentication(); + ConfigureAuth(app); app.UseMvcWithDefaultRoute(); @@ -153,6 +148,25 @@ namespace Microsoft.eShopOnContainers.Services.Locations.API .Wait(); } + private void ConfigureAuthService(IServiceCollection services) + { + // prevent from mapping "sub" claim to nameidentifier. + JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Clear(); + + services.AddAuthentication() + .AddJwtBearer(options => + { + options.Authority = Configuration.GetValue("IdentityUrl"); + options.Audience = "locations"; + options.RequireHttpsMetadata = false; + }); + } + + protected virtual void ConfigureAuth(IApplicationBuilder app) + { + app.UseAuthentication(); + } + private void RegisterEventBus(IServiceCollection services) { if (Configuration.GetValue("AzureServiceBusEnabled")) diff --git a/src/Services/Marketing/Marketing.API/Startup.cs b/src/Services/Marketing/Marketing.API/Startup.cs index 952594556..15b845337 100644 --- a/src/Services/Marketing/Marketing.API/Startup.cs +++ b/src/Services/Marketing/Marketing.API/Startup.cs @@ -28,6 +28,7 @@ using System; using System.Collections.Generic; using System.Data.SqlClient; + using System.IdentityModel.Tokens.Jwt; using System.Reflection; using System.Threading.Tasks; @@ -52,13 +53,7 @@ services.Configure(Configuration); - services.AddAuthentication() - .AddJwtBearer(options => - { - options.Authority = Configuration.GetValue("IdentityUrl"); - options.Audience = "marketing"; - options.RequireHttpsMetadata = false; - }); + ConfigureAuthService(services); services.AddHealthChecks(checks => { @@ -171,7 +166,7 @@ { app.UseCors("CorsPolicy"); - app.UseAuthentication(); + ConfigureAuth(app); app.UseMvcWithDefaultRoute(); @@ -190,7 +185,21 @@ ConfigureEventBus(app); } - private void RegisterEventBus(IServiceCollection services) + private void ConfigureAuthService(IServiceCollection services) + { + // prevent from mapping "sub" claim to nameidentifier. + JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Clear(); + + services.AddAuthentication() + .AddJwtBearer(options => + { + options.Authority = Configuration.GetValue("IdentityUrl"); + options.Audience = "marketing"; + options.RequireHttpsMetadata = false; + }); + } + + private void RegisterEventBus(IServiceCollection services) { if (Configuration.GetValue("AzureServiceBusEnabled")) { @@ -221,6 +230,11 @@ eventBus.Subscribe(); } + protected virtual void ConfigureAuth(IApplicationBuilder app) + { + app.UseAuthentication(); + } + private async Task WaitForSqlAvailabilityAsync(MarketingContext ctx, ILoggerFactory loggerFactory, IApplicationBuilder app, int retries = 0) { var logger = loggerFactory.CreateLogger(nameof(Startup)); diff --git a/src/Services/Ordering/Ordering.API/Infrastructure/HostedServices/GracePeriodManagerService.cs b/src/Services/Ordering/Ordering.API/Infrastructure/HostedServices/GracePeriodManagerService.cs index 58408b2fd..f38fc8fd8 100644 --- a/src/Services/Ordering/Ordering.API/Infrastructure/HostedServices/GracePeriodManagerService.cs +++ b/src/Services/Ordering/Ordering.API/Infrastructure/HostedServices/GracePeriodManagerService.cs @@ -2,6 +2,7 @@ { using Dapper; using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions; + using Microsoft.eShopOnContainers.Services.Ordering.API; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using Ordering.API.Application.IntegrationEvents.Events; @@ -14,11 +15,11 @@ public class GracePeriodManagerService : HostedService { - private readonly GracePeriodManagerSettings _settings; + private readonly OrderingSettings _settings; private readonly ILogger _logger; private readonly IEventBus _eventBus; - public GracePeriodManagerService(IOptions settings, + public GracePeriodManagerService(IOptions settings, IEventBus eventBus, ILogger logger) { diff --git a/src/Services/Ordering/Ordering.API/Infrastructure/HostedServices/GracePeriodManagerSettings.cs b/src/Services/Ordering/Ordering.API/Infrastructure/HostedServices/GracePeriodManagerSettings.cs deleted file mode 100644 index 2997c051d..000000000 --- a/src/Services/Ordering/Ordering.API/Infrastructure/HostedServices/GracePeriodManagerSettings.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace Ordering.API.Infrastructure.HostedServices -{ - public class GracePeriodManagerSettings - { - public string ConnectionString { get; set; } - - public string EventBusConnection { get; set; } - - public int GracePeriodTime { get; set; } - - public int CheckUpdateTime { get; set; } - - } -} diff --git a/src/Services/Ordering/Ordering.API/OrderingSettings.cs b/src/Services/Ordering/Ordering.API/OrderingSettings.cs index 8c75ba62d..bfe4d0793 100644 --- a/src/Services/Ordering/Ordering.API/OrderingSettings.cs +++ b/src/Services/Ordering/Ordering.API/OrderingSettings.cs @@ -3,5 +3,12 @@ public class OrderingSettings { public bool UseCustomizationData { get; set; } + public string ConnectionString { get; set; } + + public string EventBusConnection { get; set; } + + public int GracePeriodTime { get; set; } + + public int CheckUpdateTime { get; set; } } } diff --git a/src/Services/Ordering/Ordering.API/Startup.cs b/src/Services/Ordering/Ordering.API/Startup.cs index c793a3950..7f22540fa 100644 --- a/src/Services/Ordering/Ordering.API/Startup.cs +++ b/src/Services/Ordering/Ordering.API/Startup.cs @@ -35,30 +35,18 @@ using System.Collections.Generic; using System.Data.Common; using System.Data.SqlClient; + using System.IdentityModel.Tokens.Jwt; using System.Reflection; using System.Threading.Tasks; public class Startup { - public Startup(IHostingEnvironment env) + public Startup(IConfiguration configuration) { - var builder = new ConfigurationBuilder() - .SetBasePath(env.ContentRootPath) - .AddJsonFile("settings.json", optional: true, reloadOnChange: true) - .AddJsonFile("graceperiodsettings.json", optional: true, reloadOnChange: true) - .AddJsonFile($"settings.{env.EnvironmentName}.json", optional: true); - - if (env.IsDevelopment()) - { - builder.AddUserSecrets(typeof(Startup).GetTypeInfo().Assembly); - } - - builder.AddEnvironmentVariables(); - - Configuration = builder.Build(); + Configuration = configuration; } - public IConfigurationRoot Configuration { get; } + public IConfiguration Configuration { get; } public IServiceProvider ConfigureServices(IServiceCollection services) { @@ -71,7 +59,6 @@ // Configure GracePeriodManager Hosted Service services.AddSingleton(); - services.Configure(Configuration); services.AddTransient(); @@ -228,6 +215,9 @@ private void ConfigureAuthService(IServiceCollection services) { + // prevent from mapping "sub" claim to nameidentifier. + JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Clear(); + var identityUrl = Configuration.GetValue("IdentityUrl"); services.AddAuthentication(options => diff --git a/src/Services/Ordering/Ordering.API/graceperiodsettings.json b/src/Services/Ordering/Ordering.API/graceperiodsettings.json deleted file mode 100644 index 1c9d30e5e..000000000 --- a/src/Services/Ordering/Ordering.API/graceperiodsettings.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "ConnectionString": "Server=tcp:127.0.0.1,5433;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word;", - "GracePeriodTime": "1", - "CheckUpdateTime": "30000" -} - diff --git a/src/Services/Ordering/Ordering.API/settings.json b/src/Services/Ordering/Ordering.API/settings.json index aa3499295..d2068fcab 100644 --- a/src/Services/Ordering/Ordering.API/settings.json +++ b/src/Services/Ordering/Ordering.API/settings.json @@ -11,5 +11,7 @@ } }, "AzureServiceBusEnabled": false, - "SubscriptionClientName": "Ordering" + "SubscriptionClientName": "Ordering", + "GracePeriodTime": "1", + "CheckUpdateTime": "30000" } diff --git a/src/Web/WebMVC/Startup.cs b/src/Web/WebMVC/Startup.cs index 1791e8da1..8b10c1ecc 100644 --- a/src/Web/WebMVC/Startup.cs +++ b/src/Web/WebMVC/Startup.cs @@ -82,11 +82,10 @@ namespace Microsoft.eShopOnContainers.WebMVC // Add Authentication services services.AddAuthentication(options => { + options.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme; options.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme; - options.DefaultSignInScheme = CookieAuthenticationDefaults.AuthenticationScheme; - options.DefaultAuthenticateScheme = CookieAuthenticationDefaults.AuthenticationScheme; }) - .AddCookie(CookieAuthenticationDefaults.AuthenticationScheme) + .AddCookie() .AddOpenIdConnect(options => { options.SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme; options.Authority = identityUrl.ToString(); diff --git a/src/Web/WebSPA/Startup.cs b/src/Web/WebSPA/Startup.cs index 22511c135..1659af537 100644 --- a/src/Web/WebSPA/Startup.cs +++ b/src/Web/WebSPA/Startup.cs @@ -16,24 +16,22 @@ namespace eShopConContainers.WebSPA { public class Startup { + public Startup(IConfiguration configuration) + { + Configuration = configuration; + } + + public IConfiguration Configuration { get; } + private IHostingEnvironment _hostingEnv; public Startup(IHostingEnvironment env) { _hostingEnv = env; - var builder = new ConfigurationBuilder() - .SetBasePath(env.ContentRootPath) - .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) - .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true) - .AddEnvironmentVariables(); - - Configuration = builder.Build(); - var localPath = new Uri(Configuration["ASPNETCORE_URLS"])?.LocalPath ?? "/"; Configuration["BaseUrl"] = localPath; } - public static IConfigurationRoot Configuration { get; set;} // This method gets called by the runtime. Use this method to add services to the container. // For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=398940 public void ConfigureServices(IServiceCollection services) diff --git a/test/Services/FunctionalTests/Services/Basket/BasketTestsStartup.cs b/test/Services/FunctionalTests/Services/Basket/BasketTestsStartup.cs index 2beb73bd1..31d83fddc 100644 --- a/test/Services/FunctionalTests/Services/Basket/BasketTestsStartup.cs +++ b/test/Services/FunctionalTests/Services/Basket/BasketTestsStartup.cs @@ -2,12 +2,13 @@ using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.eShopOnContainers.Services.Basket.API; +using Microsoft.Extensions.Configuration; namespace FunctionalTests.Services.Basket { public class BasketTestsStartup : Startup { - public BasketTestsStartup(IHostingEnvironment env) : base(env) + public BasketTestsStartup(IConfiguration env) : base(env) { } diff --git a/test/Services/FunctionalTests/Services/Location/LocationsTestsStartup.cs b/test/Services/FunctionalTests/Services/Location/LocationsTestsStartup.cs index b80408388..679518fb0 100644 --- a/test/Services/FunctionalTests/Services/Location/LocationsTestsStartup.cs +++ b/test/Services/FunctionalTests/Services/Location/LocationsTestsStartup.cs @@ -4,12 +4,13 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; using Microsoft.eShopOnContainers.Services.Locations.API; + using Microsoft.Extensions.Configuration; using System.Security.Claims; using System.Threading.Tasks; public class LocationsTestsStartup : Startup { - public LocationsTestsStartup(IHostingEnvironment env) : base(env) + public LocationsTestsStartup(IConfiguration env) : base(env) { } diff --git a/test/Services/FunctionalTests/Services/Marketing/MarketingTestsStartup.cs b/test/Services/FunctionalTests/Services/Marketing/MarketingTestsStartup.cs index e43db6646..14176da67 100644 --- a/test/Services/FunctionalTests/Services/Marketing/MarketingTestsStartup.cs +++ b/test/Services/FunctionalTests/Services/Marketing/MarketingTestsStartup.cs @@ -4,10 +4,11 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Builder; using FunctionalTests.Middleware; + using Microsoft.Extensions.Configuration; public class MarketingTestsStartup : Startup { - public MarketingTestsStartup(IHostingEnvironment env) : base(env) + public MarketingTestsStartup(IConfiguration env) : base(env) { } diff --git a/test/Services/FunctionalTests/Services/Ordering/OrderingTestsStartup.cs b/test/Services/FunctionalTests/Services/Ordering/OrderingTestsStartup.cs index 0d8676f61..46e5fe8c1 100644 --- a/test/Services/FunctionalTests/Services/Ordering/OrderingTestsStartup.cs +++ b/test/Services/FunctionalTests/Services/Ordering/OrderingTestsStartup.cs @@ -2,6 +2,7 @@ using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.eShopOnContainers.Services.Ordering.API; +using Microsoft.Extensions.Configuration; using System; using System.Collections.Generic; using System.Text; @@ -10,7 +11,7 @@ namespace FunctionalTests.Services.Ordering { public class OrderingTestsStartup : Startup { - public OrderingTestsStartup(IHostingEnvironment env) : base(env) + public OrderingTestsStartup(IConfiguration env) : base(env) { } diff --git a/test/Services/IntegrationTests/Services/Basket/BasketTestsStartup.cs b/test/Services/IntegrationTests/Services/Basket/BasketTestsStartup.cs index 788c9621d..6bc1bbe6d 100644 --- a/test/Services/IntegrationTests/Services/Basket/BasketTestsStartup.cs +++ b/test/Services/IntegrationTests/Services/Basket/BasketTestsStartup.cs @@ -2,12 +2,13 @@ using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.eShopOnContainers.Services.Basket.API; +using Microsoft.Extensions.Configuration; namespace IntegrationTests.Services.Basket { public class BasketTestsStartup : Startup { - public BasketTestsStartup(IHostingEnvironment env) : base(env) + public BasketTestsStartup(IConfiguration env) : base(env) { } diff --git a/test/Services/IntegrationTests/Services/Locations/LocationsTestsStartup.cs b/test/Services/IntegrationTests/Services/Locations/LocationsTestsStartup.cs index 28a51456b..efcc9a3c0 100644 --- a/test/Services/IntegrationTests/Services/Locations/LocationsTestsStartup.cs +++ b/test/Services/IntegrationTests/Services/Locations/LocationsTestsStartup.cs @@ -5,12 +5,13 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; using Microsoft.eShopOnContainers.Services.Locations.API; + using Microsoft.Extensions.Configuration; using System.Security.Claims; using System.Threading.Tasks; public class LocationsTestsStartup : Startup { - public LocationsTestsStartup(IHostingEnvironment env) : base(env) + public LocationsTestsStartup(IConfiguration env) : base(env) { } diff --git a/test/Services/IntegrationTests/Services/Marketing/MarketingTestsStartup.cs b/test/Services/IntegrationTests/Services/Marketing/MarketingTestsStartup.cs index b8d337ab2..b2d8ed3dc 100644 --- a/test/Services/IntegrationTests/Services/Marketing/MarketingTestsStartup.cs +++ b/test/Services/IntegrationTests/Services/Marketing/MarketingTestsStartup.cs @@ -4,10 +4,11 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Builder; using IntegrationTests.Middleware; + using Microsoft.Extensions.Configuration; public class MarketingTestsStartup : Startup { - public MarketingTestsStartup(IHostingEnvironment env) : base(env) + public MarketingTestsStartup(IConfiguration env) : base(env) { } diff --git a/test/Services/IntegrationTests/Services/Ordering/OrderingTestsStartup.cs b/test/Services/IntegrationTests/Services/Ordering/OrderingTestsStartup.cs index 72fe91f0e..a5aab6136 100644 --- a/test/Services/IntegrationTests/Services/Ordering/OrderingTestsStartup.cs +++ b/test/Services/IntegrationTests/Services/Ordering/OrderingTestsStartup.cs @@ -5,12 +5,13 @@ using System.Text; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Builder; using IntegrationTests.Middleware; +using Microsoft.Extensions.Configuration; namespace IntegrationTests.Services.Ordering { public class OrderingTestsStartup : Startup { - public OrderingTestsStartup(IHostingEnvironment env) : base(env) + public OrderingTestsStartup(IConfiguration env) : base(env) { } From dc566ea2a18c0a3629c9cf2cfed976f33070fdd8 Mon Sep 17 00:00:00 2001 From: Igor Sychev Date: Wed, 30 Aug 2017 08:46:56 +0300 Subject: [PATCH 47/64] nanowin --- src/Services/Basket/Basket.API/Dockerfile.nanowin | 2 +- src/Services/Catalog/Catalog.API/Dockerfile.nanowin | 2 +- src/Services/Location/Locations.API/Dockerfile.nanowin | 4 ++-- src/Services/Marketing/Marketing.API/Dockerfile.nanowin | 4 ++-- src/Services/Ordering/Ordering.API/Dockerfile.nanowin | 2 +- src/Services/Payment/Payment.API/Dockerfile.nanowin | 4 ++-- src/Web/WebMVC/Dockerfile.nanowin | 2 +- src/Web/WebSPA/Dockerfile.nanowin | 2 +- src/Web/WebStatus/Dockerfile.nanowin | 4 ++-- 9 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/Services/Basket/Basket.API/Dockerfile.nanowin b/src/Services/Basket/Basket.API/Dockerfile.nanowin index 9c664f4e4..deab637ef 100644 --- a/src/Services/Basket/Basket.API/Dockerfile.nanowin +++ b/src/Services/Basket/Basket.API/Dockerfile.nanowin @@ -1,4 +1,4 @@ -FROM microsoft/dotnet:1.1-runtime-nanoserver +FROM microsoft/dotnet:2.0-runtime-nanoserver SHELL ["powershell"] ARG source WORKDIR /app diff --git a/src/Services/Catalog/Catalog.API/Dockerfile.nanowin b/src/Services/Catalog/Catalog.API/Dockerfile.nanowin index 193ddaef6..68eb9262d 100644 --- a/src/Services/Catalog/Catalog.API/Dockerfile.nanowin +++ b/src/Services/Catalog/Catalog.API/Dockerfile.nanowin @@ -1,4 +1,4 @@ -FROM microsoft/dotnet:1.1-runtime-nanoserver +FROM microsoft/dotnet:2.0-runtime-nanoserver SHELL ["powershell"] ARG source WORKDIR /app diff --git a/src/Services/Location/Locations.API/Dockerfile.nanowin b/src/Services/Location/Locations.API/Dockerfile.nanowin index 9c664f4e4..59fe001da 100644 --- a/src/Services/Location/Locations.API/Dockerfile.nanowin +++ b/src/Services/Location/Locations.API/Dockerfile.nanowin @@ -1,8 +1,8 @@ -FROM microsoft/dotnet:1.1-runtime-nanoserver +FROM microsoft/dotnet:2.0-runtime-nanoserver SHELL ["powershell"] ARG source WORKDIR /app RUN set-itemproperty -path 'HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters' -Name ServerPriorityTimeLimit -Value 0 -Type DWord EXPOSE 80 COPY ${source:-obj/Docker/publish} . -ENTRYPOINT ["dotnet", "Basket.API.dll"] +ENTRYPOINT ["dotnet", "Locations.API.dll"] diff --git a/src/Services/Marketing/Marketing.API/Dockerfile.nanowin b/src/Services/Marketing/Marketing.API/Dockerfile.nanowin index 9c664f4e4..33bcd0e82 100644 --- a/src/Services/Marketing/Marketing.API/Dockerfile.nanowin +++ b/src/Services/Marketing/Marketing.API/Dockerfile.nanowin @@ -1,8 +1,8 @@ -FROM microsoft/dotnet:1.1-runtime-nanoserver +FROM microsoft/dotnet:2.0-runtime-nanoserver SHELL ["powershell"] ARG source WORKDIR /app RUN set-itemproperty -path 'HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters' -Name ServerPriorityTimeLimit -Value 0 -Type DWord EXPOSE 80 COPY ${source:-obj/Docker/publish} . -ENTRYPOINT ["dotnet", "Basket.API.dll"] +ENTRYPOINT ["dotnet", "Marketing.API.dll"] diff --git a/src/Services/Ordering/Ordering.API/Dockerfile.nanowin b/src/Services/Ordering/Ordering.API/Dockerfile.nanowin index 653531d0f..c5dd08a2e 100644 --- a/src/Services/Ordering/Ordering.API/Dockerfile.nanowin +++ b/src/Services/Ordering/Ordering.API/Dockerfile.nanowin @@ -1,4 +1,4 @@ -FROM microsoft/dotnet:1.1-runtime-nanoserver +FROM microsoft/dotnet:2.0-runtime-nanoserver SHELL ["powershell"] ARG source WORKDIR /app diff --git a/src/Services/Payment/Payment.API/Dockerfile.nanowin b/src/Services/Payment/Payment.API/Dockerfile.nanowin index 9c664f4e4..c04327048 100644 --- a/src/Services/Payment/Payment.API/Dockerfile.nanowin +++ b/src/Services/Payment/Payment.API/Dockerfile.nanowin @@ -1,8 +1,8 @@ -FROM microsoft/dotnet:1.1-runtime-nanoserver +FROM microsoft/dotnet:2.0-runtime-nanoserver SHELL ["powershell"] ARG source WORKDIR /app RUN set-itemproperty -path 'HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters' -Name ServerPriorityTimeLimit -Value 0 -Type DWord EXPOSE 80 COPY ${source:-obj/Docker/publish} . -ENTRYPOINT ["dotnet", "Basket.API.dll"] +ENTRYPOINT ["dotnet", "Payment.API.dll"] diff --git a/src/Web/WebMVC/Dockerfile.nanowin b/src/Web/WebMVC/Dockerfile.nanowin index 4eaad3b22..739f27746 100644 --- a/src/Web/WebMVC/Dockerfile.nanowin +++ b/src/Web/WebMVC/Dockerfile.nanowin @@ -1,4 +1,4 @@ -FROM microsoft/dotnet:1.1-runtime-nanoserver +FROM microsoft/dotnet:2.0-runtime-nanoserver SHELL ["powershell"] ARG source WORKDIR /app diff --git a/src/Web/WebSPA/Dockerfile.nanowin b/src/Web/WebSPA/Dockerfile.nanowin index 700c23391..7e678c9ac 100644 --- a/src/Web/WebSPA/Dockerfile.nanowin +++ b/src/Web/WebSPA/Dockerfile.nanowin @@ -1,4 +1,4 @@ -FROM microsoft/dotnet:1.1-runtime-nanoserver +FROM microsoft/dotnet:2.0-runtime-nanoserver SHELL ["powershell"] ARG source WORKDIR /app diff --git a/src/Web/WebStatus/Dockerfile.nanowin b/src/Web/WebStatus/Dockerfile.nanowin index 4eaad3b22..9405cf26d 100644 --- a/src/Web/WebStatus/Dockerfile.nanowin +++ b/src/Web/WebStatus/Dockerfile.nanowin @@ -1,8 +1,8 @@ -FROM microsoft/dotnet:1.1-runtime-nanoserver +FROM microsoft/dotnet:2.0-runtime-nanoserver SHELL ["powershell"] ARG source WORKDIR /app RUN set-itemproperty -path 'HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters' -Name ServerPriorityTimeLimit -Value 0 -Type DWord EXPOSE 80 COPY ${source:-obj/Docker/publish} . -ENTRYPOINT ["dotnet", "WebMVC.dll"] +ENTRYPOINT ["dotnet", "WebStatus.dll"] From c9ff332b84e6be3538688fa40311c73b9eef2e56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ram=C3=B3n=20Tom=C3=A1s?= Date: Wed, 30 Aug 2017 08:59:39 +0200 Subject: [PATCH 48/64] Fix merging duplicated ConfigureAuth method --- src/Services/Basket/Basket.API/Startup.cs | 5 ----- src/Services/Location/Locations.API/Startup.cs | 5 ----- src/Services/Marketing/Marketing.API/Startup.cs | 7 +------ .../Services/Locations/LocationsTestsStartup.cs | 2 -- 4 files changed, 1 insertion(+), 18 deletions(-) diff --git a/src/Services/Basket/Basket.API/Startup.cs b/src/Services/Basket/Basket.API/Startup.cs index 9efa1f36a..6a432b290 100644 --- a/src/Services/Basket/Basket.API/Startup.cs +++ b/src/Services/Basket/Basket.API/Startup.cs @@ -237,10 +237,5 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API eventBus.Subscribe(); eventBus.Subscribe(); } - - protected virtual void ConfigureAuth(IApplicationBuilder app) - { - app.UseAuthentication(); - } } } diff --git a/src/Services/Location/Locations.API/Startup.cs b/src/Services/Location/Locations.API/Startup.cs index 189fea331..eb2077c8c 100644 --- a/src/Services/Location/Locations.API/Startup.cs +++ b/src/Services/Location/Locations.API/Startup.cs @@ -190,10 +190,5 @@ namespace Microsoft.eShopOnContainers.Services.Locations.API services.AddSingleton(); } - - protected virtual void ConfigureAuth(IApplicationBuilder app) - { - app.UseAuthentication(); - } } } diff --git a/src/Services/Marketing/Marketing.API/Startup.cs b/src/Services/Marketing/Marketing.API/Startup.cs index c0fa3e5b4..89f8482f9 100644 --- a/src/Services/Marketing/Marketing.API/Startup.cs +++ b/src/Services/Marketing/Marketing.API/Startup.cs @@ -256,11 +256,6 @@ logger.LogTrace($"[{prefix}] Exception {exception.GetType().Name} with message ${exception.Message} detected on attempt {retry} of {retries}"); } ); - } - - protected virtual void ConfigureAuth(IApplicationBuilder app) - { - app.UseAuthentication(); - } + } } } diff --git a/test/Services/IntegrationTests/Services/Locations/LocationsTestsStartup.cs b/test/Services/IntegrationTests/Services/Locations/LocationsTestsStartup.cs index efcc9a3c0..bf19a1ca0 100644 --- a/test/Services/IntegrationTests/Services/Locations/LocationsTestsStartup.cs +++ b/test/Services/IntegrationTests/Services/Locations/LocationsTestsStartup.cs @@ -1,8 +1,6 @@ namespace IntegrationTests.Services.Locations { - using IntegrationTests.Middleware; using Microsoft.AspNetCore.Builder; - using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; using Microsoft.eShopOnContainers.Services.Locations.API; using Microsoft.Extensions.Configuration; From 05aa265c602824ad2c2e973ec9d0681f65c86412 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ram=C3=B3n=20Tom=C3=A1s?= Date: Wed, 30 Aug 2017 18:51:22 +0200 Subject: [PATCH 49/64] Updated aspnetcore.host to v2.0 in testing projects --- test/Services/IntegrationTests/IntegrationTests.csproj | 4 ++-- test/Services/UnitTest/UnitTest.csproj | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/Services/IntegrationTests/IntegrationTests.csproj b/test/Services/IntegrationTests/IntegrationTests.csproj index d787b10fc..d4de27425 100644 --- a/test/Services/IntegrationTests/IntegrationTests.csproj +++ b/test/Services/IntegrationTests/IntegrationTests.csproj @@ -45,10 +45,10 @@ - + - + diff --git a/test/Services/UnitTest/UnitTest.csproj b/test/Services/UnitTest/UnitTest.csproj index ec396c982..22a6fedcc 100644 --- a/test/Services/UnitTest/UnitTest.csproj +++ b/test/Services/UnitTest/UnitTest.csproj @@ -21,12 +21,12 @@ - + - + From 4a6fc5299a1544446e09af2962a58ff4d8ae7e1a Mon Sep 17 00:00:00 2001 From: Unai Zorrilla Castro Date: Thu, 31 Aug 2017 16:23:51 +0200 Subject: [PATCH 50/64] Remove warning on usings in Marketing.API --- .../Events/UserLocationUpdatedIntegrationEvent.cs | 1 + .../Handlers/UserLocationUpdatedIntegrationEventHandler.cs | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Services/Marketing/Marketing.API/IntegrationEvents/Events/UserLocationUpdatedIntegrationEvent.cs b/src/Services/Marketing/Marketing.API/IntegrationEvents/Events/UserLocationUpdatedIntegrationEvent.cs index f894d903f..b73e7b659 100644 --- a/src/Services/Marketing/Marketing.API/IntegrationEvents/Events/UserLocationUpdatedIntegrationEvent.cs +++ b/src/Services/Marketing/Marketing.API/IntegrationEvents/Events/UserLocationUpdatedIntegrationEvent.cs @@ -7,6 +7,7 @@ public class UserLocationUpdatedIntegrationEvent : IntegrationEvent { public string UserId { get; set; } + public List LocationList { get; set; } public UserLocationUpdatedIntegrationEvent(string userId, List locationList) diff --git a/src/Services/Marketing/Marketing.API/IntegrationEvents/Handlers/UserLocationUpdatedIntegrationEventHandler.cs b/src/Services/Marketing/Marketing.API/IntegrationEvents/Handlers/UserLocationUpdatedIntegrationEventHandler.cs index 5393608a0..77574c0e5 100644 --- a/src/Services/Marketing/Marketing.API/IntegrationEvents/Handlers/UserLocationUpdatedIntegrationEventHandler.cs +++ b/src/Services/Marketing/Marketing.API/IntegrationEvents/Handlers/UserLocationUpdatedIntegrationEventHandler.cs @@ -4,7 +4,6 @@ using Marketing.API.Model; using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions; using Microsoft.eShopOnContainers.Services.Marketing.API.Infrastructure.Repositories; - using Microsoft.eShopOnContainers.Services.Marketing.API.Model; using System; using System.Collections.Generic; using System.Threading.Tasks; From ecef3bed68835bb6ce99897a60754f16f2daa08a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ram=C3=B3n=20Tom=C3=A1s?= Date: Thu, 31 Aug 2017 17:06:03 +0200 Subject: [PATCH 51/64] Set same vs version for all the solutions --- eShopOnContainers-Android.sln | 2 +- eShopOnContainers-AzureFunctions.sln | 2 +- eShopOnContainers-MobileApps.sln | 2 +- eShopOnContainers-iOS.sln | 2 +- eShopOnContainers.sln | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/eShopOnContainers-Android.sln b/eShopOnContainers-Android.sln index f1f10b26f..b3324f540 100644 --- a/eShopOnContainers-Android.sln +++ b/eShopOnContainers-Android.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.26430.6 +VisualStudioVersion = 15.0.26730.8 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{932D8224-11F6-4D07-B109-DA28AD288A63}" EndProject diff --git a/eShopOnContainers-AzureFunctions.sln b/eShopOnContainers-AzureFunctions.sln index 7e14fc19d..d129fc0fe 100644 --- a/eShopOnContainers-AzureFunctions.sln +++ b/eShopOnContainers-AzureFunctions.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.26608.5 +VisualStudioVersion = 15.0.26730.8 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Infrastructure", "Infrastructure", "{5B1011EC-CEE5-47AA-B336-99381D573679}" EndProject diff --git a/eShopOnContainers-MobileApps.sln b/eShopOnContainers-MobileApps.sln index cda44c042..ecc3fdb6b 100755 --- a/eShopOnContainers-MobileApps.sln +++ b/eShopOnContainers-MobileApps.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.26430.16 +VisualStudioVersion = 15.0.26730.8 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{932D8224-11F6-4D07-B109-DA28AD288A63}" EndProject diff --git a/eShopOnContainers-iOS.sln b/eShopOnContainers-iOS.sln index a6e889786..e220e7c4e 100644 --- a/eShopOnContainers-iOS.sln +++ b/eShopOnContainers-iOS.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.26430.6 +VisualStudioVersion = 15.0.26730.8 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{932D8224-11F6-4D07-B109-DA28AD288A63}" EndProject diff --git a/eShopOnContainers.sln b/eShopOnContainers.sln index 414ff7993..ae44be741 100644 --- a/eShopOnContainers.sln +++ b/eShopOnContainers.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.26430.6 +VisualStudioVersion = 15.0.26730.8 MinimumVisualStudioVersion = 10.0.40219.1 Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-compose.dcproj", "{FEA0C318-FFED-4D39-8781-265718CA43DD}" ProjectSection(ProjectDependencies) = postProject From 70e429b76013b106df0c2a0dc12a0b7206836454 Mon Sep 17 00:00:00 2001 From: Unai Zorrilla Castro Date: Thu, 31 Aug 2017 17:16:28 +0200 Subject: [PATCH 52/64] Added IEntityTypeConfiguration feature from EF Core 2 --- .../Catalog/Catalog.API/Catalog.API.csproj | 3 + .../Infrastructure/CatalogContext.cs | 68 +----- .../CatalogBrandEntityTypeConfiguration.cs | 25 +++ .../CatalogItemEntityTypeConfiguration.cs | 39 ++++ .../CatalogTypeEntityTypeConfiguration.cs | 25 +++ .../{settings.json => appsettings.json} | 0 .../CampaignEntityTypeConfiguration.cs | 46 ++++ .../RuleEntityTypeConfiguration.cs | 30 +++ ...UserLocationRuleEntityTypeConfiguration.cs | 17 ++ .../Infrastructure/MarketingContext.cs | 71 +------ .../BuyerEntityTYpeConfiguration.cs | 39 ++++ .../CardTypeEntityTypeConfiguration.cs | 27 +++ .../ClientRequestEntityTypeConfiguration.cs | 19 ++ .../OrderEntityTypeConfiguration.cs | 54 +++++ .../OrderItemEntityTypeConfiguration.cs | 44 ++++ .../OrderStatusEntityTypeConfiguration.cs | 27 +++ .../PaymentMethodEntityTypeConfiguration.cs | 49 +++++ .../OrderingContext.cs | 201 +----------------- 18 files changed, 462 insertions(+), 322 deletions(-) create mode 100644 src/Services/Catalog/Catalog.API/Infrastructure/EntityConfigurations/CatalogBrandEntityTypeConfiguration.cs create mode 100644 src/Services/Catalog/Catalog.API/Infrastructure/EntityConfigurations/CatalogItemEntityTypeConfiguration.cs create mode 100644 src/Services/Catalog/Catalog.API/Infrastructure/EntityConfigurations/CatalogTypeEntityTypeConfiguration.cs rename src/Services/Catalog/Catalog.API/{settings.json => appsettings.json} (100%) create mode 100644 src/Services/Marketing/Marketing.API/Infrastructure/EntityConfigurations/CampaignEntityTypeConfiguration.cs create mode 100644 src/Services/Marketing/Marketing.API/Infrastructure/EntityConfigurations/RuleEntityTypeConfiguration.cs create mode 100644 src/Services/Marketing/Marketing.API/Infrastructure/EntityConfigurations/UserLocationRuleEntityTypeConfiguration.cs create mode 100644 src/Services/Ordering/Ordering.Infrastructure/EntityConfigurations/BuyerEntityTYpeConfiguration.cs create mode 100644 src/Services/Ordering/Ordering.Infrastructure/EntityConfigurations/CardTypeEntityTypeConfiguration.cs create mode 100644 src/Services/Ordering/Ordering.Infrastructure/EntityConfigurations/ClientRequestEntityTypeConfiguration.cs create mode 100644 src/Services/Ordering/Ordering.Infrastructure/EntityConfigurations/OrderEntityTypeConfiguration.cs create mode 100644 src/Services/Ordering/Ordering.Infrastructure/EntityConfigurations/OrderItemEntityTypeConfiguration.cs create mode 100644 src/Services/Ordering/Ordering.Infrastructure/EntityConfigurations/OrderStatusEntityTypeConfiguration.cs create mode 100644 src/Services/Ordering/Ordering.Infrastructure/EntityConfigurations/PaymentMethodEntityTypeConfiguration.cs diff --git a/src/Services/Catalog/Catalog.API/Catalog.API.csproj b/src/Services/Catalog/Catalog.API/Catalog.API.csproj index 7f55b6432..de280179f 100644 --- a/src/Services/Catalog/Catalog.API/Catalog.API.csproj +++ b/src/Services/Catalog/Catalog.API/Catalog.API.csproj @@ -12,6 +12,9 @@ + + Always + PreserveNewest diff --git a/src/Services/Catalog/Catalog.API/Infrastructure/CatalogContext.cs b/src/Services/Catalog/Catalog.API/Infrastructure/CatalogContext.cs index f58541b62..b0dd2a082 100644 --- a/src/Services/Catalog/Catalog.API/Infrastructure/CatalogContext.cs +++ b/src/Services/Catalog/Catalog.API/Infrastructure/CatalogContext.cs @@ -1,9 +1,8 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure { - using EntityFrameworkCore.Metadata.Builders; using Microsoft.EntityFrameworkCore; + using EntityConfigurations; using Model; - using Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF; public class CatalogContext : DbContext { @@ -16,68 +15,9 @@ protected override void OnModelCreating(ModelBuilder builder) { - builder.Entity(ConfigureCatalogBrand); - builder.Entity(ConfigureCatalogType); - builder.Entity(ConfigureCatalogItem); + builder.ApplyConfiguration(new CatalogBrandEntityTypeConfiguration()); + builder.ApplyConfiguration(new CatalogTypeEntityTypeConfiguration()); + builder.ApplyConfiguration(new CatalogItemEntityTypeConfiguration()); } - - void ConfigureCatalogItem(EntityTypeBuilder builder) - { - builder.ToTable("Catalog"); - - builder.Property(ci => ci.Id) - .ForSqlServerUseSequenceHiLo("catalog_hilo") - .IsRequired(); - - builder.Property(ci => ci.Name) - .IsRequired(true) - .HasMaxLength(50); - - builder.Property(ci => ci.Price) - .IsRequired(true); - - builder.Property(ci => ci.PictureFileName) - .IsRequired(false); - - builder.Ignore(ci => ci.PictureUri); - - builder.HasOne(ci => ci.CatalogBrand) - .WithMany() - .HasForeignKey(ci => ci.CatalogBrandId); - - builder.HasOne(ci => ci.CatalogType) - .WithMany() - .HasForeignKey(ci => ci.CatalogTypeId); - } - - void ConfigureCatalogBrand(EntityTypeBuilder builder) - { - builder.ToTable("CatalogBrand"); - - builder.HasKey(ci => ci.Id); - - builder.Property(ci => ci.Id) - .ForSqlServerUseSequenceHiLo("catalog_brand_hilo") - .IsRequired(); - - builder.Property(cb => cb.Brand) - .IsRequired() - .HasMaxLength(100); - } - - void ConfigureCatalogType(EntityTypeBuilder builder) - { - builder.ToTable("CatalogType"); - - builder.HasKey(ci => ci.Id); - - builder.Property(ci => ci.Id) - .ForSqlServerUseSequenceHiLo("catalog_type_hilo") - .IsRequired(); - - builder.Property(cb => cb.Type) - .IsRequired() - .HasMaxLength(100); - } } } diff --git a/src/Services/Catalog/Catalog.API/Infrastructure/EntityConfigurations/CatalogBrandEntityTypeConfiguration.cs b/src/Services/Catalog/Catalog.API/Infrastructure/EntityConfigurations/CatalogBrandEntityTypeConfiguration.cs new file mode 100644 index 000000000..8312b023d --- /dev/null +++ b/src/Services/Catalog/Catalog.API/Infrastructure/EntityConfigurations/CatalogBrandEntityTypeConfiguration.cs @@ -0,0 +1,25 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Microsoft.eShopOnContainers.Services.Catalog.API.Model; + +namespace Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure.EntityConfigurations +{ + class CatalogBrandEntityTypeConfiguration + : IEntityTypeConfiguration + { + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("CatalogBrand"); + + builder.HasKey(ci => ci.Id); + + builder.Property(ci => ci.Id) + .ForSqlServerUseSequenceHiLo("catalog_brand_hilo") + .IsRequired(); + + builder.Property(cb => cb.Brand) + .IsRequired() + .HasMaxLength(100); + } + } +} diff --git a/src/Services/Catalog/Catalog.API/Infrastructure/EntityConfigurations/CatalogItemEntityTypeConfiguration.cs b/src/Services/Catalog/Catalog.API/Infrastructure/EntityConfigurations/CatalogItemEntityTypeConfiguration.cs new file mode 100644 index 000000000..f7f093ce8 --- /dev/null +++ b/src/Services/Catalog/Catalog.API/Infrastructure/EntityConfigurations/CatalogItemEntityTypeConfiguration.cs @@ -0,0 +1,39 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Microsoft.eShopOnContainers.Services.Catalog.API.Model; + +namespace Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure.EntityConfigurations +{ + class CatalogItemEntityTypeConfiguration + : IEntityTypeConfiguration + { + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("Catalog"); + + builder.Property(ci => ci.Id) + .ForSqlServerUseSequenceHiLo("catalog_hilo") + .IsRequired(); + + builder.Property(ci => ci.Name) + .IsRequired(true) + .HasMaxLength(50); + + builder.Property(ci => ci.Price) + .IsRequired(true); + + builder.Property(ci => ci.PictureFileName) + .IsRequired(false); + + builder.Ignore(ci => ci.PictureUri); + + builder.HasOne(ci => ci.CatalogBrand) + .WithMany() + .HasForeignKey(ci => ci.CatalogBrandId); + + builder.HasOne(ci => ci.CatalogType) + .WithMany() + .HasForeignKey(ci => ci.CatalogTypeId); + } + } +} diff --git a/src/Services/Catalog/Catalog.API/Infrastructure/EntityConfigurations/CatalogTypeEntityTypeConfiguration.cs b/src/Services/Catalog/Catalog.API/Infrastructure/EntityConfigurations/CatalogTypeEntityTypeConfiguration.cs new file mode 100644 index 000000000..4c30bb3b6 --- /dev/null +++ b/src/Services/Catalog/Catalog.API/Infrastructure/EntityConfigurations/CatalogTypeEntityTypeConfiguration.cs @@ -0,0 +1,25 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Microsoft.eShopOnContainers.Services.Catalog.API.Model; + +namespace Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure.EntityConfigurations +{ + class CatalogTypeEntityTypeConfiguration + : IEntityTypeConfiguration + { + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("CatalogType"); + + builder.HasKey(ci => ci.Id); + + builder.Property(ci => ci.Id) + .ForSqlServerUseSequenceHiLo("catalog_type_hilo") + .IsRequired(); + + builder.Property(cb => cb.Type) + .IsRequired() + .HasMaxLength(100); + } + } +} diff --git a/src/Services/Catalog/Catalog.API/settings.json b/src/Services/Catalog/Catalog.API/appsettings.json similarity index 100% rename from src/Services/Catalog/Catalog.API/settings.json rename to src/Services/Catalog/Catalog.API/appsettings.json diff --git a/src/Services/Marketing/Marketing.API/Infrastructure/EntityConfigurations/CampaignEntityTypeConfiguration.cs b/src/Services/Marketing/Marketing.API/Infrastructure/EntityConfigurations/CampaignEntityTypeConfiguration.cs new file mode 100644 index 000000000..833133dae --- /dev/null +++ b/src/Services/Marketing/Marketing.API/Infrastructure/EntityConfigurations/CampaignEntityTypeConfiguration.cs @@ -0,0 +1,46 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Microsoft.eShopOnContainers.Services.Marketing.API.Model; + +namespace Microsoft.eShopOnContainers.Services.Marketing.API.Infrastructure.EntityConfigurations +{ + class CampaignEntityTypeConfiguration + : IEntityTypeConfiguration + { + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("Campaign"); + + builder.HasKey(m => m.Id); + + builder.Property(m => m.Id) + .ForSqlServerUseSequenceHiLo("campaign_hilo") + .IsRequired(); + + builder.Property(m => m.Name) + .HasColumnName("Name") + .IsRequired(); + + builder.Property(m => m.From) + .HasColumnName("From") + .IsRequired(); + + builder.Property(m => m.To) + .HasColumnName("To") + .IsRequired(); + + builder.Property(m => m.Description) + .HasColumnName("Description") + .IsRequired(); + + builder.Property(m => m.PictureUri) + .HasColumnName("PictureUri") + .IsRequired(); + + builder.HasMany(m => m.Rules) + .WithOne(r => r.Campaign) + .HasForeignKey(r => r.CampaignId) + .IsRequired(); + } + } +} diff --git a/src/Services/Marketing/Marketing.API/Infrastructure/EntityConfigurations/RuleEntityTypeConfiguration.cs b/src/Services/Marketing/Marketing.API/Infrastructure/EntityConfigurations/RuleEntityTypeConfiguration.cs new file mode 100644 index 000000000..49c015014 --- /dev/null +++ b/src/Services/Marketing/Marketing.API/Infrastructure/EntityConfigurations/RuleEntityTypeConfiguration.cs @@ -0,0 +1,30 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Microsoft.eShopOnContainers.Services.Marketing.API.Model; + +namespace Microsoft.eShopOnContainers.Services.Marketing.API.Infrastructure.EntityConfigurations +{ + class RuleEntityTypeConfiguration + : IEntityTypeConfiguration + { + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("Rule"); + + builder.HasKey(r => r.Id); + + builder.Property(r => r.Id) + .ForSqlServerUseSequenceHiLo("rule_hilo") + .IsRequired(); + + builder.HasDiscriminator("RuleTypeId") + .HasValue(RuleType.UserProfileRule.Id) + .HasValue(RuleType.PurchaseHistoryRule.Id) + .HasValue(RuleType.UserLocationRule.Id); + + builder.Property(r => r.Description) + .HasColumnName("Description") + .IsRequired(); + } + } +} diff --git a/src/Services/Marketing/Marketing.API/Infrastructure/EntityConfigurations/UserLocationRuleEntityTypeConfiguration.cs b/src/Services/Marketing/Marketing.API/Infrastructure/EntityConfigurations/UserLocationRuleEntityTypeConfiguration.cs new file mode 100644 index 000000000..84840d3a5 --- /dev/null +++ b/src/Services/Marketing/Marketing.API/Infrastructure/EntityConfigurations/UserLocationRuleEntityTypeConfiguration.cs @@ -0,0 +1,17 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Microsoft.eShopOnContainers.Services.Marketing.API.Model; + +namespace Microsoft.eShopOnContainers.Services.Marketing.API.Infrastructure.EntityConfigurations +{ + class UserLocationRuleEntityTypeConfiguration + : IEntityTypeConfiguration + { + public void Configure(EntityTypeBuilder builder) + { + builder.Property(r => r.LocationId) + .HasColumnName("LocationId") + .IsRequired(); + } + } +} diff --git a/src/Services/Marketing/Marketing.API/Infrastructure/MarketingContext.cs b/src/Services/Marketing/Marketing.API/Infrastructure/MarketingContext.cs index f530fae37..c843f9b5b 100644 --- a/src/Services/Marketing/Marketing.API/Infrastructure/MarketingContext.cs +++ b/src/Services/Marketing/Marketing.API/Infrastructure/MarketingContext.cs @@ -1,7 +1,7 @@ namespace Microsoft.eShopOnContainers.Services.Marketing.API.Infrastructure { + using EntityConfigurations; using Microsoft.EntityFrameworkCore; - using Microsoft.EntityFrameworkCore.Metadata.Builders; using Microsoft.eShopOnContainers.Services.Marketing.API.Model; public class MarketingContext : DbContext @@ -16,72 +16,9 @@ protected override void OnModelCreating(ModelBuilder builder) { - builder.Entity(ConfigureCampaigns); - builder.Entity(ConfigureRules); - builder.Entity(ConfigureUserLocationRules); - } - - void ConfigureCampaigns(EntityTypeBuilder builder) - { - builder.ToTable("Campaign"); - - builder.HasKey(m => m.Id); - - builder.Property(m => m.Id) - .ForSqlServerUseSequenceHiLo("campaign_hilo") - .IsRequired(); - - builder.Property(m => m.Name) - .HasColumnName("Name") - .IsRequired(); - - builder.Property(m => m.From) - .HasColumnName("From") - .IsRequired(); - - builder.Property(m => m.To) - .HasColumnName("To") - .IsRequired(); - - builder.Property(m => m.Description) - .HasColumnName("Description") - .IsRequired(); - - builder.Property(m => m.PictureUri) - .HasColumnName("PictureUri") - .IsRequired(); - - builder.HasMany(m => m.Rules) - .WithOne(r => r.Campaign) - .HasForeignKey(r => r.CampaignId) - .IsRequired(); - } - - void ConfigureRules(EntityTypeBuilder builder) - { - builder.ToTable("Rule"); - - builder.HasKey(r => r.Id); - - builder.Property(r => r.Id) - .ForSqlServerUseSequenceHiLo("rule_hilo") - .IsRequired(); - - builder.HasDiscriminator("RuleTypeId") - .HasValue(RuleType.UserProfileRule.Id) - .HasValue(RuleType.PurchaseHistoryRule.Id) - .HasValue(RuleType.UserLocationRule.Id); - - builder.Property(r => r.Description) - .HasColumnName("Description") - .IsRequired(); - } - - void ConfigureUserLocationRules(EntityTypeBuilder builder) - { - builder.Property(r => r.LocationId) - .HasColumnName("LocationId") - .IsRequired(); + builder.ApplyConfiguration(new CampaignEntityTypeConfiguration()); + builder.ApplyConfiguration(new RuleEntityTypeConfiguration()); + builder.ApplyConfiguration(new UserLocationRuleEntityTypeConfiguration()); } } } \ No newline at end of file diff --git a/src/Services/Ordering/Ordering.Infrastructure/EntityConfigurations/BuyerEntityTYpeConfiguration.cs b/src/Services/Ordering/Ordering.Infrastructure/EntityConfigurations/BuyerEntityTYpeConfiguration.cs new file mode 100644 index 000000000..177f68d91 --- /dev/null +++ b/src/Services/Ordering/Ordering.Infrastructure/EntityConfigurations/BuyerEntityTYpeConfiguration.cs @@ -0,0 +1,39 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate; +using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure; + +namespace Ordering.Infrastructure.EntityConfigurations +{ + class BuyerEntityTypeConfiguration + : IEntityTypeConfiguration + { + public void Configure(EntityTypeBuilder buyerConfiguration) + { + buyerConfiguration.ToTable("buyers", OrderingContext.DEFAULT_SCHEMA); + + buyerConfiguration.HasKey(b => b.Id); + + buyerConfiguration.Ignore(b => b.DomainEvents); + + buyerConfiguration.Property(b => b.Id) + .ForSqlServerUseSequenceHiLo("buyerseq", OrderingContext.DEFAULT_SCHEMA); + + buyerConfiguration.Property(b => b.IdentityGuid) + .HasMaxLength(200) + .IsRequired(); + + buyerConfiguration.HasIndex("IdentityGuid") + .IsUnique(true); + + buyerConfiguration.HasMany(b => b.PaymentMethods) + .WithOne() + .HasForeignKey("BuyerId") + .OnDelete(DeleteBehavior.Cascade); + + var navigation = buyerConfiguration.Metadata.FindNavigation(nameof(Buyer.PaymentMethods)); + + navigation.SetPropertyAccessMode(PropertyAccessMode.Field); + } + } +} diff --git a/src/Services/Ordering/Ordering.Infrastructure/EntityConfigurations/CardTypeEntityTypeConfiguration.cs b/src/Services/Ordering/Ordering.Infrastructure/EntityConfigurations/CardTypeEntityTypeConfiguration.cs new file mode 100644 index 000000000..cdac780a1 --- /dev/null +++ b/src/Services/Ordering/Ordering.Infrastructure/EntityConfigurations/CardTypeEntityTypeConfiguration.cs @@ -0,0 +1,27 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate; +using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure; + +namespace Ordering.Infrastructure.EntityConfigurations +{ + class CardTypeEntityTypeConfiguration + : IEntityTypeConfiguration + { + public void Configure(EntityTypeBuilder cardTypesConfiguration) + { + cardTypesConfiguration.ToTable("cardtypes", OrderingContext.DEFAULT_SCHEMA); + + cardTypesConfiguration.HasKey(ct => ct.Id); + + cardTypesConfiguration.Property(ct => ct.Id) + .HasDefaultValue(1) + .ValueGeneratedNever() + .IsRequired(); + + cardTypesConfiguration.Property(ct => ct.Name) + .HasMaxLength(200) + .IsRequired(); + } + } +} diff --git a/src/Services/Ordering/Ordering.Infrastructure/EntityConfigurations/ClientRequestEntityTypeConfiguration.cs b/src/Services/Ordering/Ordering.Infrastructure/EntityConfigurations/ClientRequestEntityTypeConfiguration.cs new file mode 100644 index 000000000..5a5f8547e --- /dev/null +++ b/src/Services/Ordering/Ordering.Infrastructure/EntityConfigurations/ClientRequestEntityTypeConfiguration.cs @@ -0,0 +1,19 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure; +using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Idempotency; + +namespace Ordering.Infrastructure.EntityConfigurations +{ + class ClientRequestEntityTypeConfiguration + : IEntityTypeConfiguration + { + public void Configure(EntityTypeBuilder requestConfiguration) + { + requestConfiguration.ToTable("requests", OrderingContext.DEFAULT_SCHEMA); + requestConfiguration.HasKey(cr => cr.Id); + requestConfiguration.Property(cr => cr.Name).IsRequired(); + requestConfiguration.Property(cr => cr.Time).IsRequired(); + } + } +} diff --git a/src/Services/Ordering/Ordering.Infrastructure/EntityConfigurations/OrderEntityTypeConfiguration.cs b/src/Services/Ordering/Ordering.Infrastructure/EntityConfigurations/OrderEntityTypeConfiguration.cs new file mode 100644 index 000000000..19684d5e3 --- /dev/null +++ b/src/Services/Ordering/Ordering.Infrastructure/EntityConfigurations/OrderEntityTypeConfiguration.cs @@ -0,0 +1,54 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate; +using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate; +using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure; +using System; + +namespace Ordering.Infrastructure.EntityConfigurations +{ + class OrderEntityTypeConfiguration + : IEntityTypeConfiguration + { + public void Configure(EntityTypeBuilder orderConfiguration) + { + orderConfiguration.ToTable("orders", OrderingContext.DEFAULT_SCHEMA); + + orderConfiguration.HasKey(o => o.Id); + + orderConfiguration.Ignore(b => b.DomainEvents); + + orderConfiguration.Property(o => o.Id) + .ForSqlServerUseSequenceHiLo("orderseq", OrderingContext.DEFAULT_SCHEMA); + + orderConfiguration.OwnsOne(o => o.Address); + + orderConfiguration.Property("OrderDate").IsRequired(); + orderConfiguration.Property("BuyerId").IsRequired(false); + orderConfiguration.Property("OrderStatusId").IsRequired(); + orderConfiguration.Property("PaymentMethodId").IsRequired(false); + orderConfiguration.Property("Description").IsRequired(false); + + var navigation = orderConfiguration.Metadata.FindNavigation(nameof(Order.OrderItems)); + + // DDD Patterns comment: + //Set as Field (New since EF 1.1) to access the OrderItem collection property through its field + navigation.SetPropertyAccessMode(PropertyAccessMode.Field); + + orderConfiguration.HasOne() + .WithMany() + .HasForeignKey("PaymentMethodId") + .IsRequired(false) + .OnDelete(DeleteBehavior.Restrict); + + orderConfiguration.HasOne() + .WithMany() + .IsRequired(false) + .HasForeignKey("BuyerId"); + + orderConfiguration.HasOne(o => o.OrderStatus) + .WithMany() + .HasForeignKey("OrderStatusId"); + } + } +} diff --git a/src/Services/Ordering/Ordering.Infrastructure/EntityConfigurations/OrderItemEntityTypeConfiguration.cs b/src/Services/Ordering/Ordering.Infrastructure/EntityConfigurations/OrderItemEntityTypeConfiguration.cs new file mode 100644 index 000000000..ca16eddad --- /dev/null +++ b/src/Services/Ordering/Ordering.Infrastructure/EntityConfigurations/OrderItemEntityTypeConfiguration.cs @@ -0,0 +1,44 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate; +using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure; + +namespace Ordering.Infrastructure.EntityConfigurations +{ + class OrderItemEntityTypeConfiguration + : IEntityTypeConfiguration + { + public void Configure(EntityTypeBuilder orderItemConfiguration) + { + orderItemConfiguration.ToTable("orderItems", OrderingContext.DEFAULT_SCHEMA); + + orderItemConfiguration.HasKey(o => o.Id); + + orderItemConfiguration.Ignore(b => b.DomainEvents); + + orderItemConfiguration.Property(o => o.Id) + .ForSqlServerUseSequenceHiLo("orderitemseq"); + + orderItemConfiguration.Property("OrderId") + .IsRequired(); + + orderItemConfiguration.Property("Discount") + .IsRequired(); + + orderItemConfiguration.Property("ProductId") + .IsRequired(); + + orderItemConfiguration.Property("ProductName") + .IsRequired(); + + orderItemConfiguration.Property("UnitPrice") + .IsRequired(); + + orderItemConfiguration.Property("Units") + .IsRequired(); + + orderItemConfiguration.Property("PictureUrl") + .IsRequired(false); + } + } +} diff --git a/src/Services/Ordering/Ordering.Infrastructure/EntityConfigurations/OrderStatusEntityTypeConfiguration.cs b/src/Services/Ordering/Ordering.Infrastructure/EntityConfigurations/OrderStatusEntityTypeConfiguration.cs new file mode 100644 index 000000000..f968d9011 --- /dev/null +++ b/src/Services/Ordering/Ordering.Infrastructure/EntityConfigurations/OrderStatusEntityTypeConfiguration.cs @@ -0,0 +1,27 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate; +using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure; + +namespace Ordering.Infrastructure.EntityConfigurations +{ + class OrderStatusEntityTypeConfiguration + : IEntityTypeConfiguration + { + public void Configure(EntityTypeBuilder orderStatusConfiguration) + { + orderStatusConfiguration.ToTable("orderstatus", OrderingContext.DEFAULT_SCHEMA); + + orderStatusConfiguration.HasKey(o => o.Id); + + orderStatusConfiguration.Property(o => o.Id) + .HasDefaultValue(1) + .ValueGeneratedNever() + .IsRequired(); + + orderStatusConfiguration.Property(o => o.Name) + .HasMaxLength(200) + .IsRequired(); + } + } +} diff --git a/src/Services/Ordering/Ordering.Infrastructure/EntityConfigurations/PaymentMethodEntityTypeConfiguration.cs b/src/Services/Ordering/Ordering.Infrastructure/EntityConfigurations/PaymentMethodEntityTypeConfiguration.cs new file mode 100644 index 000000000..871c2057e --- /dev/null +++ b/src/Services/Ordering/Ordering.Infrastructure/EntityConfigurations/PaymentMethodEntityTypeConfiguration.cs @@ -0,0 +1,49 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate; +using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure; +using System; + +namespace Ordering.Infrastructure.EntityConfigurations +{ + class PaymentMethodEntityTypeConfiguration + : IEntityTypeConfiguration + { + public void Configure(EntityTypeBuilder paymentConfiguration) + { + paymentConfiguration.ToTable("paymentmethods", OrderingContext.DEFAULT_SCHEMA); + + paymentConfiguration.HasKey(b => b.Id); + + paymentConfiguration.Ignore(b => b.DomainEvents); + + paymentConfiguration.Property(b => b.Id) + .ForSqlServerUseSequenceHiLo("paymentseq", OrderingContext.DEFAULT_SCHEMA); + + paymentConfiguration.Property("BuyerId") + .IsRequired(); + + paymentConfiguration.Property("CardHolderName") + .HasMaxLength(200) + .IsRequired(); + + paymentConfiguration.Property("Alias") + .HasMaxLength(200) + .IsRequired(); + + paymentConfiguration.Property("CardNumber") + .HasMaxLength(25) + .IsRequired(); + + paymentConfiguration.Property("Expiration") + .IsRequired(); + + paymentConfiguration.Property("CardTypeId") + .IsRequired(); + + paymentConfiguration.HasOne(p => p.CardType) + .WithMany() + .HasForeignKey("CardTypeId"); + } + } +} diff --git a/src/Services/Ordering/Ordering.Infrastructure/OrderingContext.cs b/src/Services/Ordering/Ordering.Infrastructure/OrderingContext.cs index 85e2cb0f9..3fe60a2c2 100644 --- a/src/Services/Ordering/Ordering.Infrastructure/OrderingContext.cs +++ b/src/Services/Ordering/Ordering.Infrastructure/OrderingContext.cs @@ -1,12 +1,10 @@ using MediatR; using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Metadata.Builders; using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate; using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate; using Microsoft.eShopOnContainers.Services.Ordering.Domain.Seedwork; -using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Idempotency; using Ordering.Infrastructure; +using Ordering.Infrastructure.EntityConfigurations; using System; using System.Threading; using System.Threading.Tasks; @@ -17,7 +15,7 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure : DbContext,IUnitOfWork { - const string DEFAULT_SCHEMA = "ordering"; + public const string DEFAULT_SCHEMA = "ordering"; public DbSet Orders { get; set; } @@ -40,6 +38,7 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure } private OrderingContext(DbContextOptions options) : base (options) { } + public OrderingContext(DbContextOptions options, IMediator mediator) : base(options) { _mediator = mediator ?? throw new ArgumentNullException(nameof(mediator)); @@ -50,193 +49,13 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure protected override void OnModelCreating(ModelBuilder modelBuilder) { - - modelBuilder.Entity(ConfigureRequests); - modelBuilder.Entity(ConfigurePayment); - modelBuilder.Entity(ConfigureOrder); - modelBuilder.Entity(ConfigureOrderItems); - modelBuilder.Entity(ConfigureCardTypes); - modelBuilder.Entity(ConfigureOrderStatus); - modelBuilder.Entity(ConfigureBuyer); - } - - private void ConfigureRequests(EntityTypeBuilder requestConfiguration) - { - requestConfiguration.ToTable("requests", DEFAULT_SCHEMA); - requestConfiguration.HasKey(cr => cr.Id); - requestConfiguration.Property(cr => cr.Name).IsRequired(); - requestConfiguration.Property(cr => cr.Time).IsRequired(); - } - - - void ConfigureBuyer(EntityTypeBuilder buyerConfiguration) - { - buyerConfiguration.ToTable("buyers", DEFAULT_SCHEMA); - - buyerConfiguration.HasKey(b => b.Id); - - buyerConfiguration.Ignore(b => b.DomainEvents); - - buyerConfiguration.Property(b => b.Id) - .ForSqlServerUseSequenceHiLo("buyerseq", DEFAULT_SCHEMA); - - buyerConfiguration.Property(b=>b.IdentityGuid) - .HasMaxLength(200) - .IsRequired(); - - buyerConfiguration.HasIndex("IdentityGuid") - .IsUnique(true); - - buyerConfiguration.HasMany(b => b.PaymentMethods) - .WithOne() - .HasForeignKey("BuyerId") - .OnDelete(DeleteBehavior.Cascade); - - var navigation = buyerConfiguration.Metadata.FindNavigation(nameof(Buyer.PaymentMethods)); - - navigation.SetPropertyAccessMode(PropertyAccessMode.Field); - } - - void ConfigurePayment(EntityTypeBuilder paymentConfiguration) - { - paymentConfiguration.ToTable("paymentmethods", DEFAULT_SCHEMA); - - paymentConfiguration.HasKey(b => b.Id); - - paymentConfiguration.Ignore(b => b.DomainEvents); - - paymentConfiguration.Property(b => b.Id) - .ForSqlServerUseSequenceHiLo("paymentseq", DEFAULT_SCHEMA); - - paymentConfiguration.Property("BuyerId") - .IsRequired(); - - paymentConfiguration.Property("CardHolderName") - .HasMaxLength(200) - .IsRequired(); - - paymentConfiguration.Property("Alias") - .HasMaxLength(200) - .IsRequired(); - - paymentConfiguration.Property("CardNumber") - .HasMaxLength(25) - .IsRequired(); - - paymentConfiguration.Property("Expiration") - .IsRequired(); - - paymentConfiguration.Property("CardTypeId") - .IsRequired(); - - paymentConfiguration.HasOne(p => p.CardType) - .WithMany() - .HasForeignKey("CardTypeId"); - } - - void ConfigureOrder(EntityTypeBuilder orderConfiguration) - { - orderConfiguration.ToTable("orders", DEFAULT_SCHEMA); - - orderConfiguration.HasKey(o => o.Id); - - orderConfiguration.Ignore(b => b.DomainEvents); - - orderConfiguration.Property(o => o.Id) - .ForSqlServerUseSequenceHiLo("orderseq", DEFAULT_SCHEMA); - - orderConfiguration.OwnsOne(o => o.Address); - - orderConfiguration.Property("OrderDate").IsRequired(); - orderConfiguration.Property("BuyerId").IsRequired(false); - orderConfiguration.Property("OrderStatusId").IsRequired(); - orderConfiguration.Property("PaymentMethodId").IsRequired(false); - orderConfiguration.Property("Description").IsRequired(false); - - var navigation = orderConfiguration.Metadata.FindNavigation(nameof(Order.OrderItems)); - // DDD Patterns comment: - //Set as Field (New since EF 1.1) to access the OrderItem collection property through its field - navigation.SetPropertyAccessMode(PropertyAccessMode.Field); - - orderConfiguration.HasOne() - .WithMany() - .HasForeignKey("PaymentMethodId") - .IsRequired(false) - .OnDelete(DeleteBehavior.Restrict); - - orderConfiguration.HasOne() - .WithMany() - .IsRequired(false) - .HasForeignKey("BuyerId"); - - orderConfiguration.HasOne(o => o.OrderStatus) - .WithMany() - .HasForeignKey("OrderStatusId"); - } - - void ConfigureOrderItems(EntityTypeBuilder orderItemConfiguration) - { - orderItemConfiguration.ToTable("orderItems", DEFAULT_SCHEMA); - - orderItemConfiguration.HasKey(o => o.Id); - - orderItemConfiguration.Ignore(b => b.DomainEvents); - - orderItemConfiguration.Property(o => o.Id) - .ForSqlServerUseSequenceHiLo("orderitemseq"); - - orderItemConfiguration.Property("OrderId") - .IsRequired(); - - orderItemConfiguration.Property("Discount") - .IsRequired(); - - orderItemConfiguration.Property("ProductId") - .IsRequired(); - - orderItemConfiguration.Property("ProductName") - .IsRequired(); - - orderItemConfiguration.Property("UnitPrice") - .IsRequired(); - - orderItemConfiguration.Property("Units") - .IsRequired(); - - orderItemConfiguration.Property("PictureUrl") - .IsRequired(false); - } - - void ConfigureOrderStatus(EntityTypeBuilder orderStatusConfiguration) - { - orderStatusConfiguration.ToTable("orderstatus", DEFAULT_SCHEMA); - - orderStatusConfiguration.HasKey(o => o.Id); - - orderStatusConfiguration.Property(o => o.Id) - .HasDefaultValue(1) - .ValueGeneratedNever() - .IsRequired(); - - orderStatusConfiguration.Property(o => o.Name) - .HasMaxLength(200) - .IsRequired(); - } - - void ConfigureCardTypes(EntityTypeBuilder cardTypesConfiguration) - { - cardTypesConfiguration.ToTable("cardtypes", DEFAULT_SCHEMA); - - cardTypesConfiguration.HasKey(ct => ct.Id); - - cardTypesConfiguration.Property(ct => ct.Id) - .HasDefaultValue(1) - .ValueGeneratedNever() - .IsRequired(); - - cardTypesConfiguration.Property(ct => ct.Name) - .HasMaxLength(200) - .IsRequired(); + modelBuilder.ApplyConfiguration(new ClientRequestEntityTypeConfiguration()); + modelBuilder.ApplyConfiguration(new PaymentMethodEntityTypeConfiguration()); + modelBuilder.ApplyConfiguration(new OrderEntityTypeConfiguration()); + modelBuilder.ApplyConfiguration(new OrderItemEntityTypeConfiguration()); + modelBuilder.ApplyConfiguration(new CardTypeEntityTypeConfiguration()); + modelBuilder.ApplyConfiguration(new OrderStatusEntityTypeConfiguration()); + modelBuilder.ApplyConfiguration(new BuyerEntityTypeConfiguration()); } public async Task SaveEntitiesAsync(CancellationToken cancellationToken = default(CancellationToken)) From 5b90e1efe405ee0b0931af5eef291431079bd89e Mon Sep 17 00:00:00 2001 From: Igor Sychev Date: Sat, 2 Sep 2017 14:14:33 +0300 Subject: [PATCH 53/64] Parallel dotnet build process. it's working 2m 24s instead of 3m 48s (sequential execution) theis only one problem... write-host not working inside the workflow --- cli-windows/build-bits.ps1 | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/cli-windows/build-bits.ps1 b/cli-windows/build-bits.ps1 index 272227b3d..4191515f6 100644 --- a/cli-windows/build-bits.ps1 +++ b/cli-windows/build-bits.ps1 @@ -8,6 +8,9 @@ if ([string]::IsNullOrEmpty($rootPath)) { } Write-Host "Root path used is $rootPath" -ForegroundColor Yellow +workflow BuildAndPublish { + param ([string] $rootPath + ) $projectPaths = @{Path="$rootPath\src\Web\WebMVC";Prj="WebMVC.csproj"}, @{Path="$rootPath\src\Web\WebSPA";Prj="WebSPA.csproj"}, @@ -21,19 +24,20 @@ $projectPaths = @{Path="$rootPath\src\Services\Payment\Payment.API";Prj="Payment.API.csproj"}, @{Path="$rootPath\src\Web\WebStatus";Prj="WebStatus.csproj"} -$projectPaths | foreach { - $projectPath = $_.Path - $projectFile = $_.Prj - $outPath = $_.Path + "\obj\Docker\publish" - $projectPathAndFile = "$projectPath\$projectFile" - Write-Host "Deleting old publish files in $outPath" -ForegroundColor Yellow - remove-item -path $outPath -Force -Recurse -ErrorAction SilentlyContinue - Write-Host "Publishing $projectPathAndFile to $outPath" -ForegroundColor Yellow - dotnet restore $projectPathAndFile - dotnet build $projectPathAndFile - dotnet publish $projectPathAndFile -o $outPath + foreach -parallel ($item in $projectPaths) { + $projectPath = $item.Path + $projectFile = $item.Prj + $outPath = $item.Path + "\obj\Docker\publish" + $projectPathAndFile = "$projectPath\$projectFile" + #Write-Host "Deleting old publish files in $outPath" -ForegroundColor Yellow + remove-item -path $outPath -Force -Recurse -ErrorAction SilentlyContinue + #Write-Host "Publishing $projectPathAndFile to $outPath" -ForegroundColor Yellow + dotnet build $projectPathAndFile + dotnet publish $projectPathAndFile -o $outPath + } } +BuildAndPublish $rootPath ######################################################################################## # Delete old eShop Docker images From c514c8c31d7285ae76d4fc4355c1836c8686be7b Mon Sep 17 00:00:00 2001 From: Igor Sychev Date: Sun, 3 Sep 2017 11:30:27 +0300 Subject: [PATCH 54/64] release publish configuration for win/mac, because for Linux it's already done --- cli-mac/build-bits.sh | 2 +- cli-windows/build-bits.ps1 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cli-mac/build-bits.sh b/cli-mac/build-bits.sh index 681c3605d..fdf61e359 100755 --- a/cli-mac/build-bits.sh +++ b/cli-mac/build-bits.sh @@ -25,7 +25,7 @@ do echo -e "\e[33m\tRestoring project" dotnet restore echo -e "\e[33m\tBuilding and publishing projects" - dotnet publish -o obj/Docker/publish + dotnet publish -o obj/Docker/publish -c Release popd done diff --git a/cli-windows/build-bits.ps1 b/cli-windows/build-bits.ps1 index 272227b3d..f74a00bfa 100644 --- a/cli-windows/build-bits.ps1 +++ b/cli-windows/build-bits.ps1 @@ -31,7 +31,7 @@ $projectPaths | foreach { Write-Host "Publishing $projectPathAndFile to $outPath" -ForegroundColor Yellow dotnet restore $projectPathAndFile dotnet build $projectPathAndFile - dotnet publish $projectPathAndFile -o $outPath + dotnet publish $projectPathAndFile -o $outPath -c Release } From 34a08fb7cbe887450e965e129c8726aa3c2cb523 Mon Sep 17 00:00:00 2001 From: Igor Sychev Date: Sun, 3 Sep 2017 11:50:43 +0300 Subject: [PATCH 55/64] k8 readme fix. --- k8s/readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/k8s/readme.md b/k8s/readme.md index 680652e35..43534d32e 100644 --- a/k8s/readme.md +++ b/k8s/readme.md @@ -9,4 +9,4 @@ Refer to file [README.k8s.md](./README.k8s.md) for detailed information Refer to file [README.CICD.k8s.md](./README.CICD.k8s.md) for information about how to set a VSTS build for deploying on k8s -Refer to file [conf-files.md](./conf-files.md) for a brief descriptio of every YAML file in this folder \ No newline at end of file +Refer to file [conf-files.md](./conf-files.md) for a brief description of every YAML file in this folder \ No newline at end of file From c722d4907bcc1bee85f4507369f17e26111a7bfc Mon Sep 17 00:00:00 2001 From: jacano Date: Mon, 4 Sep 2017 12:42:31 +0200 Subject: [PATCH 56/64] project.json removed from core --- .../eShopOnContainers.Core/project.json | 24 ------------------- 1 file changed, 24 deletions(-) delete mode 100755 src/Mobile/eShopOnContainers/eShopOnContainers.Core/project.json diff --git a/src/Mobile/eShopOnContainers/eShopOnContainers.Core/project.json b/src/Mobile/eShopOnContainers/eShopOnContainers.Core/project.json deleted file mode 100755 index a832cc982..000000000 --- a/src/Mobile/eShopOnContainers/eShopOnContainers.Core/project.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "dependencies": { - "Acr.UserDialogs": "6.3.3", - "Autofac": "4.5.0", - "IdentityModel": "1.3.1", - "Microsoft.Bcl": "1.1.10", - "Microsoft.Bcl.Build": "1.0.21", - "Microsoft.Net.Http": "2.2.29", - "modernhttpclient": "2.4.2", - "Newtonsoft.Json": "9.0.1", - "PCLCrypto": "2.0.147", - "SlideOverKit": "2.1.4", - "Splat": "1.6.2", - "System.ComponentModel.Annotations": "4.3.0", - "Xam.Plugin.Geolocator": "3.0.4", - "Xam.Plugins.Settings": "2.6.0.12-beta", - "Xamarin.FFImageLoading": "2.2.9", - "Xamarin.FFImageLoading.Forms": "2.2.9", - "Xamarin.Forms": "2.3.4.231" - }, - "frameworks": { - ".NETPortable,Version=v4.5,Profile=Profile111": {} - } -} \ No newline at end of file From 6515a3b58fcfbccc7fad502ce18d49a5048943bc Mon Sep 17 00:00:00 2001 From: jacano Date: Mon, 4 Sep 2017 12:32:46 +0200 Subject: [PATCH 57/64] update sdk to 2.0.2 --- global.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global.json b/global.json index bfd985e30..dfad1f9f9 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,5 @@ { "sdk": { - "version":"2.0.0" + "version":"2.0.2" } } \ No newline at end of file From f01431407a64fc13706846630807c3930b8a8034 Mon Sep 17 00:00:00 2001 From: jacano Date: Mon, 4 Sep 2017 12:28:21 +0200 Subject: [PATCH 58/64] UWP in netstandard 2 --- ...ShopOnContainers.TestRunner.Windows.csproj | 20 ++++--- .../project.json | 18 ------- .../eShopOnContainers.Windows.csproj | 53 +++++++++++++++---- .../eShopOnContainers.Windows/project.json | 26 --------- 4 files changed, 58 insertions(+), 59 deletions(-) delete mode 100755 src/Mobile/eShopOnContainers/eShopOnContainers.TestRunner.Windows/project.json delete mode 100644 src/Mobile/eShopOnContainers/eShopOnContainers.Windows/project.json diff --git a/src/Mobile/eShopOnContainers/eShopOnContainers.TestRunner.Windows/eShopOnContainers.TestRunner.Windows.csproj b/src/Mobile/eShopOnContainers/eShopOnContainers.TestRunner.Windows/eShopOnContainers.TestRunner.Windows.csproj index 61229f89a..2e01e5b11 100755 --- a/src/Mobile/eShopOnContainers/eShopOnContainers.TestRunner.Windows/eShopOnContainers.TestRunner.Windows.csproj +++ b/src/Mobile/eShopOnContainers/eShopOnContainers.TestRunner.Windows/eShopOnContainers.TestRunner.Windows.csproj @@ -11,13 +11,14 @@ eShopOnContainers.TestRunner.Windows en-US UAP - 10.0.14393.0 - 10.0.10586.0 + 10.0.16267.0 + 10.0.16267.0 14 512 {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} true eShopOnContainers.TestRunner.Windows_TemporaryKey.pfx + win10-arm;win10-arm-aot;win10-x86;win10-x86-aot;win10-x64;win10-x64-aot true @@ -88,10 +89,6 @@ true true - - - - App.xaml @@ -130,6 +127,17 @@ eShopOnContainers.UnitTests + + + 6.0.0-preview1-25611-03 + + + 2.3.4.231 + + + 2.1.0 + + 14.0 diff --git a/src/Mobile/eShopOnContainers/eShopOnContainers.TestRunner.Windows/project.json b/src/Mobile/eShopOnContainers/eShopOnContainers.TestRunner.Windows/project.json deleted file mode 100755 index f32fb6319..000000000 --- a/src/Mobile/eShopOnContainers/eShopOnContainers.TestRunner.Windows/project.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "dependencies": { - "Microsoft.NETCore.UniversalWindowsPlatform": "5.3.3", - "Xamarin.Forms": "2.3.4.231", - "xunit.runner.devices": "2.1.0" - }, - "frameworks": { - "uap10.0": {} - }, - "runtimes": { - "win10-arm": {}, - "win10-arm-aot": {}, - "win10-x86": {}, - "win10-x86-aot": {}, - "win10-x64": {}, - "win10-x64-aot": {} - } -} \ No newline at end of file diff --git a/src/Mobile/eShopOnContainers/eShopOnContainers.Windows/eShopOnContainers.Windows.csproj b/src/Mobile/eShopOnContainers/eShopOnContainers.Windows/eShopOnContainers.Windows.csproj index 342acf6b2..5f9a72577 100644 --- a/src/Mobile/eShopOnContainers/eShopOnContainers.Windows/eShopOnContainers.Windows.csproj +++ b/src/Mobile/eShopOnContainers/eShopOnContainers.Windows/eShopOnContainers.Windows.csproj @@ -11,14 +11,16 @@ eShopOnContainers.Windows en-US UAP - 10.0.10586.0 - 10.0.10586.0 + 10.0.16267.0 + 10.0.16267.0 14 true + true 512 {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} Windows_TemporaryKey.pfx true + win10-arm;win10-arm-aot;win10-x86;win10-x86-aot;win10-x64;win10-x64-aot true @@ -100,7 +102,6 @@ Assets\Fonts\SourceSansPro-Regular.ttf - @@ -171,18 +172,52 @@ Designer - - - Windows Mobile Extensions for the UWP - - {67f9d3a8-f71e-4428-913f-c37ae82cdb24} eShopOnContainers.Core - + + + 6.3.3 + + + 2.10.0 + + + 6.0.0-preview1-25611-03 + + + 10.0.3 + + + 2.0.147 + + + 2.1.4 + + + 3.0.4 + + + 2.6.0.12-beta + + + 2.2.9 + + + 2.2.9 + + + 2.3.4.231 + + + + + Windows Mobile Extensions for the UWP + + 14.0 diff --git a/src/Mobile/eShopOnContainers/eShopOnContainers.Windows/project.json b/src/Mobile/eShopOnContainers/eShopOnContainers.Windows/project.json deleted file mode 100644 index faafe1f18..000000000 --- a/src/Mobile/eShopOnContainers/eShopOnContainers.Windows/project.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "dependencies": { - "Acr.UserDialogs": "6.3.3", - "IdentityModel": "1.3.1", - "Microsoft.NETCore.UniversalWindowsPlatform": "5.3.3", - "Newtonsoft.Json": "9.0.1", - "PCLCrypto": "2.0.147", - "SlideOverKit": "2.1.4", - "Xam.Plugin.Geolocator": "3.0.4", - "Xam.Plugins.Settings": "2.6.0.12-beta", - "Xamarin.FFImageLoading": "2.2.9", - "Xamarin.FFImageLoading.Forms": "2.2.9", - "Xamarin.Forms": "2.3.4.231" - }, - "frameworks": { - "uap10.0": {} - }, - "runtimes": { - "win10-arm": {}, - "win10-arm-aot": {}, - "win10-x86": {}, - "win10-x86-aot": {}, - "win10-x64": {}, - "win10-x64-aot": {} - } -} \ No newline at end of file From d3aa16f27de1e2be6979fe4426d5fb01c4be10df Mon Sep 17 00:00:00 2001 From: jacano Date: Fri, 1 Sep 2017 19:27:20 +0200 Subject: [PATCH 59/64] UITest to package reference --- .../eShopOnContainers.UITests.csproj | 31 +++++-------------- 1 file changed, 7 insertions(+), 24 deletions(-) diff --git a/src/Mobile/eShopOnContainers/eShopOnContainers.UITests/eShopOnContainers.UITests.csproj b/src/Mobile/eShopOnContainers/eShopOnContainers.UITests/eShopOnContainers.UITests.csproj index aa4f41fa2..faef9f61f 100644 --- a/src/Mobile/eShopOnContainers/eShopOnContainers.UITests/eShopOnContainers.UITests.csproj +++ b/src/Mobile/eShopOnContainers/eShopOnContainers.UITests/eShopOnContainers.UITests.csproj @@ -28,32 +28,15 @@ false - - ..\..\..\..\packages\NUnitTestAdapter.2.0.0\lib\nunit.core.dll - False - - - ..\..\..\..\packages\NUnitTestAdapter.2.0.0\lib\nunit.core.interfaces.dll - False - - - ..\..\..\..\packages\NUnit.2.6.4\lib\nunit.framework.dll - True - - - ..\..\..\..\packages\NUnitTestAdapter.2.0.0\lib\nunit.util.dll - False - - - ..\..\..\..\packages\NUnitTestAdapter.2.0.0\lib\NUnit.VisualStudio.TestAdapter.dll - False - - - ..\..\..\..\packages\Xamarin.UITest.2.0.3\lib\Xamarin.UITest.dll - True - + + + + + + + From 208047c6ca73f3a074788c9cf951573de6a8d604 Mon Sep 17 00:00:00 2001 From: jacano Date: Fri, 1 Sep 2017 19:22:45 +0200 Subject: [PATCH 60/64] test runners updated --- .../eShopOnContainers.TestRunner.Droid.csproj | 226 +++--------------- .../eShopOnContainers.TestRunner.iOS.csproj | 156 +++--------- 2 files changed, 64 insertions(+), 318 deletions(-) diff --git a/src/Mobile/eShopOnContainers/eShopOnContainers.TestRunner.Droid/eShopOnContainers.TestRunner.Droid.csproj b/src/Mobile/eShopOnContainers/eShopOnContainers.TestRunner.Droid/eShopOnContainers.TestRunner.Droid.csproj index 326158569..6cfb21aed 100644 --- a/src/Mobile/eShopOnContainers/eShopOnContainers.TestRunner.Droid/eShopOnContainers.TestRunner.Droid.csproj +++ b/src/Mobile/eShopOnContainers/eShopOnContainers.TestRunner.Droid/eShopOnContainers.TestRunner.Droid.csproj @@ -45,174 +45,6 @@ 4 False - - - ..\..\..\..\packages\Xamarin.Forms.2.3.4.231\lib\MonoAndroid10\FormsViewGroup.dll - - - - - ..\..\..\..\packages\PCLCrypto.2.0.147\lib\MonoAndroid23\PCLCrypto.dll - - - ..\..\..\..\packages\PInvoke.BCrypt.0.3.2\lib\portable-net45+win+wpa81+MonoAndroid10+xamarinios10+MonoTouch10\PInvoke.BCrypt.dll - - - ..\..\..\..\packages\PInvoke.Kernel32.0.3.2\lib\portable-net45+win+wpa81+MonoAndroid10+xamarinios10+MonoTouch10\PInvoke.Kernel32.dll - - - ..\..\..\..\packages\PInvoke.NCrypt.0.3.2\lib\portable-net45+win+wpa81+MonoAndroid10+xamarinios10+MonoTouch10\PInvoke.NCrypt.dll - - - ..\..\..\..\packages\PInvoke.Windows.Core.0.3.2\lib\portable-net45+win+wpa81+MonoAndroid10+xamarinios10+MonoTouch10\PInvoke.Windows.Core.dll - - - ..\..\..\..\packages\Plugin.CurrentActivity.1.0.1\lib\MonoAndroid10\Plugin.CurrentActivity.dll - - - ..\..\..\..\packages\Xam.Plugin.Geolocator.3.0.4\lib\MonoAndroid10\Plugin.Geolocator.dll - - - ..\..\..\..\packages\Xam.Plugin.Geolocator.3.0.4\lib\MonoAndroid10\Plugin.Geolocator.Abstractions.dll - - - ..\..\..\..\packages\Plugin.Permissions.1.1.7\lib\MonoAndroid10\Plugin.Permissions.dll - - - ..\..\..\..\packages\Plugin.Permissions.1.1.7\lib\MonoAndroid10\Plugin.Permissions.Abstractions.dll - - - - - ..\..\..\..\packages\Microsoft.Net.Http.2.2.29\lib\monoandroid\System.Net.Http.Extensions.dll - - - ..\..\..\..\packages\Microsoft.Net.Http.2.2.29\lib\monoandroid\System.Net.Http.Primitives.dll - - - - - ..\..\..\..\packages\Validation.2.2.8\lib\dotnet\Validation.dll - - - ..\..\..\..\packages\Xamarin.Android.Support.Animated.Vector.Drawable.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.Animated.Vector.Drawable.dll - True - - - ..\..\..\..\packages\Xamarin.Android.Support.Design.23.3.0\lib\MonoAndroid43\Xamarin.Android.Support.Design.dll - True - - - ..\..\..\..\packages\Xamarin.Android.Support.v4.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.v4.dll - True - - - ..\..\..\..\packages\Xamarin.Android.Support.v7.AppCompat.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.v7.AppCompat.dll - True - - - ..\..\..\..\packages\Xamarin.Android.Support.v7.CardView.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.v7.CardView.dll - True - - - ..\..\..\..\packages\Xamarin.Android.Support.v7.MediaRouter.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.v7.MediaRouter.dll - True - - - ..\..\..\..\packages\Xamarin.Android.Support.v7.RecyclerView.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.v7.RecyclerView.dll - True - - - ..\..\..\..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.Vector.Drawable.dll - True - - - ..\..\..\..\packages\Xamarin.Forms.2.3.4.231\lib\MonoAndroid10\Xamarin.Forms.Core.dll - - - ..\..\..\..\packages\Xamarin.Forms.2.3.4.231\lib\MonoAndroid10\Xamarin.Forms.Platform.dll - - - ..\..\..\..\packages\Xamarin.Forms.2.3.4.231\lib\MonoAndroid10\Xamarin.Forms.Platform.Android.dll - - - ..\..\..\..\packages\Xamarin.Forms.2.3.4.231\lib\MonoAndroid10\Xamarin.Forms.Xaml.dll - - - ..\..\..\..\packages\xunit.abstractions.2.0.0\lib\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.abstractions.dll - - - ..\..\..\..\packages\xunit.extensibility.core.2.1.0\lib\dotnet\xunit.core.dll - - - ..\..\..\..\packages\xunit.extensibility.execution.2.1.0\lib\monoandroid\xunit.execution.dotnet.dll - - - ..\..\..\..\packages\xunit.runner.utility.2.1.0\lib\dotnet\xunit.runner.utility.dotnet.dll - - - ..\..\..\..\packages\xunit.runner.devices.2.1.0\lib\MonoAndroid\xunit.runner.devices.dll - - - ..\..\..\..\packages\Newtonsoft.Json.9.0.1\lib\portable-net45+wp80+win8+wpa81\Newtonsoft.Json.dll - - - - - ..\..\..\..\packages\Autofac.4.5.0\lib\netstandard1.1\Autofac.dll - - - ..\..\..\..\packages\Xam.Plugins.Settings.2.6.0.12-beta\lib\MonoAndroid10\Plugin.Settings.Abstractions.dll - - - ..\..\..\..\packages\Xam.Plugins.Settings.2.6.0.12-beta\lib\MonoAndroid10\Plugin.Settings.dll - - - ..\..\..\..\packages\xunit.assert.2.2.0\lib\netstandard1.1\xunit.assert.dll - - - ..\..\..\..\packages\SlideOverKit.2.1.4\lib\MonoAndroid10\SlideOverKit.dll - - - ..\..\..\..\packages\SlideOverKit.2.1.4\lib\MonoAndroid10\SlideOverKit.Droid.dll - - - ..\..\..\..\packages\Acr.Support.2.1.0\lib\MonoAndroid10\Acr.Support.Android.dll - - - ..\..\..\..\packages\AndHUD.1.2.0\lib\MonoAndroid\AndHUD.dll - - - ..\..\..\..\packages\Splat.1.6.2\lib\monoandroid\Splat.dll - - - ..\..\..\..\packages\Acr.UserDialogs.6.3.3\lib\MonoAndroid10\Acr.UserDialogs.dll - - - ..\..\..\..\packages\Acr.UserDialogs.6.3.3\lib\MonoAndroid10\Acr.UserDialogs.Interface.dll - - - ..\..\..\..\packages\IdentityModel.1.3.1\lib\portable-net45+wp80+win8+wpa81\IdentityModel.Portable.dll - - - ..\..\..\..\packages\Xamarin.FFImageLoading.2.2.9\lib\MonoAndroid10\FFImageLoading.dll - - - ..\..\..\..\packages\Xamarin.FFImageLoading.2.2.9\lib\MonoAndroid10\FFImageLoading.Platform.dll - - - ..\..\..\..\packages\Xamarin.FFImageLoading.Forms.2.2.9\lib\MonoAndroid10\FFImageLoading.Forms.dll - - - ..\..\..\..\packages\Xamarin.FFImageLoading.Forms.2.2.9\lib\MonoAndroid10\FFImageLoading.Forms.Droid.dll - - - ..\..\..\..\packages\modernhttpclient.2.4.2\lib\MonoAndroid\ModernHttpClient.dll - - - ..\..\..\..\packages\modernhttpclient.2.4.2\lib\MonoAndroid\OkHttp.dll - - @@ -221,9 +53,6 @@ - - Designer - @@ -241,6 +70,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 2.2.0 + + {f7b6a162-bc4d-4924-b16a-713f9b0344e7} @@ -248,22 +114,4 @@ - - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - - - \ No newline at end of file diff --git a/src/Mobile/eShopOnContainers/eShopOnContainers.TestRunner.iOS/eShopOnContainers.TestRunner.iOS.csproj b/src/Mobile/eShopOnContainers/eShopOnContainers.TestRunner.iOS/eShopOnContainers.TestRunner.iOS.csproj index 78410457a..6ff33a496 100644 --- a/src/Mobile/eShopOnContainers/eShopOnContainers.TestRunner.iOS/eShopOnContainers.TestRunner.iOS.csproj +++ b/src/Mobile/eShopOnContainers/eShopOnContainers.TestRunner.iOS/eShopOnContainers.TestRunner.iOS.csproj @@ -106,130 +106,37 @@ - - - - - ..\..\..\..\packages\PCLCrypto.2.0.147\lib\xamarinios10\PCLCrypto.dll - - - ..\..\..\..\packages\PInvoke.BCrypt.0.3.2\lib\portable-net45+win+wpa81+MonoAndroid10+xamarinios10+MonoTouch10\PInvoke.BCrypt.dll - - - ..\..\..\..\packages\PInvoke.Kernel32.0.3.2\lib\portable-net45+win+wpa81+MonoAndroid10+xamarinios10+MonoTouch10\PInvoke.Kernel32.dll - - - ..\..\..\..\packages\PInvoke.NCrypt.0.3.2\lib\portable-net45+win+wpa81+MonoAndroid10+xamarinios10+MonoTouch10\PInvoke.NCrypt.dll - - - ..\..\..\..\packages\PInvoke.Windows.Core.0.3.2\lib\portable-net45+win+wpa81+MonoAndroid10+xamarinios10+MonoTouch10\PInvoke.Windows.Core.dll - - - - ..\..\..\..\packages\Microsoft.Net.Http.2.2.29\lib\Xamarin.iOS10\System.Net.Http.Extensions.dll - - - ..\..\..\..\packages\Microsoft.Net.Http.2.2.29\lib\Xamarin.iOS10\System.Net.Http.Primitives.dll - - - - - ..\..\..\..\packages\Validation.2.2.8\lib\dotnet\Validation.dll - - - ..\..\..\..\packages\Xamarin.Forms.2.3.4.231\lib\Xamarin.iOS10\Xamarin.Forms.Core.dll - - - ..\..\..\..\packages\Xamarin.Forms.2.3.4.231\lib\Xamarin.iOS10\Xamarin.Forms.Platform.dll - - - ..\..\..\..\packages\Xamarin.Forms.2.3.4.231\lib\Xamarin.iOS10\Xamarin.Forms.Platform.iOS.dll - - - ..\..\..\..\packages\Xamarin.Forms.2.3.4.231\lib\Xamarin.iOS10\Xamarin.Forms.Xaml.dll - - - - ..\..\..\..\packages\xunit.abstractions.2.0.0\lib\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.abstractions.dll - - - ..\..\..\..\packages\xunit.extensibility.core.2.1.0\lib\dotnet\xunit.core.dll - - - ..\..\..\..\packages\xunit.extensibility.execution.2.1.0\lib\xamarinios\xunit.execution.dotnet.dll - - - ..\..\..\..\packages\xunit.runner.utility.2.1.0\lib\dotnet\xunit.runner.utility.dotnet.dll - - - ..\..\..\..\packages\xunit.runner.devices.2.1.0\lib\Xamarin.iOS\xunit.runner.devices.dll - - - - - ..\..\..\..\packages\xunit.assert.2.2.0\lib\netstandard1.1\xunit.assert.dll - - - ..\..\..\..\packages\Newtonsoft.Json.9.0.1\lib\portable-net45+wp80+win8+wpa81\Newtonsoft.Json.dll - - - ..\..\..\..\packages\Autofac.4.5.0\lib\netstandard1.1\Autofac.dll - - - ..\..\..\..\packages\Xam.Plugins.Settings.2.6.0.12-beta\lib\Xamarin.iOS10\Plugin.Settings.Abstractions.dll - - - ..\..\..\..\packages\Xam.Plugins.Settings.2.6.0.12-beta\lib\Xamarin.iOS10\Plugin.Settings.dll - - - ..\..\..\..\packages\SlideOverKit.2.1.4\lib\Xamarin.iOS10\SlideOverKit.dll - - - ..\..\..\..\packages\SlideOverKit.2.1.4\lib\Xamarin.iOS10\SlideOverKit.iOS.dll - - - ..\..\..\..\packages\Acr.Support.2.1.0\lib\Xamarin.iOS10\Acr.Support.iOS.dll - - - ..\..\..\..\packages\Splat.1.6.2\lib\Xamarin.iOS10\Splat.dll - - - ..\..\..\..\packages\Acr.UserDialogs.6.3.3\lib\Xamarin.iOS10\Acr.UserDialogs.dll - - - ..\..\..\..\packages\Acr.UserDialogs.6.3.3\lib\Xamarin.iOS10\Acr.UserDialogs.Interface.dll - - - ..\..\..\..\packages\IdentityModel.1.3.1\lib\portable-net45+wp80+win8+wpa81\IdentityModel.Portable.dll - - - ..\..\..\..\packages\WebP.Touch.1.0.3\lib\Xamarin.iOS10\WebP.Touch.dll - - - ..\..\..\..\packages\Xamarin.FFImageLoading.2.2.9\lib\Xamarin.iOS10\FFImageLoading.dll - - - ..\..\..\..\packages\Xamarin.FFImageLoading.2.2.9\lib\Xamarin.iOS10\FFImageLoading.Platform.dll - - - ..\..\..\..\packages\Xamarin.FFImageLoading.Forms.2.2.9\lib\Xamarin.iOS10\FFImageLoading.Forms.dll - - - ..\..\..\..\packages\Xamarin.FFImageLoading.Forms.2.2.9\lib\Xamarin.iOS10\FFImageLoading.Forms.Touch.dll - - - ..\..\..\..\packages\modernhttpclient.2.4.2\lib\Xamarin.iOS10\ModernHttpClient.dll - - - ..\..\..\..\packages\Xam.Plugin.Geolocator.3.0.4\lib\Xamarin.iOS10\Plugin.Geolocator.Abstractions.dll - - - ..\..\..\..\packages\Xam.Plugin.Geolocator.3.0.4\lib\Xamarin.iOS10\Plugin.Geolocator.dll - + + + + + + + + + + + + + + + + + + + + + + + + + 2.2.0 + + {f7b6a162-bc4d-4924-b16a-713f9b0344e7} @@ -237,13 +144,4 @@ - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - \ No newline at end of file From 41d9afb84df3a9b3dbbeb8e0cec88deb67edf945 Mon Sep 17 00:00:00 2001 From: jacano Date: Fri, 1 Sep 2017 19:05:05 +0200 Subject: [PATCH 61/64] Core, Android and iOS project updated to netstandard 2.0 --- .../eShopOnContainers.Core.csproj | 342 ++---------------- .../eShopOnContainers.Core.csproj.bak | 322 +++++++++++++++++ .../eShopOnContainers.Droid.csproj | 201 ++-------- .../{packages.config => packages.config.bak} | 0 .../eShopOnContainers.UnitTests.csproj | 75 +--- .../eShopOnContainers.UnitTests.csproj.bak | 71 ++++ .../eShopOnContainers.iOS.csproj | 137 +------ .../{packages.config => packages.config.bak} | 0 8 files changed, 480 insertions(+), 668 deletions(-) create mode 100644 src/Mobile/eShopOnContainers/eShopOnContainers.Core/eShopOnContainers.Core.csproj.bak rename src/Mobile/eShopOnContainers/eShopOnContainers.Droid/{packages.config => packages.config.bak} (100%) create mode 100644 src/Mobile/eShopOnContainers/eShopOnContainers.UnitTests/eShopOnContainers.UnitTests.csproj.bak rename src/Mobile/eShopOnContainers/eShopOnContainers.iOS/{packages.config => packages.config.bak} (100%) diff --git a/src/Mobile/eShopOnContainers/eShopOnContainers.Core/eShopOnContainers.Core.csproj b/src/Mobile/eShopOnContainers/eShopOnContainers.Core/eShopOnContainers.Core.csproj index 9b2619bc9..90c478422 100644 --- a/src/Mobile/eShopOnContainers/eShopOnContainers.Core/eShopOnContainers.Core.csproj +++ b/src/Mobile/eShopOnContainers/eShopOnContainers.Core/eShopOnContainers.Core.csproj @@ -1,322 +1,34 @@ - - - + + - 10.0 - Debug - AnyCPU - {67F9D3A8-F71E-4428-913F-C37AE82CDB24} - Library - Properties - eShopOnContainers.Core - eShopOnContainers.Core - v4.5 - 512 - {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - - - Profile111 - - - true + netstandard2.0 + portable-net45+win8+wpa81+wp8 full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 + false + - - - - - - App.xaml - - - - - AddBasketButton.xaml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - BasketView.xaml - - - CampaignView.xaml - - - CatalogView.xaml - - - CampaignDetailsView.xaml - - - CheckoutView.xaml - - - CustomNavigationView.xaml - - - FiltersView.xaml - - - LoginView.xaml - - - MainView.xaml - - - OrderDetailView.xaml - - - ProfileView.xaml - - - SettingsView.xaml - - - BasketItemTemplate.xaml - - - OrderItemTemplate.xaml - - - OrderTemplate.xaml - - - CampaignTemplate.xaml - - - ProductTemplate.xaml - - - - - - - + + + + + + + + + + + + + + - - + + + + + - - - Designer - MSBuild:UpdateDesignTimeXaml - - - Designer - MSBuild:UpdateDesignTimeXaml - - - Designer - MSBuild:UpdateDesignTimeXaml - - - Designer - MSBuild:UpdateDesignTimeXaml - - - Designer - MSBuild:UpdateDesignTimeXaml - - - - - Designer - MSBuild:UpdateDesignTimeXaml - - - - - Designer - MSBuild:UpdateDesignTimeXaml - - - - - Designer - MSBuild:UpdateDesignTimeXaml - - - - - Designer - MSBuild:UpdateDesignTimeXaml - - - - - Designer - MSBuild:UpdateDesignTimeXaml - - - - - Designer - MSBuild:UpdateDesignTimeXaml - - - - - Designer - MSBuild:UpdateDesignTimeXaml - - - - - Designer - MSBuild:UpdateDesignTimeXaml - - - - - Designer - MSBuild:UpdateDesignTimeXaml - - - - - Designer - MSBuild:UpdateDesignTimeXaml - - - - - Designer - MSBuild:UpdateDesignTimeXaml - - - - - MSBuild:UpdateDesignTimeXaml - Designer - - - - - MSBuild:UpdateDesignTimeXaml - Designer - - - - - MSBuild:UpdateDesignTimeXaml - Designer - - - - - - This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - \ No newline at end of file + + diff --git a/src/Mobile/eShopOnContainers/eShopOnContainers.Core/eShopOnContainers.Core.csproj.bak b/src/Mobile/eShopOnContainers/eShopOnContainers.Core/eShopOnContainers.Core.csproj.bak new file mode 100644 index 000000000..9b2619bc9 --- /dev/null +++ b/src/Mobile/eShopOnContainers/eShopOnContainers.Core/eShopOnContainers.Core.csproj.bak @@ -0,0 +1,322 @@ + + + + + 10.0 + Debug + AnyCPU + {67F9D3A8-F71E-4428-913F-C37AE82CDB24} + Library + Properties + eShopOnContainers.Core + eShopOnContainers.Core + v4.5 + 512 + {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + + + Profile111 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + App.xaml + + + + + AddBasketButton.xaml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + BasketView.xaml + + + CampaignView.xaml + + + CatalogView.xaml + + + CampaignDetailsView.xaml + + + CheckoutView.xaml + + + CustomNavigationView.xaml + + + FiltersView.xaml + + + LoginView.xaml + + + MainView.xaml + + + OrderDetailView.xaml + + + ProfileView.xaml + + + SettingsView.xaml + + + BasketItemTemplate.xaml + + + OrderItemTemplate.xaml + + + OrderTemplate.xaml + + + CampaignTemplate.xaml + + + ProductTemplate.xaml + + + + + + + + + + + + + + + Designer + MSBuild:UpdateDesignTimeXaml + + + Designer + MSBuild:UpdateDesignTimeXaml + + + Designer + MSBuild:UpdateDesignTimeXaml + + + Designer + MSBuild:UpdateDesignTimeXaml + + + Designer + MSBuild:UpdateDesignTimeXaml + + + + + Designer + MSBuild:UpdateDesignTimeXaml + + + + + Designer + MSBuild:UpdateDesignTimeXaml + + + + + Designer + MSBuild:UpdateDesignTimeXaml + + + + + Designer + MSBuild:UpdateDesignTimeXaml + + + + + Designer + MSBuild:UpdateDesignTimeXaml + + + + + Designer + MSBuild:UpdateDesignTimeXaml + + + + + Designer + MSBuild:UpdateDesignTimeXaml + + + + + Designer + MSBuild:UpdateDesignTimeXaml + + + + + Designer + MSBuild:UpdateDesignTimeXaml + + + + + Designer + MSBuild:UpdateDesignTimeXaml + + + + + Designer + MSBuild:UpdateDesignTimeXaml + + + + + MSBuild:UpdateDesignTimeXaml + Designer + + + + + MSBuild:UpdateDesignTimeXaml + Designer + + + + + MSBuild:UpdateDesignTimeXaml + Designer + + + + + + This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + \ No newline at end of file diff --git a/src/Mobile/eShopOnContainers/eShopOnContainers.Droid/eShopOnContainers.Droid.csproj b/src/Mobile/eShopOnContainers/eShopOnContainers.Droid/eShopOnContainers.Droid.csproj index 41c864d97..a96ca94ac 100644 --- a/src/Mobile/eShopOnContainers/eShopOnContainers.Droid/eShopOnContainers.Droid.csproj +++ b/src/Mobile/eShopOnContainers/eShopOnContainers.Droid/eShopOnContainers.Droid.csproj @@ -54,170 +54,9 @@ SdkOnly - - ..\..\..\..\packages\Acr.Support.2.1.0\lib\MonoAndroid10\Acr.Support.Android.dll - True - - - ..\..\..\..\packages\Acr.UserDialogs.6.3.3\lib\MonoAndroid10\Acr.UserDialogs.dll - True - - - ..\..\..\..\packages\Acr.UserDialogs.6.3.3\lib\MonoAndroid10\Acr.UserDialogs.Interface.dll - True - - - ..\..\..\..\packages\AndHUD.1.2.0\lib\MonoAndroid\AndHUD.dll - True - - - ..\..\..\..\packages\Xamarin.FFImageLoading.2.2.9\lib\MonoAndroid10\FFImageLoading.dll - - - ..\..\..\..\packages\Xamarin.FFImageLoading.Forms.2.2.9\lib\MonoAndroid10\FFImageLoading.Forms.dll - - - ..\..\..\..\packages\Xamarin.FFImageLoading.Forms.2.2.9\lib\MonoAndroid10\FFImageLoading.Forms.Droid.dll - - - ..\..\..\..\packages\Xamarin.FFImageLoading.2.2.9\lib\MonoAndroid10\FFImageLoading.Platform.dll - - - ..\..\..\..\packages\IdentityModel.1.3.1\lib\portable-net45+wp80+win8+wpa81\IdentityModel.Portable.dll - True - - - - ..\..\..\..\packages\modernhttpclient.2.4.2\lib\MonoAndroid\ModernHttpClient.dll - True - - - ..\..\..\..\packages\Newtonsoft.Json.9.0.1\lib\portable-net45+wp80+win8+wpa81\Newtonsoft.Json.dll - - - ..\..\..\..\packages\modernhttpclient.2.4.2\lib\MonoAndroid\OkHttp.dll - True - - - ..\..\..\..\packages\PCLCrypto.2.0.147\lib\MonoAndroid23\PCLCrypto.dll - - - ..\..\..\..\packages\PInvoke.BCrypt.0.3.2\lib\portable-net45+win+wpa81+MonoAndroid10+xamarinios10+MonoTouch10\PInvoke.BCrypt.dll - - - ..\..\..\..\packages\PInvoke.Kernel32.0.3.2\lib\portable-net45+win+wpa81+MonoAndroid10+xamarinios10+MonoTouch10\PInvoke.Kernel32.dll - - - ..\..\..\..\packages\PInvoke.NCrypt.0.3.2\lib\portable-net45+win+wpa81+MonoAndroid10+xamarinios10+MonoTouch10\PInvoke.NCrypt.dll - - - ..\..\..\..\packages\PInvoke.Windows.Core.0.3.2\lib\portable-net45+win+wpa81+MonoAndroid10+xamarinios10+MonoTouch10\PInvoke.Windows.Core.dll - - - ..\..\..\..\packages\Plugin.CurrentActivity.1.0.1\lib\MonoAndroid10\Plugin.CurrentActivity.dll - - - ..\..\..\..\packages\Xam.Plugin.Geolocator.3.0.4\lib\MonoAndroid10\Plugin.Geolocator.dll - - - ..\..\..\..\packages\Xam.Plugin.Geolocator.3.0.4\lib\MonoAndroid10\Plugin.Geolocator.Abstractions.dll - - - ..\..\..\..\packages\Plugin.Permissions.1.1.7\lib\MonoAndroid10\Plugin.Permissions.dll - - - ..\..\..\..\packages\Plugin.Permissions.1.1.7\lib\MonoAndroid10\Plugin.Permissions.Abstractions.dll - - - ..\..\..\..\packages\Xam.Plugins.Settings.2.6.0.12-beta\lib\MonoAndroid10\Plugin.Settings.dll - True - - - ..\..\..\..\packages\Xam.Plugins.Settings.2.6.0.12-beta\lib\MonoAndroid10\Plugin.Settings.Abstractions.dll - True - - - ..\..\..\..\packages\SlideOverKit.2.1.4\lib\MonoAndroid10\SlideOverKit.dll - True - - - ..\..\..\..\packages\SlideOverKit.2.1.4\lib\MonoAndroid10\SlideOverKit.Droid.dll - True - - - ..\..\..\..\packages\Splat.1.6.2\lib\monoandroid\Splat.dll - True - - - - - ..\..\..\..\packages\Microsoft.Net.Http.2.2.29\lib\monoandroid\System.Net.Http.Extensions.dll - True - - - ..\..\..\..\packages\Microsoft.Net.Http.2.2.29\lib\monoandroid\System.Net.Http.Primitives.dll - True - - - - - - ..\..\..\..\packages\Validation.2.2.8\lib\dotnet\Validation.dll - - - ..\..\..\..\packages\Xamarin.Android.Support.Animated.Vector.Drawable.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.Animated.Vector.Drawable.dll - True - - - ..\..\..\..\packages\Xamarin.Android.Support.Design.23.3.0\lib\MonoAndroid43\Xamarin.Android.Support.Design.dll - True - - - ..\..\..\..\packages\Xamarin.Android.Support.v4.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.v4.dll - True - - - ..\..\..\..\packages\Xamarin.Android.Support.v7.AppCompat.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.v7.AppCompat.dll - True - - - ..\..\..\..\packages\Xamarin.Android.Support.v7.CardView.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.v7.CardView.dll - True - - - ..\..\..\..\packages\Xamarin.Android.Support.v7.MediaRouter.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.v7.MediaRouter.dll - True - - - ..\..\..\..\packages\Xamarin.Android.Support.v7.RecyclerView.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.v7.RecyclerView.dll - True - - - ..\..\..\..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.Vector.Drawable.dll - True - - - ..\..\..\..\packages\Xamarin.Forms.2.3.4.231\lib\MonoAndroid10\FormsViewGroup.dll - - - ..\..\..\..\packages\Xamarin.Forms.2.3.4.231\lib\MonoAndroid10\Xamarin.Forms.Core.dll - - - ..\..\..\..\packages\Xamarin.Forms.2.3.4.231\lib\MonoAndroid10\Xamarin.Forms.Platform.Android.dll - - - ..\..\..\..\packages\Xamarin.Forms.2.3.4.231\lib\MonoAndroid10\Xamarin.Forms.Platform.dll - - - ..\..\..\..\packages\Xamarin.Forms.2.3.4.231\lib\MonoAndroid10\Xamarin.Forms.Xaml.dll - - - - ..\..\..\..\packages\Autofac.4.5.0\lib\netstandard1.1\Autofac.dll - @@ -246,7 +85,6 @@ Assets\SourceSansPro-Regular.ttf - @@ -393,15 +231,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - \ No newline at end of file diff --git a/src/Mobile/eShopOnContainers/eShopOnContainers.Droid/packages.config b/src/Mobile/eShopOnContainers/eShopOnContainers.Droid/packages.config.bak similarity index 100% rename from src/Mobile/eShopOnContainers/eShopOnContainers.Droid/packages.config rename to src/Mobile/eShopOnContainers/eShopOnContainers.Droid/packages.config.bak diff --git a/src/Mobile/eShopOnContainers/eShopOnContainers.UnitTests/eShopOnContainers.UnitTests.csproj b/src/Mobile/eShopOnContainers/eShopOnContainers.UnitTests/eShopOnContainers.UnitTests.csproj index fd8c23eca..757dc43e5 100644 --- a/src/Mobile/eShopOnContainers/eShopOnContainers.UnitTests/eShopOnContainers.UnitTests.csproj +++ b/src/Mobile/eShopOnContainers/eShopOnContainers.UnitTests/eShopOnContainers.UnitTests.csproj @@ -1,71 +1,20 @@ - - - + + - 10.0 - Debug - AnyCPU - {F7B6A162-BC4D-4924-B16A-713F9B0344E7} - Library - Properties - eShopOnContainers.UnitTests - eShopOnContainers.UnitTests - es-ES - 512 - {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - v4.5 - Profile111 - - - true + netstandard2.0 + portable-net45+win8+wpa81+wp8 full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 + false + - - - - - - - - - - - - - + + + + - - + - - - {67f9d3a8-f71e-4428-913f-c37ae82cdb24} - eShopOnContainers.Core - - - - - - + \ No newline at end of file diff --git a/src/Mobile/eShopOnContainers/eShopOnContainers.UnitTests/eShopOnContainers.UnitTests.csproj.bak b/src/Mobile/eShopOnContainers/eShopOnContainers.UnitTests/eShopOnContainers.UnitTests.csproj.bak new file mode 100644 index 000000000..fd8c23eca --- /dev/null +++ b/src/Mobile/eShopOnContainers/eShopOnContainers.UnitTests/eShopOnContainers.UnitTests.csproj.bak @@ -0,0 +1,71 @@ + + + + + 10.0 + Debug + AnyCPU + {F7B6A162-BC4D-4924-B16A-713F9B0344E7} + Library + Properties + eShopOnContainers.UnitTests + eShopOnContainers.UnitTests + es-ES + 512 + {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + v4.5 + Profile111 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + + + {67f9d3a8-f71e-4428-913f-c37ae82cdb24} + eShopOnContainers.Core + + + + + + + \ No newline at end of file diff --git a/src/Mobile/eShopOnContainers/eShopOnContainers.iOS/eShopOnContainers.iOS.csproj b/src/Mobile/eShopOnContainers/eShopOnContainers.iOS/eShopOnContainers.iOS.csproj index 205112e74..5cc36912e 100644 --- a/src/Mobile/eShopOnContainers/eShopOnContainers.iOS/eShopOnContainers.iOS.csproj +++ b/src/Mobile/eShopOnContainers/eShopOnContainers.iOS/eShopOnContainers.iOS.csproj @@ -122,7 +122,6 @@ - @@ -132,118 +131,9 @@ - - ..\..\..\..\packages\Acr.Support.2.1.0\lib\Xamarin.iOS10\Acr.Support.iOS.dll - True - - - ..\..\..\..\packages\Acr.UserDialogs.6.3.3\lib\Xamarin.iOS10\Acr.UserDialogs.dll - True - - - ..\..\..\..\packages\Acr.UserDialogs.6.3.3\lib\Xamarin.iOS10\Acr.UserDialogs.Interface.dll - True - - - ..\..\..\..\packages\Xamarin.FFImageLoading.2.2.9\lib\Xamarin.iOS10\FFImageLoading.dll - - - ..\..\..\..\packages\Xamarin.FFImageLoading.Forms.2.2.9\lib\Xamarin.iOS10\FFImageLoading.Forms.dll - - - ..\..\..\..\packages\Xamarin.FFImageLoading.Forms.2.2.9\lib\Xamarin.iOS10\FFImageLoading.Forms.Touch.dll - - - ..\..\..\..\packages\Xamarin.FFImageLoading.2.2.9\lib\Xamarin.iOS10\FFImageLoading.Platform.dll - - - ..\..\..\..\packages\IdentityModel.1.3.1\lib\portable-net45+wp80+win8+wpa81\IdentityModel.Portable.dll - True - - - ..\..\..\..\packages\modernhttpclient.2.4.2\lib\Xamarin.iOS10\ModernHttpClient.dll - True - - - ..\..\..\..\packages\Newtonsoft.Json.9.0.1\lib\portable-net45+wp80+win8+wpa81\Newtonsoft.Json.dll - True - - - ..\..\..\..\packages\PCLCrypto.2.0.147\lib\xamarinios10\PCLCrypto.dll - - - ..\..\..\..\packages\PInvoke.BCrypt.0.3.2\lib\portable-net45+win+wpa81+MonoAndroid10+xamarinios10+MonoTouch10\PInvoke.BCrypt.dll - - - ..\..\..\..\packages\PInvoke.Kernel32.0.3.2\lib\portable-net45+win+wpa81+MonoAndroid10+xamarinios10+MonoTouch10\PInvoke.Kernel32.dll - - - ..\..\..\..\packages\PInvoke.NCrypt.0.3.2\lib\portable-net45+win+wpa81+MonoAndroid10+xamarinios10+MonoTouch10\PInvoke.NCrypt.dll - - - ..\..\..\..\packages\PInvoke.Windows.Core.0.3.2\lib\portable-net45+win+wpa81+MonoAndroid10+xamarinios10+MonoTouch10\PInvoke.Windows.Core.dll - - - ..\..\..\..\packages\Xam.Plugins.Settings.2.6.0.12-beta\lib\Xamarin.iOS10\Plugin.Settings.dll - True - - - ..\..\..\..\packages\Xam.Plugins.Settings.2.6.0.12-beta\lib\Xamarin.iOS10\Plugin.Settings.Abstractions.dll - True - - - ..\..\..\..\packages\SlideOverKit.2.1.4\lib\Xamarin.iOS10\SlideOverKit.dll - True - - - ..\..\..\..\packages\SlideOverKit.2.1.4\lib\Xamarin.iOS10\SlideOverKit.iOS.dll - True - - - ..\..\..\..\packages\Splat.1.6.2\lib\Xamarin.iOS10\Splat.dll - True - - - ..\..\..\..\packages\Microsoft.Net.Http.2.2.29\lib\Xamarin.iOS10\System.Net.Http.Extensions.dll - True - - - ..\..\..\..\packages\Microsoft.Net.Http.2.2.29\lib\Xamarin.iOS10\System.Net.Http.Primitives.dll - True - - - - ..\..\..\..\packages\Validation.2.2.8\lib\dotnet\Validation.dll - - - ..\..\..\..\packages\WebP.Touch.1.0.3\lib\Xamarin.iOS10\WebP.Touch.dll - - - - - ..\..\..\..\packages\Autofac.4.5.0\lib\netstandard1.1\Autofac.dll - - - ..\..\..\..\packages\Xamarin.Forms.2.3.4.231\lib\Xamarin.iOS10\Xamarin.Forms.Core.dll - - - ..\..\..\..\packages\Xamarin.Forms.2.3.4.231\lib\Xamarin.iOS10\Xamarin.Forms.Platform.dll - - - ..\..\..\..\packages\Xamarin.Forms.2.3.4.231\lib\Xamarin.iOS10\Xamarin.Forms.Platform.iOS.dll - - - ..\..\..\..\packages\Xamarin.Forms.2.3.4.231\lib\Xamarin.iOS10\Xamarin.Forms.Xaml.dll - - - ..\..\..\..\packages\Xam.Plugin.Geolocator.3.0.4\lib\Xamarin.iOS10\Plugin.Geolocator.Abstractions.dll - - - ..\..\..\..\packages\Xam.Plugin.Geolocator.3.0.4\lib\Xamarin.iOS10\Plugin.Geolocator.dll - @@ -436,13 +326,24 @@ + + + + + + + + + + + + + + + + + + + - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - \ No newline at end of file diff --git a/src/Mobile/eShopOnContainers/eShopOnContainers.iOS/packages.config b/src/Mobile/eShopOnContainers/eShopOnContainers.iOS/packages.config.bak similarity index 100% rename from src/Mobile/eShopOnContainers/eShopOnContainers.iOS/packages.config rename to src/Mobile/eShopOnContainers/eShopOnContainers.iOS/packages.config.bak From 8198126dafb363124be4ff974afeef34e20efee3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eduard=20Tom=C3=A0s?= Date: Mon, 4 Sep 2017 19:07:53 +0200 Subject: [PATCH 62/64] Use dotnet multi-architecture images. Removing docker-compose.windows.override (not needed as is identical to docker-compose.override) --- cli-windows/start-windows-containers.ps1 | 13 +- docker-compose-windows.override.yml | 163 ---------------- docker-compose-windows.yml | 64 ++++--- .../Basket/Basket.API/Dockerfile.nanowin | 8 - .../Catalog/Catalog.API/Dockerfile.nanowin | 8 - .../Identity/Identity.API/Dockerfile.nanowin | 8 - .../Location/Locations.API/Dockerfile.nanowin | 8 - .../Marketing.API/Dockerfile.nanowin | 8 - .../Ordering/Ordering.API/Dockerfile.nanowin | 8 - .../Payment/Payment.API/Dockerfile.nanowin | 8 - src/Web/WebMVC/Dockerfile.nanowin | 8 - src/Web/WebSPA/Dockerfile.nanowin | 8 - src/Web/WebSPA/package-lock.json | 176 +++++++++--------- src/Web/WebStatus/Dockerfile.nanowin | 8 - 14 files changed, 132 insertions(+), 364 deletions(-) delete mode 100644 docker-compose-windows.override.yml delete mode 100644 src/Services/Basket/Basket.API/Dockerfile.nanowin delete mode 100644 src/Services/Catalog/Catalog.API/Dockerfile.nanowin delete mode 100644 src/Services/Identity/Identity.API/Dockerfile.nanowin delete mode 100644 src/Services/Location/Locations.API/Dockerfile.nanowin delete mode 100644 src/Services/Marketing/Marketing.API/Dockerfile.nanowin delete mode 100644 src/Services/Ordering/Ordering.API/Dockerfile.nanowin delete mode 100644 src/Services/Payment/Payment.API/Dockerfile.nanowin delete mode 100644 src/Web/WebMVC/Dockerfile.nanowin delete mode 100644 src/Web/WebSPA/Dockerfile.nanowin delete mode 100644 src/Web/WebStatus/Dockerfile.nanowin diff --git a/cli-windows/start-windows-containers.ps1 b/cli-windows/start-windows-containers.ps1 index 300c63568..56b7a34e9 100644 --- a/cli-windows/start-windows-containers.ps1 +++ b/cli-windows/start-windows-containers.ps1 @@ -1,9 +1,16 @@ -Param([string] $rootPath) +Param( + [parameter(Mandatory=$false)][string] $rootPath, + [parameter(Mandatory=$false)][bool]$buildBits=$true +) + $scriptPath = Split-Path $script:MyInvocation.MyCommand.Path if ([string]::IsNullOrEmpty($rootPath)) { $rootPath = "$scriptPath\.." } Write-Host "Root path used is $rootPath" -ForegroundColor Yellow -& .\build-bits.ps1 -rootPath $rootPath -docker-compose -f "$rootPath\docker-compose-windows.yml" -f "$rootPath\docker-compose-windows.override.yml" up + +if ($buildBits) { + & $scriptPath\build-bits.ps1 -rootPath $rootPath +} +docker-compose -f "$rootPath\docker-compose-windows.yml" -f "$rootPath\docker-compose.override.yml" up diff --git a/docker-compose-windows.override.yml b/docker-compose-windows.override.yml deleted file mode 100644 index 6c791b1a6..000000000 --- a/docker-compose-windows.override.yml +++ /dev/null @@ -1,163 +0,0 @@ -version: '2.1' - -# The default docker-compose.override file can use the "localhost" as the external name for testing web apps within the same dev machine. -# The ESHOP_EXTERNAL_DNS_NAME_OR_IP environment variable is taken, by default, from the ".env" file defined like: -# ESHOP_EXTERNAL_DNS_NAME_OR_IP=localhost -# but values present in the environment vars at runtime will always override those defined inside the .env file -# An external IP or DNS name has to be used (instead localhost and the 10.0.75.1 IP) when testing the Web apps and the Xamarin apps from remote machines/devices using the same WiFi, for instance. - -services: - - basket.api: - environment: - - ASPNETCORE_ENVIRONMENT=Development - - ASPNETCORE_URLS=http://0.0.0.0:80 - - ConnectionString=${ESHOP_AZURE_REDIS_BASKET_DB:-basket.data} - - identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5110. - - IdentityUrlExternal=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5105 - - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} - - AzureServiceBusEnabled=False - ports: - - "5103:80" - - catalog.api: - environment: - - ASPNETCORE_ENVIRONMENT=Development - - ASPNETCORE_URLS=http://0.0.0.0:80 - - ConnectionString=${ESHOP_AZURE_CATALOG_DB:-Server=sql.data;Database=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word} - - PicBaseUrl=${ESHOP_AZURE_STORAGE_CATALOG:-http://localhost:5101/api/v1/catalog/items/[0]/pic/} #Local: You need to open your local dev-machine firewall at range 5100-5110. - - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} - - AzureStorageAccountName=${ESHOP_AZURE_STORAGE_CATALOG_NAME} - - AzureStorageAccountKey=${ESHOP_AZURE_STORAGE_CATALOG_KEY} - - UseCustomizationData=True - - AzureServiceBusEnabled=False - - AzureStorageEnabled=False - ports: - - "5101:80" - - identity.api: - environment: - - ASPNETCORE_ENVIRONMENT=Development - - ASPNETCORE_URLS=http://0.0.0.0:80 - - SpaClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5104 - - XamarinCallback=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5105/xamarincallback #localhost do not work for UWP login, so we have to use "external" IP always - - ConnectionStrings__DefaultConnection=${ESHOP_AZURE_IDENTITY_DB:-Server=sql.data;Database=Microsoft.eShopOnContainers.Service.IdentityDb;User Id=sa;Password=Pass@word} - - MvcClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5100 #Local: You need to open your local dev-machine firewall at range 5100-5110. - - LocationApiClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5109 - - MarketingApiClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5110 - - BasketApiClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5103 - - OrderingApiClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5102 - - UseCustomizationData=True - ports: - - "5105:80" - - ordering.api: - environment: - - ASPNETCORE_ENVIRONMENT=Development - - ASPNETCORE_URLS=http://0.0.0.0:80 - - ConnectionString=${ESHOP_AZURE_ORDERING_DB:-Server=sql.data;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word} - - identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5110. - - IdentityUrlExternal=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5105 - - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} - - UseCustomizationData=True - - AzureServiceBusEnabled=False - ports: - - "5102:80" - - webspa: - environment: - - ASPNETCORE_ENVIRONMENT=Development - - ASPNETCORE_URLS=http://0.0.0.0:80 - - CatalogUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5101 - - OrderingUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5102 - - IdentityUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5105 #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105. - - BasketUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5103 - - MarketingUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5110 - - CatalogUrlHC=http://catalog.api/hc - - OrderingUrlHC=http://ordering.api/hc - - IdentityUrlHC=http://identity.api/hc #Local: Use ${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}, if using external IP or DNS name from browser. - - BasketUrlHC=http://basket.api/hc - - MarketingUrlHC=http://marketing.api/hc - - UseCustomizationData=True - ports: - - "5104:80" - - webmvc: - environment: - - ASPNETCORE_ENVIRONMENT=Development - - ASPNETCORE_URLS=http://0.0.0.0:80 - - CatalogUrl=http://catalog.api - - OrderingUrl=http://ordering.api - - BasketUrl=http://basket.api - - IdentityUrl=http://10.0.75.1:5105 - - MarketingUrl=http://marketing.api #Local: Use 10.0.75.1 in a "Docker for Windows" environment, if using "localhost" from browser. - - UseCustomizationData=True #Remote: Use ${ESHOP_EXTERNAL_DNS_NAME_OR_IP} if using external IP or DNS name from browser. - ports: - - "5100:80" - - sql.data: - environment: - - SA_PASSWORD=Pass@word - - ACCEPT_EULA=Y - ports: - - "5433:1433" - - nosql.data: - ports: - - "27017:27017" - - locations.api: - environment: - - ASPNETCORE_ENVIRONMENT=Development - - ASPNETCORE_URLS=http://0.0.0.0:80 - - ConnectionString=${ESHOP_AZURE_COSMOSDB:-mongodb://nosql.data} - - Database=LocationsDb - - identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5110. - - IdentityUrlExternal=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5105 - - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} - - AzureServiceBusEnabled=False - ports: - - "5109:80" - - marketing.api: - environment: - - ASPNETCORE_ENVIRONMENT=Development - - ASPNETCORE_URLS=http://0.0.0.0:80 - - ConnectionString=${ESHOP_AZURE_MARKETING_DB:-Server=sql.data;Database=Microsoft.eShopOnContainers.Services.MarketingDb;User Id=sa;Password=Pass@word} - - MongoConnectionString=${ESHOP_AZURE_COSMOSDB:-mongodb://nosql.data} - - MongoDatabase=MarketingDb - - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} - - identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5110. - - IdentityUrlExternal=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5105 - - CampaignDetailFunctionUri=${ESHOP_AZUREFUNC_CAMPAIGN_DETAILS_URI} - - PicBaseUrl=${ESHOP_AZURE_STORAGE_MARKETING:-http://localhost:5110/api/v1/campaigns/[0]/pic/} - - AzureStorageAccountName=${ESHOP_AZURE_STORAGE_MARKETING_NAME} - - AzureStorageAccountKey=${ESHOP_AZURE_STORAGE_MARKETING_KEY} - - AzureServiceBusEnabled=False - - AzureStorageEnabled=False - ports: - - "5110:80" - - webstatus: - environment: - - ASPNETCORE_ENVIRONMENT=Development - - ASPNETCORE_URLS=http://0.0.0.0:80 - - CatalogUrl=http://catalog.api/hc - - OrderingUrl=http://ordering.api/hc - - BasketUrl=http://basket.api/hc - - IdentityUrl=http://identity.api/hc - - LocationsUrl=http://locations.api/hc - - MarketingUrl=http://marketing.api/hc - - mvc=http://webmvc/hc - - spa=http://webspa/hc - ports: - - "5107:80" - - payment.api: - environment: - - ASPNETCORE_ENVIRONMENT=Development - - ASPNETCORE_URLS=http://0.0.0.0:80 - - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} - - AzureServiceBusEnabled=False - ports: - - "5108:80" \ No newline at end of file diff --git a/docker-compose-windows.yml b/docker-compose-windows.yml index 190b823b6..1a71968ba 100644 --- a/docker-compose-windows.yml +++ b/docker-compose-windows.yml @@ -5,7 +5,7 @@ services: image: eshop/basket.api-win:${TAG:-latest} build: context: ./src/Services/Basket/Basket.API - dockerfile: Dockerfile.nanowin + dockerfile: Dockerfile depends_on: - basket.data - identity.api @@ -15,7 +15,7 @@ services: image: eshop/catalog.api-win:${TAG:-latest} build: context: ./src/Services/Catalog/Catalog.API - dockerfile: Dockerfile.nanowin + dockerfile: Dockerfile depends_on: - sql.data - rabbitmq @@ -24,7 +24,7 @@ services: image: eshop/identity.api-win:${TAG:-latest} build: context: ./src/Services/Identity/Identity.API - dockerfile: Dockerfile.nanowin + dockerfile: Dockerfile depends_on: - sql.data @@ -32,25 +32,39 @@ services: image: eshop/ordering.api-win:${TAG:-latest} build: context: ./src/Services/Ordering/Ordering.API - dockerfile: Dockerfile.nanowin + dockerfile: Dockerfile depends_on: - sql.data - rabbitmq + marketing.api: + image: eshop/marketing.api:${TAG:-latest} + build: + context: ./src/Services/Marketing/Marketing.API + dockerfile: Dockerfile + depends_on: + - sql.data + - nosql.data + - identity.api + - rabbitmq + webspa: image: eshop/webspa-win:${TAG:-latest} build: context: ./src/Web/WebSPA - dockerfile: Dockerfile.nanowin + dockerfile: Dockerfile depends_on: + - catalog.api + - ordering.api - identity.api - basket.api + - marketing.api webmvc: image: eshop/webmvc-win:${TAG:-latest} build: context: ./src/Web/WebMVC - dockerfile: Dockerfile.nanowin + dockerfile: Dockerfile depends_on: - catalog.api - ordering.api @@ -62,28 +76,25 @@ services: image: eshop/webstatus:${TAG:-latest} build: context: ./src/Web/WebStatus - dockerfile: Dockerfile.nanowin + dockerfile: Dockerfile + + payment.api: + image: eshop/payment.api:${TAG:-latest} + build: + context: ./src/Services/Payment/Payment.API + dockerfile: Dockerfile + depends_on: + - rabbitmq locations.api: image: eshop/locations.api:${TAG:-latest} build: context: ./src/Services/Location/Locations.API - dockerfile: Dockerfile.nanowin + dockerfile: Dockerfile depends_on: - nosql.data - rabbitmq - marketing.api: - image: eshop/marketing.api:${TAG:-latest} - build: - context: ./src/Services/Marketing/Marketing.API - dockerfile: Dockerfile.nanowin - depends_on: - - sql.data - - nosql.data - - identity.api - - rabbitmq - sql.data: image: microsoft/mssql-server-windows @@ -94,7 +105,7 @@ services: image: redis:nanoserver # build: # context: ./_docker/redis -# dockerfile: Dockerfile.nanowin +# dockerfile: Dockerfile ports: - "6379:6379" @@ -102,17 +113,10 @@ services: image: spring2/rabbitmq # build: # context: ./_docker/rabbitmq -# dockerfile: Dockerfile.nanowin +# dockerfile: Dockerfile ports: - - "5672:5672" - - payment.api: - image: eshop/payment.api:${TAG:-latest} - build: - context: ./src/Services/Payment/Payment.API - dockerfile: Dockerfile.nanowin - depends_on: - - rabbitmq + - "15672:15672" + - "5672:5672" networks: default: diff --git a/src/Services/Basket/Basket.API/Dockerfile.nanowin b/src/Services/Basket/Basket.API/Dockerfile.nanowin deleted file mode 100644 index deab637ef..000000000 --- a/src/Services/Basket/Basket.API/Dockerfile.nanowin +++ /dev/null @@ -1,8 +0,0 @@ -FROM microsoft/dotnet:2.0-runtime-nanoserver -SHELL ["powershell"] -ARG source -WORKDIR /app -RUN set-itemproperty -path 'HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters' -Name ServerPriorityTimeLimit -Value 0 -Type DWord -EXPOSE 80 -COPY ${source:-obj/Docker/publish} . -ENTRYPOINT ["dotnet", "Basket.API.dll"] diff --git a/src/Services/Catalog/Catalog.API/Dockerfile.nanowin b/src/Services/Catalog/Catalog.API/Dockerfile.nanowin deleted file mode 100644 index 68eb9262d..000000000 --- a/src/Services/Catalog/Catalog.API/Dockerfile.nanowin +++ /dev/null @@ -1,8 +0,0 @@ -FROM microsoft/dotnet:2.0-runtime-nanoserver -SHELL ["powershell"] -ARG source -WORKDIR /app -RUN set-itemproperty -path 'HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters' -Name ServerPriorityTimeLimit -Value 0 -Type DWord -EXPOSE 80 -COPY ${source:-obj/Docker/publish} . -ENTRYPOINT ["dotnet", "Catalog.API.dll"] diff --git a/src/Services/Identity/Identity.API/Dockerfile.nanowin b/src/Services/Identity/Identity.API/Dockerfile.nanowin deleted file mode 100644 index 9d24ccf1a..000000000 --- a/src/Services/Identity/Identity.API/Dockerfile.nanowin +++ /dev/null @@ -1,8 +0,0 @@ -FROM microsoft/dotnet:1.1-runtime-nanoserver -SHELL ["powershell"] -ARG source -WORKDIR /app -RUN set-itemproperty -path 'HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters' -Name ServerPriorityTimeLimit -Value 0 -Type DWord -EXPOSE 80 -COPY ${source:-obj/Docker/publish} . -ENTRYPOINT ["dotnet", "Identity.API.dll"] diff --git a/src/Services/Location/Locations.API/Dockerfile.nanowin b/src/Services/Location/Locations.API/Dockerfile.nanowin deleted file mode 100644 index 59fe001da..000000000 --- a/src/Services/Location/Locations.API/Dockerfile.nanowin +++ /dev/null @@ -1,8 +0,0 @@ -FROM microsoft/dotnet:2.0-runtime-nanoserver -SHELL ["powershell"] -ARG source -WORKDIR /app -RUN set-itemproperty -path 'HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters' -Name ServerPriorityTimeLimit -Value 0 -Type DWord -EXPOSE 80 -COPY ${source:-obj/Docker/publish} . -ENTRYPOINT ["dotnet", "Locations.API.dll"] diff --git a/src/Services/Marketing/Marketing.API/Dockerfile.nanowin b/src/Services/Marketing/Marketing.API/Dockerfile.nanowin deleted file mode 100644 index 33bcd0e82..000000000 --- a/src/Services/Marketing/Marketing.API/Dockerfile.nanowin +++ /dev/null @@ -1,8 +0,0 @@ -FROM microsoft/dotnet:2.0-runtime-nanoserver -SHELL ["powershell"] -ARG source -WORKDIR /app -RUN set-itemproperty -path 'HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters' -Name ServerPriorityTimeLimit -Value 0 -Type DWord -EXPOSE 80 -COPY ${source:-obj/Docker/publish} . -ENTRYPOINT ["dotnet", "Marketing.API.dll"] diff --git a/src/Services/Ordering/Ordering.API/Dockerfile.nanowin b/src/Services/Ordering/Ordering.API/Dockerfile.nanowin deleted file mode 100644 index c5dd08a2e..000000000 --- a/src/Services/Ordering/Ordering.API/Dockerfile.nanowin +++ /dev/null @@ -1,8 +0,0 @@ -FROM microsoft/dotnet:2.0-runtime-nanoserver -SHELL ["powershell"] -ARG source -WORKDIR /app -RUN set-itemproperty -path 'HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters' -Name ServerPriorityTimeLimit -Value 0 -Type DWord -EXPOSE 80 -COPY ${source:-obj/Docker/publish} . -ENTRYPOINT ["dotnet", "Ordering.API.dll"] diff --git a/src/Services/Payment/Payment.API/Dockerfile.nanowin b/src/Services/Payment/Payment.API/Dockerfile.nanowin deleted file mode 100644 index c04327048..000000000 --- a/src/Services/Payment/Payment.API/Dockerfile.nanowin +++ /dev/null @@ -1,8 +0,0 @@ -FROM microsoft/dotnet:2.0-runtime-nanoserver -SHELL ["powershell"] -ARG source -WORKDIR /app -RUN set-itemproperty -path 'HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters' -Name ServerPriorityTimeLimit -Value 0 -Type DWord -EXPOSE 80 -COPY ${source:-obj/Docker/publish} . -ENTRYPOINT ["dotnet", "Payment.API.dll"] diff --git a/src/Web/WebMVC/Dockerfile.nanowin b/src/Web/WebMVC/Dockerfile.nanowin deleted file mode 100644 index 739f27746..000000000 --- a/src/Web/WebMVC/Dockerfile.nanowin +++ /dev/null @@ -1,8 +0,0 @@ -FROM microsoft/dotnet:2.0-runtime-nanoserver -SHELL ["powershell"] -ARG source -WORKDIR /app -RUN set-itemproperty -path 'HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters' -Name ServerPriorityTimeLimit -Value 0 -Type DWord -EXPOSE 80 -COPY ${source:-obj/Docker/publish} . -ENTRYPOINT ["dotnet", "WebMVC.dll"] diff --git a/src/Web/WebSPA/Dockerfile.nanowin b/src/Web/WebSPA/Dockerfile.nanowin deleted file mode 100644 index 7e678c9ac..000000000 --- a/src/Web/WebSPA/Dockerfile.nanowin +++ /dev/null @@ -1,8 +0,0 @@ -FROM microsoft/dotnet:2.0-runtime-nanoserver -SHELL ["powershell"] -ARG source -WORKDIR /app -RUN set-itemproperty -path 'HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters' -Name ServerPriorityTimeLimit -Value 0 -Type DWord -EXPOSE 80 -COPY ${source:-obj/Docker/publish} . -ENTRYPOINT ["dotnet", "WebSPA.dll"] diff --git a/src/Web/WebSPA/package-lock.json b/src/Web/WebSPA/package-lock.json index 92ad21584..bc4b391e9 100644 --- a/src/Web/WebSPA/package-lock.json +++ b/src/Web/WebSPA/package-lock.json @@ -7,7 +7,7 @@ "@angular-devkit/build-optimizer": { "version": "0.0.13", "resolved": "https://registry.npmjs.org/@angular-devkit/build-optimizer/-/build-optimizer-0.0.13.tgz", - "integrity": "sha512-yEMkYU4YU8XlA5OauPhg22ZEWJ4X2VhiFKUwfeo4UWJ7lz4XWiuBJocrT5NHWqI1S0rOLpSixLXG9byvFMbavA==", + "integrity": "sha1-zzl692q+iZqpCdSnNRBmlMofCM8=", "dev": true, "requires": { "loader-utils": "1.1.0", @@ -26,7 +26,7 @@ "@angular/cli": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/@angular/cli/-/cli-1.3.0.tgz", - "integrity": "sha512-Sv6Gly7yNPZtNEsJJegtHxUTrkrvl0IsDRVcALrBQzdMvMXRWOEhn1jrdOY5HtU9eFQ27sdqrwijUVrTabZubw==", + "integrity": "sha1-FA/mmFCKjAI7S32gHAzAY89xEBg=", "dev": true, "requires": { "@angular-devkit/build-optimizer": "0.0.13", @@ -261,7 +261,7 @@ "@ngtools/webpack": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/@ngtools/webpack/-/webpack-1.6.0.tgz", - "integrity": "sha512-qlY3Fj5ZJULIeFVvnnmzrKJCJnBkZ3rDf6ApaSc3uAAlhWjmBenUCJKlDQFTYZ6SuixmGYN3WTR5kGy6P7jZrA==", + "integrity": "sha1-YmLxECg/y/76KtRbx5wshVw5Y7s=", "dev": true, "requires": { "loader-utils": "1.1.0", @@ -290,7 +290,7 @@ "@types/node": { "version": "6.0.85", "resolved": "https://registry.npmjs.org/@types/node/-/node-6.0.85.tgz", - "integrity": "sha512-6qLZpfQFO/g5Ns2e7RsW6brk0Q6Xzwiw7kVVU/XiQNOiJXSojhX76GP457PBYIsNMH2WfcGgcnZB4awFDHrwpA==", + "integrity": "sha1-7AK/5UphBE8r5E8Ts4nGoOjuBa4=", "dev": true }, "@types/protractor": { @@ -327,7 +327,7 @@ "acorn": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.1.1.tgz", - "integrity": "sha512-vOk6uEMctu0vQrvuSqFdJyqj1Q0S5VTDL79qtjo+DhRr+1mmaD+tluFSCZqhvi/JUhXSzoZN2BhtstaPEeE8cw==", + "integrity": "sha1-U/4WERH5EquZnuiHqQoLxSgi/XU=", "dev": true }, "acorn-dynamic-import": { @@ -415,7 +415,7 @@ "anymatch": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-1.3.2.tgz", - "integrity": "sha512-0XNayC8lTHQ2OI8aljNCN3sSx6hsr/1+rlcDAotXJR7C1oZZHCNsfpbKwMjRA3Uqb5tF1Rae2oloTr4xpq+WjA==", + "integrity": "sha1-VT3Lj5HjyImEXf26NMd3IbkLnXo=", "dev": true, "requires": { "micromatch": "2.3.11", @@ -425,7 +425,7 @@ "aproba": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.1.2.tgz", - "integrity": "sha512-ZpYajIfO0j2cOFTO955KUMIKNmj6zhX8kVztMAxFsDaMwz+9Z9SV0uou2pC9HJqcfpffOsjnbrDMvkNy+9RXPw==", + "integrity": "sha1-RcZikJTeTpb2k+9+q3SuB5wkD8E=", "dev": true }, "are-we-there-yet": { @@ -465,7 +465,7 @@ "readable-stream": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz", - "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==", + "integrity": "sha1-No8lEtefnUb9/HE0mueHi7weuVw=", "dev": true, "requires": { "core-util-is": "1.0.2", @@ -486,7 +486,7 @@ "string_decoder": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", - "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", + "integrity": "sha1-D8Z9fBQYJd6UKC3VNr7GubzoYKs=", "dev": true, "requires": { "safe-buffer": "5.1.1" @@ -521,7 +521,7 @@ "arr-flatten": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", - "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", + "integrity": "sha1-NgSLv/TntH4TZkQxbJlmnqWukfE=", "dev": true }, "array-find-index": { @@ -601,7 +601,7 @@ "async": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/async/-/async-2.5.0.tgz", - "integrity": "sha512-e+lJAJeNWuPCNyxZKOBdaJGyLGHugXVQtrAwtuAe2vhxTYxFTKE73p8JuTmdH0qdQZtDvI4dhJwjZc5zsfIsYw==", + "integrity": "sha1-hDGQ/WtzV6C54clW7d3V7IRitU0=", "dev": true, "requires": { "lodash": "4.17.4" @@ -775,7 +775,7 @@ "babylon": { "version": "6.17.4", "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.17.4.tgz", - "integrity": "sha512-kChlV+0SXkjE0vUn9OZ7pBMWRFd8uq3mZe8x1K6jhuNcAFAtEnjchFAqB+dYEXKyd+JpT6eppRR78QAr5gTsUw==", + "integrity": "sha1-Pot0AriNIsNCPhN6FXeIOxX/hpo=", "dev": true }, "balanced-match": { @@ -787,7 +787,7 @@ "base64-js": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.2.1.tgz", - "integrity": "sha512-dwVUVIXsBZXwTuwnXI9RK8sBmgq09NDHzyR9SAph9eqk76gKK2JSQmZARC2zRC81JC2QTtxD0ARU5qTS25gIGw==", + "integrity": "sha1-qRlH2h9KUW6jjltOwOw3c2deCIY=", "dev": true }, "batch": { @@ -846,7 +846,7 @@ "bn.js": { "version": "4.11.8", "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", - "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==", + "integrity": "sha1-LN4J617jQfSEdGuwMJsyU7GxRC8=", "dev": true }, "bonjour": { @@ -1134,7 +1134,7 @@ "chalk": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.1.0.tgz", - "integrity": "sha512-LUHGS/dge4ujbXMJrnihYMcL4AoOweGnw9Tp3kQuqy1Kx5c1qKjqvMJZ6nVJPMWJtKCTN72ZogH3oeSO9g9rXQ==", + "integrity": "sha1-rFvs8U+iG5nGySynp9fP1bF+dD4=", "dev": true, "requires": { "ansi-styles": "3.2.0", @@ -1145,7 +1145,7 @@ "ansi-styles": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", - "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "integrity": "sha1-wVm41b4PnlpvNG2rlPFs4CIWG4g=", "dev": true, "requires": { "color-convert": "1.9.0" @@ -1160,7 +1160,7 @@ "supports-color": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.2.1.tgz", - "integrity": "sha512-qxzYsob3yv6U+xMzPrv170y8AwGP7i74g+pbixCfD6rgso8BscLT2qXIuz6TpOaiJZ3mFgT5O9lyT9nMU4LfaA==", + "integrity": "sha1-ZaS7JjHpDgJCDbpVVMN1pHVLuDY=", "dev": true, "requires": { "has-flag": "2.0.0" @@ -1187,7 +1187,7 @@ "cipher-base": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", - "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", + "integrity": "sha1-h2Dk7MJy9MNjUy+SbYdKriwTl94=", "dev": true, "requires": { "inherits": "2.0.3", @@ -1501,7 +1501,7 @@ "commander": { "version": "2.11.0", "resolved": "https://registry.npmjs.org/commander/-/commander-2.11.0.tgz", - "integrity": "sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ==", + "integrity": "sha1-FXFS/R56bI2YpbcVzzdt+SgARWM=", "dev": true }, "common-tags": { @@ -1623,7 +1623,7 @@ "cosmiconfig": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-2.2.2.tgz", - "integrity": "sha512-GiNXLwAFPYHy25XmTPpafYvn3CLAkJ8FLsscq78MQd1Kh0OU6Yzhn4eV2MVF4G9WEQZoWEGltatdR+ntGPMl5A==", + "integrity": "sha1-YXPOvVb6wELB9DkO33r2wHx8uJI=", "dev": true, "requires": { "is-directory": "0.3.1", @@ -1747,7 +1747,7 @@ "crypto-browserify": { "version": "3.11.1", "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.11.1.tgz", - "integrity": "sha512-Na7ZlwCOqoaW5RwUK1WpXws2kv8mNhWdTlzob0UXulk6G9BDbyiJaGTYBIX61Ozn9l1EPPJpICZb4DaOpT9NlQ==", + "integrity": "sha1-lIlF78Z1ekANbl5a9HGU0QBkJ58=", "dev": true, "requires": { "browserify-cipher": "1.0.0", @@ -2031,7 +2031,7 @@ "diff": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/diff/-/diff-3.3.0.tgz", - "integrity": "sha512-w0XZubFWn0Adlsapj9EAWX0FqWdO4tz8kc3RiYdWLh4k/V8PTb6i0SMgXt0vRM3zyKnT8tKO7mUlieRQHIjMNg==", + "integrity": "sha1-BWaVFQ16qTI3yn43isOxaCt5Y7k=", "dev": true }, "diffie-hellman": { @@ -2551,7 +2551,7 @@ "qs": { "version": "6.5.0", "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.0.tgz", - "integrity": "sha512-fjVFjW9yhqMhVGwRExCXLhJKrLlkYSaxNWdyc9rmHlrVZbk35YHH312dFd7191uQeXkI3mKLZTIbSvIeFwFemg==", + "integrity": "sha1-jQSVTTZN7z78VbWgeT4eLIsebkk=", "dev": true } } @@ -2711,7 +2711,7 @@ "finalhandler": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.0.4.tgz", - "integrity": "sha512-16l/r8RgzlXKmFOhZpHBztvye+lAhC5SU7hXavnerC9UfZqZxxXl3BzL8MhffPT3kF61lj9Oav2LKEzh0ei7tg==", + "integrity": "sha1-GFdPLnxLmLiuOyMMIfIB8xvbP7c=", "dev": true, "requires": { "debug": "2.6.8", @@ -3185,7 +3185,7 @@ "glob": { "version": "7.1.2", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", - "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "integrity": "sha1-wZyd+aAocC1nhhI4SmVSQExjbRU=", "dev": true, "requires": { "fs.realpath": "1.0.0", @@ -3236,7 +3236,7 @@ "globals": { "version": "9.18.0", "resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz", - "integrity": "sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ==", + "integrity": "sha1-qjiWs+abSH8X4x7SFD1pqOMMLYo=", "dev": true }, "globby": { @@ -3378,7 +3378,7 @@ "hash.js": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.3.tgz", - "integrity": "sha512-/UETyP0W22QILqS+6HowevwhEFJ3MBJnwTf75Qob9Wz9t0DPuisL8kW8YZMK62dHAKE1c1p+gY1TtOLY+USEHA==", + "integrity": "sha1-NA3tvmKQGHFRweodd3o0SJNd+EY=", "dev": true, "requires": { "inherits": "2.0.3", @@ -3451,7 +3451,7 @@ "hosted-git-info": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.5.0.tgz", - "integrity": "sha512-pNgbURSuab90KbTqvRPsseaTxOJCZBD0a7t+haSN33piP9cCM4l0CqdzAif2hUqm716UovKB2ROmiabGAKVXyg==", + "integrity": "sha1-bWDjSzq7yDEwYsO3mO+NkBoHrzw=", "dev": true }, "hpack.js": { @@ -3475,7 +3475,7 @@ "readable-stream": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz", - "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==", + "integrity": "sha1-No8lEtefnUb9/HE0mueHi7weuVw=", "dev": true, "requires": { "core-util-is": "1.0.2", @@ -3490,7 +3490,7 @@ "string_decoder": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", - "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", + "integrity": "sha1-D8Z9fBQYJd6UKC3VNr7GubzoYKs=", "dev": true, "requires": { "safe-buffer": "5.1.1" @@ -3513,7 +3513,7 @@ "html-minifier": { "version": "3.5.3", "resolved": "https://registry.npmjs.org/html-minifier/-/html-minifier-3.5.3.tgz", - "integrity": "sha512-iKRzQQDuTCsq0Ultbi/mfJJnR0D3AdZKTq966Gsp92xkmAPCV4Xi08qhJ0Dl3ZAWemSgJ7qZK+UsZc0gFqK6wg==", + "integrity": "sha1-SideOxoWY5q7ebTBEZH/DQ/PGrk=", "dev": true, "requires": { "camel-case": "3.0.0", @@ -3655,7 +3655,7 @@ "iconv-lite": { "version": "0.4.18", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.18.tgz", - "integrity": "sha512-sr1ZQph3UwHTR0XftSbK85OvBbxe/abLGzEnPENCQwmHf7sck8Oyu4ob3LgBxWWxRoM+QszeUyl7jbqapu2TqA==", + "integrity": "sha1-I9hlaxaq5nQqwpcy6o8DNqR4nPI=", "dev": true }, "icss-replace-symbols": { @@ -3682,7 +3682,7 @@ "postcss": { "version": "6.0.8", "resolved": "https://registry.npmjs.org/postcss/-/postcss-6.0.8.tgz", - "integrity": "sha512-G6WnRmdTt2jvJvY+aY+M0AO4YlbxE+slKPZb+jG2P2U9Tyxi3h1fYZ/DgiFU6DC6bv3XIEJoZt+f/kNh8BrWFw==", + "integrity": "sha1-iQZ6nOixH4qEy8URfvwwQZoIV7M=", "dev": true, "requires": { "chalk": "2.1.0", @@ -3693,7 +3693,7 @@ "supports-color": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.2.1.tgz", - "integrity": "sha512-qxzYsob3yv6U+xMzPrv170y8AwGP7i74g+pbixCfD6rgso8BscLT2qXIuz6TpOaiJZ3mFgT5O9lyT9nMU4LfaA==", + "integrity": "sha1-ZaS7JjHpDgJCDbpVVMN1pHVLuDY=", "dev": true, "requires": { "has-flag": "2.0.0" @@ -3808,7 +3808,7 @@ "inquirer": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-3.2.1.tgz", - "integrity": "sha512-QgW3eiPN8gpj/K5vVpHADJJgrrF0ho/dZGylikGX7iqAdRgC9FVKYKWFLx6hZDBFcOLEoSqINYrVPeFAeG/PdA==", + "integrity": "sha1-Bs6w9UD0XKVIwX1oQJWYeCZfoXU=", "dev": true, "requires": { "ansi-escapes": "2.0.0", @@ -4027,7 +4027,7 @@ "is-plain-object": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", - "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "integrity": "sha1-LBY7P6+xtgbZ0Xko8FwqHDjgdnc=", "dev": true, "requires": { "isobject": "3.0.1" @@ -4188,7 +4188,7 @@ "istanbul-lib-coverage": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-1.1.1.tgz", - "integrity": "sha512-0+1vDkmzxqJIn5rcoEqapSB4DmPxE31EtI2dF2aCkV5esN9EWHxZ0dwgDClivMXJqE7zaYQxq30hj5L0nlTN5Q==", + "integrity": "sha1-c7+5mIhSmUFck9OKPprfeEp3qdo=", "dev": true }, "istanbul-lib-instrument": { @@ -4238,7 +4238,7 @@ "jschardet": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/jschardet/-/jschardet-1.5.1.tgz", - "integrity": "sha512-vE2hT1D0HLZCLLclfBSfkfTTedhVj0fubHpJBHKwwUWX0nSbhPAfk+SG9rTX95BYNmau8rGFfCeaT6T5OW1C2A==", + "integrity": "sha1-xRn2KfhrOlvtuliojTETCe7Al/k=", "dev": true }, "jsesc": { @@ -4250,7 +4250,7 @@ "json-loader": { "version": "0.5.7", "resolved": "https://registry.npmjs.org/json-loader/-/json-loader-0.5.7.tgz", - "integrity": "sha512-QLPs8Dj7lnf3e3QYS1zkCo+4ZwqOiF9d/nZnYozTISxXWCfNs9yuky5rJw4/W34s7POaNlbZmQGaB5NiXCbP4w==", + "integrity": "sha1-3KFKcCNf+C8KyaOr62DTN6NlGF0=", "dev": true }, "json-schema": { @@ -4539,7 +4539,7 @@ "lru-cache": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.1.tgz", - "integrity": "sha512-q4spe4KTfsAS1SUHLO0wz8Qiyf1+vMIAgpRYioFYDMNqKfHQbg+AVDH3i4fvpl71/P1L0dBl+fQi+P37UYf0ew==", + "integrity": "sha1-Yi4y6CSItJJ5EUpPns9F581rulU=", "dev": true, "requires": { "pseudomap": "1.0.2", @@ -4555,7 +4555,7 @@ "magic-string": { "version": "0.22.4", "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.22.4.tgz", - "integrity": "sha512-kxBL06p6iO2qPBHsqGK2b3cRwiRGpnmSuVWNhwHcMX7qJOUr1HvricYP1LZOCdkQBUp0jiWg2d6WJwR3vYgByw==", + "integrity": "sha1-MQObTkA2Y5VhjB1s+Bk8U5F0df8=", "dev": true, "requires": { "vlq": "0.2.2" @@ -4616,7 +4616,7 @@ "readable-stream": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz", - "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==", + "integrity": "sha1-No8lEtefnUb9/HE0mueHi7weuVw=", "dev": true, "requires": { "core-util-is": "1.0.2", @@ -4631,7 +4631,7 @@ "string_decoder": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", - "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", + "integrity": "sha1-D8Z9fBQYJd6UKC3VNr7GubzoYKs=", "dev": true, "requires": { "safe-buffer": "5.1.1" @@ -4971,7 +4971,7 @@ "minimatch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "integrity": "sha1-UWbihkV/AzBgZL5Ul+jbsMPTIIM=", "dev": true, "requires": { "brace-expansion": "1.1.8" @@ -5819,7 +5819,7 @@ "readable-stream": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz", - "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==", + "integrity": "sha1-No8lEtefnUb9/HE0mueHi7weuVw=", "dev": true, "requires": { "core-util-is": "1.0.2", @@ -5834,7 +5834,7 @@ "string_decoder": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", - "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", + "integrity": "sha1-D8Z9fBQYJd6UKC3VNr7GubzoYKs=", "dev": true, "requires": { "safe-buffer": "5.1.1" @@ -6566,7 +6566,7 @@ "normalize-package-data": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz", - "integrity": "sha512-9jjUFbTPfEy3R/ad/2oNbKtW9Hgovl5O1FvFWKkKblNXoN/Oou6+9+KKohPK13Yc3/TyunyWhJp6gvRNR/PPAw==", + "integrity": "sha1-EvlaMH1YNSB1oEkHuErIvpisAS8=", "dev": true, "requires": { "hosted-git-info": "2.5.0", @@ -6619,7 +6619,7 @@ "npmlog": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", - "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", + "integrity": "sha1-CKfyqL9zRgR3mp76StXMcXq7lUs=", "dev": true, "requires": { "are-we-there-yet": "1.1.4", @@ -6733,7 +6733,7 @@ "opn": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/opn/-/opn-5.1.0.tgz", - "integrity": "sha512-iPNl7SyM8L30Rm1sjGdLLheyHVw5YXVfi3SKWJzBI7efxRwHojfRFjwE/OLM6qp9xJYMgab8WicTU1cPoY+Hpg==", + "integrity": "sha1-cs4jBqF9vqWP8QQYUzUrSo/HdRk=", "dev": true, "requires": { "is-wsl": "1.1.0" @@ -6944,7 +6944,7 @@ "pbkdf2": { "version": "3.0.13", "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.0.13.tgz", - "integrity": "sha512-+dCHxDH+djNtjgWmvVC/my3SYBAKpKNqKSjLkp+GtWWYe4XPE+e/PSD2aCanlEZZnqPk2uekTKNC/ccbwd2X2Q==", + "integrity": "sha1-w30pVTHnhrHaPj6tyEBCasywriU=", "dev": true, "requires": { "create-hash": "1.1.3", @@ -7270,7 +7270,7 @@ "postcss": { "version": "6.0.8", "resolved": "https://registry.npmjs.org/postcss/-/postcss-6.0.8.tgz", - "integrity": "sha512-G6WnRmdTt2jvJvY+aY+M0AO4YlbxE+slKPZb+jG2P2U9Tyxi3h1fYZ/DgiFU6DC6bv3XIEJoZt+f/kNh8BrWFw==", + "integrity": "sha1-iQZ6nOixH4qEy8URfvwwQZoIV7M=", "dev": true, "requires": { "chalk": "2.1.0", @@ -7281,7 +7281,7 @@ "supports-color": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.2.1.tgz", - "integrity": "sha512-qxzYsob3yv6U+xMzPrv170y8AwGP7i74g+pbixCfD6rgso8BscLT2qXIuz6TpOaiJZ3mFgT5O9lyT9nMU4LfaA==", + "integrity": "sha1-ZaS7JjHpDgJCDbpVVMN1pHVLuDY=", "dev": true, "requires": { "has-flag": "2.0.0" @@ -7308,7 +7308,7 @@ "postcss": { "version": "6.0.8", "resolved": "https://registry.npmjs.org/postcss/-/postcss-6.0.8.tgz", - "integrity": "sha512-G6WnRmdTt2jvJvY+aY+M0AO4YlbxE+slKPZb+jG2P2U9Tyxi3h1fYZ/DgiFU6DC6bv3XIEJoZt+f/kNh8BrWFw==", + "integrity": "sha1-iQZ6nOixH4qEy8URfvwwQZoIV7M=", "dev": true, "requires": { "chalk": "2.1.0", @@ -7319,7 +7319,7 @@ "supports-color": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.2.1.tgz", - "integrity": "sha512-qxzYsob3yv6U+xMzPrv170y8AwGP7i74g+pbixCfD6rgso8BscLT2qXIuz6TpOaiJZ3mFgT5O9lyT9nMU4LfaA==", + "integrity": "sha1-ZaS7JjHpDgJCDbpVVMN1pHVLuDY=", "dev": true, "requires": { "has-flag": "2.0.0" @@ -7346,7 +7346,7 @@ "postcss": { "version": "6.0.8", "resolved": "https://registry.npmjs.org/postcss/-/postcss-6.0.8.tgz", - "integrity": "sha512-G6WnRmdTt2jvJvY+aY+M0AO4YlbxE+slKPZb+jG2P2U9Tyxi3h1fYZ/DgiFU6DC6bv3XIEJoZt+f/kNh8BrWFw==", + "integrity": "sha1-iQZ6nOixH4qEy8URfvwwQZoIV7M=", "dev": true, "requires": { "chalk": "2.1.0", @@ -7357,7 +7357,7 @@ "supports-color": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.2.1.tgz", - "integrity": "sha512-qxzYsob3yv6U+xMzPrv170y8AwGP7i74g+pbixCfD6rgso8BscLT2qXIuz6TpOaiJZ3mFgT5O9lyT9nMU4LfaA==", + "integrity": "sha1-ZaS7JjHpDgJCDbpVVMN1pHVLuDY=", "dev": true, "requires": { "has-flag": "2.0.0" @@ -7384,7 +7384,7 @@ "postcss": { "version": "6.0.8", "resolved": "https://registry.npmjs.org/postcss/-/postcss-6.0.8.tgz", - "integrity": "sha512-G6WnRmdTt2jvJvY+aY+M0AO4YlbxE+slKPZb+jG2P2U9Tyxi3h1fYZ/DgiFU6DC6bv3XIEJoZt+f/kNh8BrWFw==", + "integrity": "sha1-iQZ6nOixH4qEy8URfvwwQZoIV7M=", "dev": true, "requires": { "chalk": "2.1.0", @@ -7395,7 +7395,7 @@ "supports-color": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.2.1.tgz", - "integrity": "sha512-qxzYsob3yv6U+xMzPrv170y8AwGP7i74g+pbixCfD6rgso8BscLT2qXIuz6TpOaiJZ3mFgT5O9lyT9nMU4LfaA==", + "integrity": "sha1-ZaS7JjHpDgJCDbpVVMN1pHVLuDY=", "dev": true, "requires": { "has-flag": "2.0.0" @@ -7572,7 +7572,7 @@ "promise": { "version": "7.3.1", "resolved": "https://registry.npmjs.org/promise/-/promise-7.3.1.tgz", - "integrity": "sha512-nolQXZ/4L+bP/UGlkfaIujX9BKxGwmQ9OT4mOt5yvy8iK1h3wqTEJCijzGANTCCl9nWjY41juyAn2K3Q1hLLTg==", + "integrity": "sha1-BktyYCsY+Q8pGSuLG8QY/9Hr078=", "dev": true, "optional": true, "requires": { @@ -7664,7 +7664,7 @@ "randomatic": { "version": "1.1.7", "resolved": "https://registry.npmjs.org/randomatic/-/randomatic-1.1.7.tgz", - "integrity": "sha512-D5JUjPyJbaJDkuAazpVnSfVkLlpeO3wDlPROTMLGKG1zMFNFRgrciKo1ltz/AzNTkqE0HzDx655QOL51N06how==", + "integrity": "sha1-x6vpzIuHwLqodrGf3oP9RkeX44w=", "dev": true, "requires": { "is-number": "3.0.0", @@ -7705,7 +7705,7 @@ "randombytes": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.0.5.tgz", - "integrity": "sha512-8T7Zn1AhMsQ/HI1SjcCfT/t4ii3eAqco3yOcSzS4mozsOz69lHLsoMXmF9nZgnFanYscnSlUSgs8uZyKzpE6kg==", + "integrity": "sha1-3ACaJGuNCaF3tLegrne8Vw9LG3k=", "dev": true, "requires": { "safe-buffer": "5.1.1" @@ -7777,7 +7777,7 @@ "readable-stream": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz", - "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==", + "integrity": "sha1-No8lEtefnUb9/HE0mueHi7weuVw=", "dev": true, "requires": { "core-util-is": "1.0.2", @@ -7792,7 +7792,7 @@ "string_decoder": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", - "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", + "integrity": "sha1-D8Z9fBQYJd6UKC3VNr7GubzoYKs=", "dev": true, "requires": { "safe-buffer": "5.1.1" @@ -7990,7 +7990,7 @@ "resolve": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.4.0.tgz", - "integrity": "sha512-aW7sVKPufyHqOmyyLzg/J+8606v5nevBgaliIlV7nUpVMsDnoBGV/cbSLNjZAg9q0Cfd/+easKVKQ8vOu8fn1Q==", + "integrity": "sha1-p1vgHFPaJdk0qY69DkxKcxL5KoY=", "dev": true, "requires": { "path-parse": "1.0.5" @@ -8037,7 +8037,7 @@ "rsvp": { "version": "3.6.2", "resolved": "https://registry.npmjs.org/rsvp/-/rsvp-3.6.2.tgz", - "integrity": "sha512-OfWGQTb9vnwRjwtA2QwpG2ICclHC3pgXZO5xt8H2EfgDquO0qVdSb5T88L4qJVAEugbS56pAuV4XZM58UX8ulw==", + "integrity": "sha1-LpZJFZmpbN4bUV1WdKj3qRRSkmo=", "dev": true }, "run-async": { @@ -8081,7 +8081,7 @@ "safe-buffer": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", - "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==", + "integrity": "sha1-iTMSr2myEj3vcfV4iQAWce6yyFM=", "dev": true }, "sass-graph": { @@ -9428,7 +9428,7 @@ "sass-loader": { "version": "6.0.6", "resolved": "https://registry.npmjs.org/sass-loader/-/sass-loader-6.0.6.tgz", - "integrity": "sha512-c3/Zc+iW+qqDip6kXPYLEgsAu2lf4xz0EZDplB7EmSUMda12U1sGJPetH55B/j9eu0bTtKzKlNPWWyYC7wFNyQ==", + "integrity": "sha1-6dXmwfFV+qMqSybXqbcQfCJeQPk=", "dev": true, "requires": { "async": "2.5.0", @@ -9449,7 +9449,7 @@ "sax": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", - "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==", + "integrity": "sha1-KBYjTiN4vdxOU1T6tcqold9xANk=", "dev": true }, "schema-utils": { @@ -9525,7 +9525,7 @@ "semver": { "version": "5.4.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.4.1.tgz", - "integrity": "sha512-WfG/X9+oATh81XtllIo/I8gOiY9EXRdv1cQdyykeXK17YcUW3EXUAi2To4pcH6nZtJPr7ZOpM5OMyWJZm+8Rsg==", + "integrity": "sha1-4FnAnYVx8FQII3M0M1BdOi8AsY4=", "dev": true }, "send": { @@ -9852,7 +9852,7 @@ "readable-stream": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz", - "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==", + "integrity": "sha1-No8lEtefnUb9/HE0mueHi7weuVw=", "dev": true, "requires": { "core-util-is": "1.0.2", @@ -9867,7 +9867,7 @@ "string_decoder": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", - "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", + "integrity": "sha1-D8Z9fBQYJd6UKC3VNr7GubzoYKs=", "dev": true, "requires": { "safe-buffer": "5.1.1" @@ -9954,7 +9954,7 @@ "readable-stream": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz", - "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==", + "integrity": "sha1-No8lEtefnUb9/HE0mueHi7weuVw=", "dev": true, "optional": true, "requires": { @@ -9976,7 +9976,7 @@ "string_decoder": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", - "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", + "integrity": "sha1-D8Z9fBQYJd6UKC3VNr7GubzoYKs=", "dev": true, "optional": true, "requires": { @@ -10011,7 +10011,7 @@ "readable-stream": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz", - "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==", + "integrity": "sha1-No8lEtefnUb9/HE0mueHi7weuVw=", "dev": true, "requires": { "core-util-is": "1.0.2", @@ -10026,7 +10026,7 @@ "string_decoder": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", - "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", + "integrity": "sha1-D8Z9fBQYJd6UKC3VNr7GubzoYKs=", "dev": true, "requires": { "safe-buffer": "5.1.1" @@ -10037,7 +10037,7 @@ "stream-http": { "version": "2.7.2", "resolved": "https://registry.npmjs.org/stream-http/-/stream-http-2.7.2.tgz", - "integrity": "sha512-c0yTD2rbQzXtSsFSVhtpvY/vS6u066PcXOX9kBB3mSO76RiUQzL340uJkGBWnlBg4/HZzqiUXtaVA7wcRcJgEw==", + "integrity": "sha1-QKBQ7I3DtTsz2ZCUFcAsC/Gr+60=", "dev": true, "requires": { "builtin-status-codes": "3.0.0", @@ -10056,7 +10056,7 @@ "readable-stream": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz", - "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==", + "integrity": "sha1-No8lEtefnUb9/HE0mueHi7weuVw=", "dev": true, "requires": { "core-util-is": "1.0.2", @@ -10071,7 +10071,7 @@ "string_decoder": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", - "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", + "integrity": "sha1-D8Z9fBQYJd6UKC3VNr7GubzoYKs=", "dev": true, "requires": { "safe-buffer": "5.1.1" @@ -10094,7 +10094,7 @@ "string-width": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "integrity": "sha1-q5Pyeo3BPSjKyBXEYhQ6bZASrp4=", "dev": true, "requires": { "is-fullwidth-code-point": "2.0.0", @@ -10310,7 +10310,7 @@ "timers-browserify": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/timers-browserify/-/timers-browserify-2.0.3.tgz", - "integrity": "sha512-+JAqyNgg+M8+gXIrq2EeUr4kZqRz47Ysco7X5QKRGScRE9HIHckyHD1asozSFGeqx2nmPCgA8T5tIGVO0ML7/w==", + "integrity": "sha1-Qf0L3JJqX+7cM6F6jh99SRkl9/w=", "dev": true, "requires": { "global": "4.3.2", @@ -11931,7 +11931,7 @@ "uglify-js": { "version": "3.0.27", "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.0.27.tgz", - "integrity": "sha512-HD8CmxPXUI62v5tweiulMcP/apAtx1DXGcNZkhKQZyC+MTrTsoCBb8yPAwVrbvpgw3EpRU76bRe6axjIiCYcQg==", + "integrity": "sha1-qX24yLprnbpOL4jYaqlUj6YyADQ=", "dev": true, "requires": { "commander": "2.11.0", @@ -12154,7 +12154,7 @@ "uuid": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.1.0.tgz", - "integrity": "sha512-DIWtzUkw04M4k3bf1IcpS2tngXEL26YUD2M0tMDUpnUrz2hgzUBlD55a4FjdLGPvfHxS6uluGWvaVEqgBcVa+g==", + "integrity": "sha1-PdPT55Crwk17DToDT/q6vijrvAQ=", "dev": true, "optional": true }, @@ -12219,7 +12219,7 @@ "walk-sync": { "version": "0.3.2", "resolved": "https://registry.npmjs.org/walk-sync/-/walk-sync-0.3.2.tgz", - "integrity": "sha512-FMB5VqpLqOCcqrzA9okZFc0wq0Qbmdm396qJxvQZhDpyu0W95G9JCmp74tx7iyYnyOcBtUuKJsgIKAqjozvmmQ==", + "integrity": "sha1-SCcoCvxC0OA1NnxKTjHurA0Tb3U=", "dev": true, "requires": { "ensure-posix-path": "1.0.2", @@ -12324,7 +12324,7 @@ "supports-color": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.2.1.tgz", - "integrity": "sha512-qxzYsob3yv6U+xMzPrv170y8AwGP7i74g+pbixCfD6rgso8BscLT2qXIuz6TpOaiJZ3mFgT5O9lyT9nMU4LfaA==", + "integrity": "sha1-ZaS7JjHpDgJCDbpVVMN1pHVLuDY=", "dev": true, "requires": { "has-flag": "2.0.0" @@ -12583,7 +12583,7 @@ "webpack-sources": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-1.0.1.tgz", - "integrity": "sha512-05tMxipUCwHqYaVS8xc7sYPTly8PzXayRCB4dTxLhWTqlKUiwH6ezmEe0OSreL1c30LAuA3Zqmc+uEBUGFJDjw==", + "integrity": "sha1-xzVkNqTRMSO+LiQmoF0drZy+Zc8=", "dev": true, "requires": { "source-list-map": "2.0.0", @@ -12593,7 +12593,7 @@ "source-list-map": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/source-list-map/-/source-list-map-2.0.0.tgz", - "integrity": "sha512-I2UmuJSRr/T8jisiROLU3A3ltr+swpniSmNPI4Ml3ZCX6tVnDsuZzK7F2hl5jTqbZBWCEKlj5HRQiPExXLgE8A==", + "integrity": "sha1-qqR0A/eyRakvvJfqCPJQ1gh+0IU=", "dev": true } } @@ -12628,7 +12628,7 @@ "which": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz", - "integrity": "sha512-xcJpopdamTuY5duC/KnTTNBraPK54YwpenP4lzxU8H91GudWpFv38u0CKjclE1Wi2EH2EDz5LRcHcKbCIzqGyg==", + "integrity": "sha1-/wS9/AEO5UfXgL7DjhrBwnd9JTo=", "dev": true, "requires": { "isexe": "2.0.0" @@ -12643,7 +12643,7 @@ "wide-align": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.2.tgz", - "integrity": "sha512-ijDLlyQ7s6x1JgCLur53osjm/UXUYD9+0PbYKrBsYisYXzCxN+HC3mYDNy/dWdmf3AwqwU3CXwDCvsNgGK1S0w==", + "integrity": "sha1-Vx4PGwYEY268DfwhsDObvjE0FxA=", "dev": true, "requires": { "string-width": "1.0.2" diff --git a/src/Web/WebStatus/Dockerfile.nanowin b/src/Web/WebStatus/Dockerfile.nanowin deleted file mode 100644 index 9405cf26d..000000000 --- a/src/Web/WebStatus/Dockerfile.nanowin +++ /dev/null @@ -1,8 +0,0 @@ -FROM microsoft/dotnet:2.0-runtime-nanoserver -SHELL ["powershell"] -ARG source -WORKDIR /app -RUN set-itemproperty -path 'HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters' -Name ServerPriorityTimeLimit -Value 0 -Type DWord -EXPOSE 80 -COPY ${source:-obj/Docker/publish} . -ENTRYPOINT ["dotnet", "WebStatus.dll"] From dcc1ec620fe5919e9033f4d8e4e64e84d086af94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eduard=20Tom=C3=A0s?= Date: Tue, 5 Sep 2017 08:43:24 +0200 Subject: [PATCH 63/64] Removed GracePeriodManager project as it is no longer used in netcore2 --- cli-windows/build-bits.ps1 | 1 - 1 file changed, 1 deletion(-) diff --git a/cli-windows/build-bits.ps1 b/cli-windows/build-bits.ps1 index 4191515f6..a33f3bc8b 100644 --- a/cli-windows/build-bits.ps1 +++ b/cli-windows/build-bits.ps1 @@ -18,7 +18,6 @@ $projectPaths = @{Path="$rootPath\src\Services\Catalog\Catalog.API";Prj="Catalog.API.csproj"}, @{Path="$rootPath\src\Services\Ordering\Ordering.API";Prj="Ordering.API.csproj"}, @{Path="$rootPath\src\Services\Basket\Basket.API";Prj="Basket.API.csproj"}, - @{Path="$rootPath\src\Services\GracePeriod\GracePeriodManager";Prj="GracePeriodManager.csproj"}, @{Path="$rootPath\src\Services\Location\Locations.API";Prj="Locations.API.csproj"}, @{Path="$rootPath\src\Services\Marketing\Marketing.API";Prj="Marketing.API.csproj"}, @{Path="$rootPath\src\Services\Payment\Payment.API";Prj="Payment.API.csproj"}, From 6fd4f46058e85fc4d862b8a5d1e9447f844857b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eduard=20Tom=C3=A0s?= Date: Tue, 5 Sep 2017 15:55:17 +0200 Subject: [PATCH 64/64] Fix for rabbitMQ under windows containers. Also some config tweaking on windows --- .env | 2 + cli-windows/start-windows-containers.ps1 | 18 ++++++- docker-compose-windows.yml | 14 ++--- docker-compose.override.windows.yml | 53 +++++++++++++++++++ docker-compose.override.yml | 14 ++++- src/Services/Basket/Basket.API/Startup.cs | 9 ++++ src/Services/Catalog/Catalog.API/Startup.cs | 13 ++++- .../Location/Locations.API/Startup.cs | 14 ++++- .../Marketing/Marketing.API/Startup.cs | 9 ++++ src/Services/Ordering/Ordering.API/Startup.cs | 11 ++++ src/Services/Payment/Payment.API/Startup.cs | 11 +++- 11 files changed, 152 insertions(+), 16 deletions(-) create mode 100644 docker-compose.override.windows.yml diff --git a/.env b/.env index f77f64682..797e5fc5c 100644 --- a/.env +++ b/.env @@ -21,3 +21,5 @@ ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP=10.121.122.92 #ESHOP_AZURE_STORAGE_CATALOG_KEY= #ESHOP_AZURE_STORAGE_MARKETING_NAME= #ESHOP_AZURE_STORAGE_MARKETING_KEY= +#ESHOP_SERVICE_BUS_USERNAME= +#ESHOP_SERVICE_BUS_PASSWORD= diff --git a/cli-windows/start-windows-containers.ps1 b/cli-windows/start-windows-containers.ps1 index 56b7a34e9..91d8eb7f7 100644 --- a/cli-windows/start-windows-containers.ps1 +++ b/cli-windows/start-windows-containers.ps1 @@ -1,5 +1,10 @@ +# rootPath: Root path of the repo (where docker-compose*.yml are). If not passed ../cli-windows/ is assumed +# buildBits: If the projects must be built before. Default value: $true +# customEventBusLoginPassword: If a custom RabbitMQ image is used that do not use the default user login/pwd. Default: $false (means assume use default spring2/rabbitmq image) + Param( [parameter(Mandatory=$false)][string] $rootPath, + [parameter(Mandatory=$false)][bool] $customEventBusLoginPassword=$false, [parameter(Mandatory=$false)][bool]$buildBits=$true ) @@ -13,4 +18,15 @@ Write-Host "Root path used is $rootPath" -ForegroundColor Yellow if ($buildBits) { & $scriptPath\build-bits.ps1 -rootPath $rootPath } -docker-compose -f "$rootPath\docker-compose-windows.yml" -f "$rootPath\docker-compose.override.yml" up + + +$env:ESHOP_EXTERNAL_DNS_NAME_OR_IP = "10.0.75.1" +$env:ESHOP_AZURE_STORAGE_CATALOG_URL ="http://10.0.75.1:5101/api/v1/catalog/items/[0]/pic/" +$env:ESHOP_AZURE_STORAGE_MARKETING_URL ="http://10.0.75.1:5110/api/v1/campaigns/[0]/pic/" + +if (-Not $customEventBusLoginPassword) { + docker-compose -f "$rootPath\docker-compose-windows.yml" -f "$rootPath\docker-compose.override.yml" -f "$rootPath\docker-compose.override.windows.yml" up +} +else { + docker-compose -f "$rootPath\docker-compose-windows.yml" -f "$rootPath\docker-compose.override.yml" up +} diff --git a/docker-compose-windows.yml b/docker-compose-windows.yml index 1a71968ba..294d5f7f5 100644 --- a/docker-compose-windows.yml +++ b/docker-compose-windows.yml @@ -38,7 +38,7 @@ services: - rabbitmq marketing.api: - image: eshop/marketing.api:${TAG:-latest} + image: eshop/marketing.api-win:${TAG:-latest} build: context: ./src/Services/Marketing/Marketing.API dockerfile: Dockerfile @@ -73,13 +73,13 @@ services: - marketing.api webstatus: - image: eshop/webstatus:${TAG:-latest} + image: eshop/webstatus-win:${TAG:-latest} build: context: ./src/Web/WebStatus dockerfile: Dockerfile payment.api: - image: eshop/payment.api:${TAG:-latest} + image: eshop/payment.api-win:${TAG:-latest} build: context: ./src/Services/Payment/Payment.API dockerfile: Dockerfile @@ -87,7 +87,7 @@ services: - rabbitmq locations.api: - image: eshop/locations.api:${TAG:-latest} + image: eshop/locations.api-win:${TAG:-latest} build: context: ./src/Services/Location/Locations.API dockerfile: Dockerfile @@ -103,17 +103,11 @@ services: basket.data: image: redis:nanoserver -# build: -# context: ./_docker/redis -# dockerfile: Dockerfile ports: - "6379:6379" rabbitmq: image: spring2/rabbitmq -# build: -# context: ./_docker/rabbitmq -# dockerfile: Dockerfile ports: - "15672:15672" - "5672:5672" diff --git a/docker-compose.override.windows.yml b/docker-compose.override.windows.yml new file mode 100644 index 000000000..130405d3b --- /dev/null +++ b/docker-compose.override.windows.yml @@ -0,0 +1,53 @@ +version: '2.1' + +# ONLY NEEDED WHEN RUNNING WINDOWS CONTAINERS +# +# This file sets the containers' environment variables: +# +# - EventBusUerName +# - EventBusPassword +# +# To the default username & password used in the spring2/rabbitmq image. +# +# If you are using any other rabbitmq image with any other username/pwd then you can: +# +# Set your shell environment variables: +# - ESHOP_SERVICE_BUS_USERNAME +# - ESHOP_SERVICE_BUS_PASSWORD +# +# With the appropiate values (note that you can use .env file also) AND DO NOT USE THIS FILE when launching windows container: +# +# docker-compose -f docker-compose-windows.yml -f docker-compose.override.yml up +# INSTEAD OF +# docker-compose -f docker-compose-windows.yml -f docker-compose.override.yml -f docker-compose.override.windows.yml up + +services: + basket.api: + environment: + - EventBusUserName=admin + - EventBusPassword=password + + catalog.api: + environment: + - EventBusUserName=admin + - EventBusPassword=password + + ordering.api: + environment: + - EventBusUserName=admin + - EventBusPassword=password + + marketing.api: + environment: + - EventBusUserName=admin + - EventBusPassword=password + + payment.api: + environment: + - EventBusUserName=admin + - EventBusPassword=password + + locations.api: + environment: + - EventBusUserName=admin + - EventBusPassword=password \ No newline at end of file diff --git a/docker-compose.override.yml b/docker-compose.override.yml index 6870b617f..8757c8f83 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -16,6 +16,8 @@ services: - identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5110. - IdentityUrlExternal=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5105 - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} + - EventBusUserName=${ESHOP_SERVICE_BUS_USERNAME} + - EventBusPassword=${ESHOP_SERVICE_BUS_PASSWORD} - AzureServiceBusEnabled=False ports: - "5103:80" @@ -27,6 +29,8 @@ services: - ConnectionString=${ESHOP_AZURE_CATALOG_DB:-Server=sql.data;Database=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word} - PicBaseUrl=${ESHOP_AZURE_STORAGE_CATALOG_URL:-http://localhost:5101/api/v1/catalog/items/[0]/pic/} #Local: You need to open your local dev-machine firewall at range 5100-5110. - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} + - EventBusUserName=${ESHOP_SERVICE_BUS_USERNAME} + - EventBusPassword=${ESHOP_SERVICE_BUS_PASSWORD} - AzureStorageAccountName=${ESHOP_AZURE_STORAGE_CATALOG_NAME} - AzureStorageAccountKey=${ESHOP_AZURE_STORAGE_CATALOG_KEY} - UseCustomizationData=True @@ -47,7 +51,7 @@ services: - MarketingApiClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5110 - BasketApiClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5103 - OrderingApiClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5102 - - UseCustomizationData=True + - UseCustomizationData=True ports: - "5105:80" @@ -59,6 +63,8 @@ services: - identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5110. - IdentityUrlExternal=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5105 - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} + - EventBusUserName=${ESHOP_SERVICE_BUS_USERNAME} + - EventBusPassword=${ESHOP_SERVICE_BUS_PASSWORD} - UseCustomizationData=True - AzureServiceBusEnabled=False - GracePeriodTime=1 @@ -74,6 +80,8 @@ services: - MongoConnectionString=${ESHOP_AZURE_COSMOSDB:-mongodb://nosql.data} - MongoDatabase=MarketingDb - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} + - EventBusUserName=${ESHOP_SERVICE_BUS_USERNAME} + - EventBusPassword=${ESHOP_SERVICE_BUS_PASSWORD} - identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5110. - IdentityUrlExternal=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5105 - CampaignDetailFunctionUri=${ESHOP_AZUREFUNC_CAMPAIGN_DETAILS_URI} @@ -137,6 +145,8 @@ services: - ASPNETCORE_ENVIRONMENT=Development - ASPNETCORE_URLS=http://0.0.0.0:80 - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} + - EventBusUserName=${ESHOP_SERVICE_BUS_USERNAME} + - EventBusPassword=${ESHOP_SERVICE_BUS_PASSWORD} - AzureServiceBusEnabled=False ports: - "5108:80" @@ -150,6 +160,8 @@ services: - identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5110. - IdentityUrlExternal=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5105 - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} + - EventBusUserName=${ESHOP_SERVICE_BUS_USERNAME} + - EventBusPassword=${ESHOP_SERVICE_BUS_PASSWORD} - AzureServiceBusEnabled=False ports: - "5109:80" diff --git a/src/Services/Basket/Basket.API/Startup.cs b/src/Services/Basket/Basket.API/Startup.cs index 6a432b290..1f62e44cb 100644 --- a/src/Services/Basket/Basket.API/Startup.cs +++ b/src/Services/Basket/Basket.API/Startup.cs @@ -103,6 +103,15 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API HostName = Configuration["EventBusConnection"] }; + if (!string.IsNullOrEmpty(Configuration["EventBusUserName"])) { + factory.UserName = Configuration["EventBusUserName"]; + } + + if (!string.IsNullOrEmpty(Configuration["EventBusPassword"])) + { + factory.Password = Configuration["EventBusPassword"]; + } + return new DefaultRabbitMQPersistentConnection(factory, logger); }); } diff --git a/src/Services/Catalog/Catalog.API/Startup.cs b/src/Services/Catalog/Catalog.API/Startup.cs index 64754c3ab..354d0643e 100644 --- a/src/Services/Catalog/Catalog.API/Startup.cs +++ b/src/Services/Catalog/Catalog.API/Startup.cs @@ -132,11 +132,22 @@ { var settings = sp.GetRequiredService>().Value; var logger = sp.GetRequiredService>(); + var factory = new ConnectionFactory() { - HostName = settings.EventBusConnection + HostName = Configuration["EventBusConnection"] }; + if (!string.IsNullOrEmpty(Configuration["EventBusUserName"])) + { + factory.UserName = Configuration["EventBusUserName"]; + } + + if (!string.IsNullOrEmpty(Configuration["EventBusPassword"])) + { + factory.Password = Configuration["EventBusPassword"]; + } + return new DefaultRabbitMQPersistentConnection(factory, logger); }); } diff --git a/src/Services/Location/Locations.API/Startup.cs b/src/Services/Location/Locations.API/Startup.cs index eb2077c8c..4b92afa02 100644 --- a/src/Services/Location/Locations.API/Startup.cs +++ b/src/Services/Location/Locations.API/Startup.cs @@ -62,12 +62,22 @@ namespace Microsoft.eShopOnContainers.Services.Locations.API services.AddSingleton(sp => { var logger = sp.GetRequiredService>(); - - var factory = new ConnectionFactory + + var factory = new ConnectionFactory() { HostName = Configuration["EventBusConnection"] }; + if (!string.IsNullOrEmpty(Configuration["EventBusUserName"])) + { + factory.UserName = Configuration["EventBusUserName"]; + } + + if (!string.IsNullOrEmpty(Configuration["EventBusPassword"])) + { + factory.Password = Configuration["EventBusPassword"]; + } + return new DefaultRabbitMQPersistentConnection(factory, logger); }); } diff --git a/src/Services/Marketing/Marketing.API/Startup.cs b/src/Services/Marketing/Marketing.API/Startup.cs index 89f8482f9..37d6911c1 100644 --- a/src/Services/Marketing/Marketing.API/Startup.cs +++ b/src/Services/Marketing/Marketing.API/Startup.cs @@ -106,6 +106,15 @@ HostName = Configuration["EventBusConnection"] }; + if (!string.IsNullOrEmpty(Configuration["EventBusUserName"])) + { + factory.UserName = Configuration["EventBusUserName"]; + } + + if (!string.IsNullOrEmpty(Configuration["EventBusPassword"])) + { + factory.Password = Configuration["EventBusPassword"]; + } return new DefaultRabbitMQPersistentConnection(factory, logger); }); } diff --git a/src/Services/Ordering/Ordering.API/Startup.cs b/src/Services/Ordering/Ordering.API/Startup.cs index 7f22540fa..2d2f94423 100644 --- a/src/Services/Ordering/Ordering.API/Startup.cs +++ b/src/Services/Ordering/Ordering.API/Startup.cs @@ -148,11 +148,22 @@ { var logger = sp.GetRequiredService>(); + var factory = new ConnectionFactory() { HostName = Configuration["EventBusConnection"] }; + if (!string.IsNullOrEmpty(Configuration["EventBusUserName"])) + { + factory.UserName = Configuration["EventBusUserName"]; + } + + if (!string.IsNullOrEmpty(Configuration["EventBusPassword"])) + { + factory.Password = Configuration["EventBusPassword"]; + } + return new DefaultRabbitMQPersistentConnection(factory, logger); }); } diff --git a/src/Services/Payment/Payment.API/Startup.cs b/src/Services/Payment/Payment.API/Startup.cs index 5e87c4e19..c4ab2c322 100644 --- a/src/Services/Payment/Payment.API/Startup.cs +++ b/src/Services/Payment/Payment.API/Startup.cs @@ -51,12 +51,21 @@ namespace Payment.API services.AddSingleton(sp => { var logger = sp.GetRequiredService>(); - var factory = new ConnectionFactory() { HostName = Configuration["EventBusConnection"] }; + if (!string.IsNullOrEmpty(Configuration["EventBusUserName"])) + { + factory.UserName = Configuration["EventBusUserName"]; + } + + if (!string.IsNullOrEmpty(Configuration["EventBusPassword"])) + { + factory.Password = Configuration["EventBusPassword"]; + } + return new DefaultRabbitMQPersistentConnection(factory, logger); }); }