diff --git a/build-bits.sh b/CLI-Mac/build-bits.sh
old mode 100755
new mode 100644
similarity index 79%
rename from build-bits.sh
rename to CLI-Mac/build-bits.sh
index 452236882..caf246e95
--- a/build-bits.sh
+++ b/CLI-Mac/build-bits.sh
@@ -1,12 +1,12 @@
#!/bin/sh
projectList=(
- "src/Services/Catalog/Catalog.API"
- "src/Services/Basket/Basket.API"
- "src/Services/Ordering/Ordering.API"
- "src/Services/Identity/Identity.API"
- "src/Web/WebMVC"
- "src/Web/WebSPA"
+ "../src/Services/Catalog/Catalog.API"
+ "../src/Services/Basket/Basket.API"
+ "../src/Services/Ordering/Ordering.API"
+ "../src/Services/Identity/Identity.API"
+ "../src/Web/WebMVC"
+ "../src/Web/WebSPA"
)
for project in "${projectList[@]}"
diff --git a/add-firewall-rules-for-sts-auth-thru-docker.ps1 b/CLI-Windows/add-firewall-rules-for-sts-auth-thru-docker.ps1
similarity index 100%
rename from add-firewall-rules-for-sts-auth-thru-docker.ps1
rename to CLI-Windows/add-firewall-rules-for-sts-auth-thru-docker.ps1
diff --git a/build-bits.ps1 b/CLI-Windows/build-bits-expanded.ps1
similarity index 91%
rename from build-bits.ps1
rename to CLI-Windows/build-bits-expanded.ps1
index d81cdc8a0..b920b55e8 100644
--- a/build-bits.ps1
+++ b/CLI-Windows/build-bits-expanded.ps1
@@ -1,9 +1,15 @@
+Param([string] $rootPath)
$scriptPath = Split-Path $script:MyInvocation.MyCommand.Path
-
+
Write-Host "Current script directory is $scriptPath" -ForegroundColor Yellow
+if ([string]::IsNullOrEmpty($rootPath)) {
+ $rootPath = "$scriptPath\.."
+}
+Write-Host "Root path used is $rootPath" -ForegroundColor Yellow
+
# *** WebMVC paths ***
-$webMVCPath = $scriptPath + "\src\Web\WebMVC"
+$webMVCPath = $rootPath + "\src\Web\WebMVC"
$webMVCPathToProject = $webMVCPath + "\WebMVC.csproj"
Write-Host "webMVCPathToProject is $webMVCPathToProject" -ForegroundColor Yellow
$webMVCPathToPub = $webMVCPath + "\obj\Docker\publish"
@@ -11,7 +17,7 @@ Write-Host "webMVCPathToPub is $webMVCPathToPub" -ForegroundColor Yellow
# *** WebSPA paths ***
-$webSPAPath = $scriptPath + "\src\Web\WebSPA"
+$webSPAPath = $rootPath + "\src\Web\WebSPA"
$webSPAPathToProject = $webSPAPath + "\WebSPA.csproj"
Write-Host "webSPAPathToProject is $webSPAPathToProject" -ForegroundColor Yellow
$webSPAPathToPub = $webSPAPath + "\obj\Docker\publish"
@@ -19,7 +25,7 @@ Write-Host "webSPAPathToPub is $webSPAPathToPub" -ForegroundColor Yellow
# *** IdentitySvc paths ***
-$identitySvcPath = $scriptPath + "\src\Services\Identity\Identity.API"
+$identitySvcPath = $rootPath + "\src\Services\Identity\Identity.API"
$identitySvcToProject = $identitySvcPath + "\Identity.API.csproj"
Write-Host "identitySvcToProject is $identitySvcToProject" -ForegroundColor Yellow
$identitySvcPathToPub = $identitySvcPath + "\obj\Docker\publish"
@@ -27,7 +33,7 @@ Write-Host "identitySvcPathToPub is $identitySvcPathToPub" -ForegroundColor Yell
# *** Catalog paths ***
-$catalogPath = $scriptPath + "\src\Services\Catalog\Catalog.API"
+$catalogPath = $rootPath + "\src\Services\Catalog\Catalog.API"
$catalogPathToProject = $catalogPath + "\Catalog.API.csproj"
Write-Host "catalogPathToProject is $catalogPathToProject" -ForegroundColor Yellow
$catalogPathToPub = $catalogPath + "\obj\Docker\publish"
@@ -35,14 +41,14 @@ Write-Host "catalogPathToPub is $catalogPathToPub" -ForegroundColor Yellow
# *** Ordering paths ***
-$orderingPath = $scriptPath + "\src\Services\Ordering\Ordering.API"
+$orderingPath = $rootPath + "\src\Services\Ordering\Ordering.API"
$orderingPathToProject = $orderingPath + "\Ordering.API.csproj"
Write-Host "orderingPathToProject is $orderingPathToProject" -ForegroundColor Yellow
$orderingPathToPub = $orderingPath + "\obj\Docker\publish"
Write-Host "orderingPathToPub is $orderingPathToPub" -ForegroundColor Yellow
# *** Basket paths ***
-$basketPath = $scriptPath + "\src\Services\Basket\Basket.API"
+$basketPath = $rootPath + "\src\Services\Basket\Basket.API"
$basketPathToProject = $basketPath + "\Basket.API.csproj"
Write-Host "basketPathToProject is $basketPathToProject" -ForegroundColor Yellow
$basketPathToPub = $basketPath + "\obj\Docker\publish"
diff --git a/CLI-Windows/build-bits.ps1 b/CLI-Windows/build-bits.ps1
new file mode 100644
index 000000000..21a1b6e34
--- /dev/null
+++ b/CLI-Windows/build-bits.ps1
@@ -0,0 +1,52 @@
+Param([string] $rootPath)
+$scriptPath = Split-Path $script:MyInvocation.MyCommand.Path
+
+Write-Host "Current script directory is $scriptPath" -ForegroundColor Yellow
+
+if ([string]::IsNullOrEmpty($rootPath)) {
+ $rootPath = "$scriptPath\.."
+}
+Write-Host "Root path used is $rootPath" -ForegroundColor Yellow
+
+$projectPaths =
+ @{Path="$rootPath\src\Web\WebMVC";Prj="WebMVC.csproj"},
+ @{Path="$rootPath\src\Web\WebSPA";Prj="WebSPA.csproj"},
+ @{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"}
+
+$projectPaths | foreach {
+ $projectPath = $_.Path
+ $projectFile = $_.Prj
+ $outPath = $_.Path + "\obj\Docker\publish"
+ $projectPathAndFile = "$projectPath\$projectFile"
+ Write-Host "Deleting $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
+}
+
+
+########################################################################################
+# Delete old eShop Docker images
+########################################################################################
+
+$imagesToDelete = docker images --filter=reference="eshop/*" -q
+
+If (-Not $imagesToDelete) {Write-Host "Not deleting eShop images as there are no eShop images in the current local Docker repo."}
+Else
+{
+ # Delete all containers
+ Write-Host "Deleting all containers in local Docker Host"
+ docker rm $(docker ps -a -q) -f
+
+ # Delete all eshop images
+ Write-Host "Deleting eShop images in local Docker repo"
+ Write-Host $imagesToDelete
+ docker rmi $(docker images --filter=reference="eshop/*" -q) -f
+}
+
+# WE DON'T NEED DOCKER BUILD AS WE CAN RUN "DOCKER-COMPOSE BUILD" OR "DOCKER-COMPOSE UP" AND IT WILL BUILD ALL THE IMAGES IN THE .YML FOR US
diff --git a/delete-images.ps1 b/CLI-Windows/delete-images.ps1
similarity index 84%
rename from delete-images.ps1
rename to CLI-Windows/delete-images.ps1
index 40f31a9ff..954faa37d 100644
--- a/delete-images.ps1
+++ b/CLI-Windows/delete-images.ps1
@@ -1,7 +1,3 @@
-$scriptPath = Split-Path $script:MyInvocation.MyCommand.Path
-
-Write-Host "Current script directory is $scriptPath" -ForegroundColor Yellow
-
$imagesToDelete = docker images --filter=reference="eshop/*" -q
If (-Not $imagesToDelete) {Write-Host "Not deleting eShop images as there are no eShop images in the current local Docker repo."}
diff --git a/CLI-Windows/start-external.ps1 b/CLI-Windows/start-external.ps1
new file mode 100644
index 000000000..514b7af7f
--- /dev/null
+++ b/CLI-Windows/start-external.ps1
@@ -0,0 +1,11 @@
+Param([string] $rootPath)
+$scriptPath = Split-Path $script:MyInvocation.MyCommand.Path
+
+Write-Host "Current script directory is $scriptPath" -ForegroundColor Yellow
+
+if ([string]::IsNullOrEmpty($rootPath)) {
+ $rootPath = "$scriptPath\.."
+}
+Write-Host "Root path used is $rootPath" -ForegroundColor Yellow
+
+docker-compose -f "$rootPath\docker-compose-external.yml" -f "$rootPath\docker-compose-external.override.yml" up
diff --git a/CLI-Windows/start-windows-containers.ps1 b/CLI-Windows/start-windows-containers.ps1
new file mode 100644
index 000000000..300c63568
--- /dev/null
+++ b/CLI-Windows/start-windows-containers.ps1
@@ -0,0 +1,9 @@
+Param([string] $rootPath)
+$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
diff --git a/README.md b/README.md
index 47a150e96..2436a8b8d 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,9 @@
Sample .NET Core reference application, powered by Microsoft, based on a simplified microservices architecture and Docker containers.
> ### DISCLAIMER
-> This reference application proposes a simplified microservice oriented architecture implementation (currently in ALPHA state) to introduce technologies like .NET Core with Docker containers through a comprehensive but simplified application. However, this reference application it is not trying to solve all the problems in a large and mission-critical distributed system, it is just a bootstrap for developers to easily get started in the world of Docker containers and microservices with .NET Core.
+> IMPORTANT: The current state of this sample application is ALPHA, therefore, many areas could change significantly while refactoring and getting improvements. Feedback and pull requests from the community will be appreciated.
+>
+> This reference application proposes a simplified microservice oriented architecture implementation (as mentioned, currently in ALPHA state) to introduce technologies like .NET Core with Docker containers through a comprehensive but simplified application. However, this reference application it is not trying to solve all the problems in a large and mission-critical distributed system, it is just a bootstrap for developers to easily get started in the world of Docker containers and microservices with .NET Core.
>
For example, the next step (still not covered here) after understanding Docker containers and microservices is to select a microservice cluster/orchestrator like Docker Swarm, Kubernetes or DC/OS (in Azure Container Service) or Azure Service Fabric which in most of the cases will require additional partial changes to your application's configuration (although the present architecture should work on most orchestrators with small changes). In the future we might fork this project and make multiple versions targeting specific microservice cluster/orchestrators.
> Read the planned Roadmap and Milestones for future releases of eShopOnContainers within the Wiki for further info about possible new implementations and provide feedback at the ISSUES level if you'd like to see any specific scenario implemented.
diff --git a/README.md.saved.bak b/README.md.saved.bak
new file mode 100644
index 000000000..2436a8b8d
--- /dev/null
+++ b/README.md.saved.bak
@@ -0,0 +1,86 @@
+# eShopOnContainers - Microservices Architecture and Containers based Reference Application (**ALPHA state** - VS 2017 and CLI environments compatible)
+Sample .NET Core reference application, powered by Microsoft, based on a simplified microservices architecture and Docker containers.
+
+> ### DISCLAIMER
+> IMPORTANT: The current state of this sample application is ALPHA, therefore, many areas could change significantly while refactoring and getting improvements. Feedback and pull requests from the community will be appreciated.
+>
+> This reference application proposes a simplified microservice oriented architecture implementation (as mentioned, currently in ALPHA state) to introduce technologies like .NET Core with Docker containers through a comprehensive but simplified application. However, this reference application it is not trying to solve all the problems in a large and mission-critical distributed system, it is just a bootstrap for developers to easily get started in the world of Docker containers and microservices with .NET Core.
+>
For example, the next step (still not covered here) after understanding Docker containers and microservices is to select a microservice cluster/orchestrator like Docker Swarm, Kubernetes or DC/OS (in Azure Container Service) or Azure Service Fabric which in most of the cases will require additional partial changes to your application's configuration (although the present architecture should work on most orchestrators with small changes). In the future we might fork this project and make multiple versions targeting specific microservice cluster/orchestrators.
+> Read the planned Roadmap and Milestones for future releases of eShopOnContainers within the Wiki for further info about possible new implementations and provide feedback at the ISSUES level if you'd like to see any specific scenario implemented.
+
+
+This reference application is cross-platform either in the server and client side, thanks to .NET Core services capable of running on Linux or Windows containers depending on your Docker host, and to Xamarin for mobile apps running on Android, iOS or Windows/UWP plus any browser for the client web apps.
+
+
+
+
+
+> ### Important Note on Database Servers/Containers
+> In this solution's current configuration for a development environment, the SQL databases are automatically deployed with sample data into a single SQL Server for Linux container (a single shared Docker container for SQL databases) so the whole solution can be up and running without any dependency in the cloud or server. Each database could also be deployed as a single Docker container, but then you'd need more then 8GB or memory RAM in your development machine in order to be able to run 3 SQL Server Docker containers in your Docker Linux host in "Docker for Windows" or "Docker for Mac" development environments.
+>
A similar case is defined in regards Redis cache running as a container for the development environment.
+>
However, in a real production environment it is recommended to have persistance (SQL Server and Redis) in HA services like Azure SQL Database, Redis as a service or any other clustering system. If you want to change to a production configuration, you'll just need to change the connection strings once you have set up the servers in HA cloud or on-premises.
+
+## Related documentation and guidance
+While developing this reference application, we've been creating a reference Guide/eBook named "Architecting and Developing Containerized and Microservice based .NET Applications" which explains in detail how to develop this kind of architectural style (microservices, Docker containers, Domain-Driven Design for certain microservices) plus other simpler architectural styles, like monolithic that can also live as Docker containers.
+
+There's also an additional eBook focusing on Containers/Docker lifecycle (DevOps, CI/CD, etc.) with Microsoft Tools, already published.
+You can start reviewing these Guides/eBooks here:
+
+You can download both eBooks from here:
+
+| Architecting & Developing | Containers Lifecycle & CI/CD |
+| ------------ | ------------|
+|
|
|
+| Download (Confidential DRAFT until published) | Download |
+
+
+
However, we encourage to review the "Architecting/Developing" eBook because the architectural styles and architectural patterns and technologies explained in the guidance are using this reference application when explaining many sample implementations.
+
+
+## Overview of the application code
+In this repo you can find a sample reference application that will help you to understand how to implement a microservice architecture based application using .NET Core and Docker.
+
+The example business domain or scenario is based on an eShop or eCommerce which is implemented as a multi-container application. Each container is a microservice deployment (like the basket-microservice, catalog-microservice, ordering-microservice and the identity-microservice) which are developed using ASP.NET Core running on .NET Core so they can run either on Linux Containers and Windows Containers.
+The screenshot below shows the VS Solution structure for those microservices/containers and client apps.
+- Open eShopOnContainers.sln for a solution containing all the projects (All client apps and services).
+- Open eShopOnContainers-ServicesAndWebApps.sln for a solution containing just the server-side projects related to the microservices and web applications.
+- Open eShopOnContainers-MobileApps.sln for a solution containing just the client mobile app projects (Xamarin mobile apps only).
+
+
+
+
+Finally, those microservices are consumed by multiple client web and mobile apps, as described below.
+
+*MVC Application (ASP.NET Core)*: Its an MVC 6 application where you can find interesting scenarios on how to consume HTTP-based microservices from C# running in the server side, as it is a typical ASP.NET Core MVC application. Since it is a server-side application, access to other containers/microservices is done within the internal Docker Host network with its internal name resolution.
+
+
+*SPA (Single Page Application)*: Providing similar "eShop business functionality" but developed with Angular 2, Typescript and slightly using ASP.NET Core MVC 6. This is another approach for client web applications to be used when you want to have a more modern client behavior which is not behaving with the typical browser round-trip on every action but behaving like a Single-Page-Application which is more similar to a desktop app usage experience. The consumption of the HTTP-based microservices is done from TypeScript/JavaScript in the client browser, so the client calls to the microservices come from out of the Docker Host internal network (Like from your network or even from the Internet).
+
+
+*Xamarin Mobile App (For iOS, Android and Windows/UWP)*: It is a client mobile app supporting the most common mobilee OS platforms (iOS, Android and Windows/UWP). In this case, the consumption of the microservices is done from C# but running on the client devices, so out of the Docker Host internal network (Like from your network or even the Internet).
+
+
+
+> ### Note on tested Docker Containers/Images
+> The development and testing of this project was (as of January 2017) done only on Docker Linux containers running in development machines with "Docker for Windows" and the default Hyper-V Linux VM (MobiLinuxVM) installed by "Docker for Windows".
+The Windows Containers scenario has not been implemented/tested yet, but the application should be able to run on Windows Containers based on different Docker base images, as well, as the .NET Core services have also been tested running on plain Windows (with no Docker).
+The app was also partially tested on "Docker for Mac" using a development MacOS machine with .NET Core and VS Code installed. However, that is still a scenario using Linux containers running on the VM setup in the Mac by the "Docker for Windows" setup.
+
+## Setting up your development environment for eShopOnContainers
+### Visual Studio 2017 and Windows based
+This is the more straightforward way to get started:
+https://github.com/dotnet/eShopOnContainers/wiki/02.-Setting-eShopOnContainer-solution-up-in-a-Visual-Studio-2017-environment
+
+### CLI and Windows based
+For those who prefer the CLI on Windows, using dotnet CLI, docker CLI and VS Code for Windows:
+https://github.com/dotnet/eShopOnContainers/wiki/03.-Setting-the-eShopOnContainers-solution-up-in-a-Windows-CLI-environment-(dotnet-CLI,-Docker-CLI-and-VS-Code)
+
+### CLI and Mac based
+For those who prefer the CLI on a Mac, using dotnet CLI, docker CLI and VS Code for Mac:
+https://github.com/dotnet/eShopOnContainers/wiki/04.-Setting-eShopOnContainer-solution-up-in-a-Mac,-VS-Code-and-CLI-environment--(dotnet-CLI,-Docker-CLI-and-VS-Code)
+
+> ### Note on Windows Containers
+> As mentioned, the development and testing of this project (January 2017 version) was done on Docker Linux containers running in development machines with "Docker for Windows" and the default Hyper-V Linux VM (MobiLinuxVM) installed by "Docker for Windows".
+In order to run the application on Windows Containers you'd need to change the base images used by each container:
+> - Official .NET Core base-image for Windows Containers, at Docker Hub: https://hub.docker.com/r/microsoft/dotnet/ (Using the Windows Nanoserver tag)
+> - Official base-image for SQL Server on Windows Containers, at Docker Hub: https://hub.docker.com/r/microsoft/mssql-server-windows
diff --git a/_docker/linux/docker-compose.ci.build.yml b/_docker/linux/docker-compose.ci.build.yml
deleted file mode 100644
index 0a4b6e345..000000000
--- a/_docker/linux/docker-compose.ci.build.yml
+++ /dev/null
@@ -1,9 +0,0 @@
-version: '2'
-
-services:
- ci-build:
- image: microsoft/aspnetcore-build:1.0-1.1
- volumes:
- - .:/src
- working_dir: /src
- command: /bin/bash -c "dotnet restore ./eShopOnContainers-ServicesAndWebApps.sln && dotnet publish ./eShopOnContainers-ServicesAndWebApps.sln -c Release -o ./obj/Docker/publish"
diff --git a/_docker/linux/docker-compose.override.yml b/_docker/linux/docker-compose.override.yml
deleted file mode 100644
index 909cf4172..000000000
--- a/_docker/linux/docker-compose.override.yml
+++ /dev/null
@@ -1,69 +0,0 @@
-version: '2'
-
-services:
-
- basket.api:
- environment:
- - ASPNETCORE_ENVIRONMENT=Development
- - ConnectionString=basket.data
- #- identityUrl=http://13.88.8.119:5105 #Remote: VM Needs to have public access at 5105.
- - identityUrl=http://identity.api:5105 #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105.
- ports:
- - "5103:5103"
-
- catalog.api:
- environment:
- - ASPNETCORE_ENVIRONMENT=Development
- - ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word
- #- ExternalCatalogBaseUrl=http://13.88.8.119:5101 #Remote: VM Needs to have public access at 5105.
- - ExternalCatalogBaseUrl=http://localhost:5101 #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105.
- ports:
- - "5101:5101"
-
- identity.api:
- environment:
- - ASPNETCORE_ENVIRONMENT=Development
- - SpaClient=http://localhost:5104
- - ConnectionStrings__DefaultConnection=Server=sql.data;Database=Microsoft.eShopOnContainers.Service.IdentityDb;User Id=sa;Password=Pass@word
- #- MvcClient=http://13.88.8.119:5100 #Remote: VM Needs to have public access at 5105.
- - MvcClient=http://localhost:5100 #Local: You need to open your local dev-machine firewall at range 5100-5105.
- ports:
- - "5105:5105"
-
- ordering.api:
- environment:
- - ASPNETCORE_ENVIRONMENT=Development
- - ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word
- #- identityUrl=http://13.88.8.119:5105 #Remote: VM Needs to have public access at 5105.
- - identityUrl=http://identity.api:5105 #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105.
- ports:
- - "5102:5102"
-
- webspa:
- environment:
- - ASPNETCORE_ENVIRONMENT=Development
- - CatalogUrl=http://localhost:5101
- - OrderingUrl=http://localhost:5102
- #- IdentityUrl=http://13.88.8.119:5105 #Remote: VM Needs to have public access at 5105.
- - IdentityUrl=http://localhost:5105 #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105.
- - BasketUrl=http://localhost:5103
- ports:
- - "5104:5104"
-
- webmvc:
- environment:
- - ASPNETCORE_ENVIRONMENT=Development
- - CatalogUrl=http://catalog.api:5101
- - OrderingUrl=http://ordering.api:5102
- #- IdentityUrl=http://13.88.8.119:5105 #Remote: VM Needs to have public access at 5105.
- - IdentityUrl=http://10.0.75.1:5105 #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105.
- - BasketUrl=http://basket.api:5103
- ports:
- - "5100:5100"
-
- sql.data:
- environment:
- - SA_PASSWORD=Pass@word
- - ACCEPT_EULA=Y
- ports:
- - "5433:1433"
\ No newline at end of file
diff --git a/_docker/linux/docker-compose.vs.debug.yml b/_docker/linux/docker-compose.vs.debug.yml
deleted file mode 100644
index 2446fdb2c..000000000
--- a/_docker/linux/docker-compose.vs.debug.yml
+++ /dev/null
@@ -1,92 +0,0 @@
-version: '2'
-
-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"
-
- 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"
diff --git a/_docker/linux/docker-compose.vs.release.yml b/_docker/linux/docker-compose.vs.release.yml
deleted file mode 100644
index 4ea31f8ca..000000000
--- a/_docker/linux/docker-compose.vs.release.yml
+++ /dev/null
@@ -1,62 +0,0 @@
-version: '2'
-
-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"
-
- 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"
diff --git a/_docker/linux/docker-compose.yml b/_docker/linux/docker-compose.yml
deleted file mode 100644
index f3baeb346..000000000
--- a/_docker/linux/docker-compose.yml
+++ /dev/null
@@ -1,63 +0,0 @@
-version: '2'
-
-services:
- basket.api:
- image: eshop/basket.api
- build:
- context: ./src/Services/Basket/Basket.API
- dockerfile: Dockerfile
- depends_on:
- - basket.data
- - identity.api
-
- catalog.api:
- image: eshop/catalog.api
- build:
- context: ./src/Services/Catalog/Catalog.API
- dockerfile: Dockerfile
- depends_on:
- - sql.data
-
- identity.api:
- image: eshop/identity.api
- build:
- context: ./src/Services/Identity/Identity.API
- dockerfile: Dockerfile
- depends_on:
- - sql.data
-
- ordering.api:
- image: eshop/ordering.api
- build:
- context: ./src/Services/Ordering/Ordering.API
- dockerfile: Dockerfile
- depends_on:
- - sql.data
-
- webspa:
- image: eshop/webspa
- build:
- context: ./src/Web/WebSPA
- dockerfile: Dockerfile
- depends_on:
- - identity.api
- - basket.api
-
- webmvc:
- image: eshop/webmvc
- build:
- context: ./src/Web/WebMVC
- dockerfile: Dockerfile
- depends_on:
- - catalog.api
- - ordering.api
- - identity.api
- - basket.api
-
- sql.data:
- image: microsoft/mssql-server-linux
-
- basket.data:
- image: redis
- ports:
- - "6379:6379"
diff --git a/_docker/nanowin/docker-compose.ci.build.yml b/_docker/nanowin/docker-compose.ci.build.yml
deleted file mode 100644
index 0a4b6e345..000000000
--- a/_docker/nanowin/docker-compose.ci.build.yml
+++ /dev/null
@@ -1,9 +0,0 @@
-version: '2'
-
-services:
- ci-build:
- image: microsoft/aspnetcore-build:1.0-1.1
- volumes:
- - .:/src
- working_dir: /src
- command: /bin/bash -c "dotnet restore ./eShopOnContainers-ServicesAndWebApps.sln && dotnet publish ./eShopOnContainers-ServicesAndWebApps.sln -c Release -o ./obj/Docker/publish"
diff --git a/_docker/nanowin/docker-compose.vs.debug.yml b/_docker/nanowin/docker-compose.vs.debug.yml
deleted file mode 100644
index 0a53cef7d..000000000
--- a/_docker/nanowin/docker-compose.vs.debug.yml
+++ /dev/null
@@ -1,92 +0,0 @@
-version: '2.1'
-
-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=windows"
-
- 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=windows"
-
- 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=windows"
-
- 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=windows"
-
- 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=windows"
-
- 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=windows"
diff --git a/_docker/nanowin/docker-compose.vs.release.yml b/_docker/nanowin/docker-compose.vs.release.yml
deleted file mode 100644
index 2c7b764a8..000000000
--- a/_docker/nanowin/docker-compose.vs.release.yml
+++ /dev/null
@@ -1,62 +0,0 @@
-version: '2.1'
-
-services:
- basket.api:
- build:
- args:
- source: ${DOCKER_BUILD_SOURCE}
- volumes:
- - ~/clrdbg:/clrdbg:ro
- entrypoint: tail -f /dev/null
- labels:
- - "com.microsoft.visualstudio.targetoperatingsystem=windows"
-
- catalog.api:
- build:
- args:
- source: ${DOCKER_BUILD_SOURCE}
- volumes:
- - ~/clrdbg:/clrdbg:ro
- entrypoint: tail -f /dev/null
- labels:
- - "com.microsoft.visualstudio.targetoperatingsystem=windows"
-
- identity.api:
- build:
- args:
- source: ${DOCKER_BUILD_SOURCE}
- volumes:
- - ~/clrdbg:/clrdbg:ro
- entrypoint: tail -f /dev/null
- labels:
- - "com.microsoft.visualstudio.targetoperatingsystem=windows"
-
- ordering.api:
- build:
- args:
- source: ${DOCKER_BUILD_SOURCE}
- volumes:
- - ~/clrdbg:/clrdbg:ro
- entrypoint: tail -f /dev/null
- labels:
- - "com.microsoft.visualstudio.targetoperatingsystem=windows"
-
- webspa:
- build:
- args:
- source: ${DOCKER_BUILD_SOURCE}
- volumes:
- - ~/clrdbg:/clrdbg:ro
- entrypoint: tail -f /dev/null
- labels:
- - "com.microsoft.visualstudio.targetoperatingsystem=windows"
-
- webmvc:
- build:
- args:
- source: ${DOCKER_BUILD_SOURCE}
- volumes:
- - ~/clrdbg:/clrdbg:ro
- entrypoint: tail -f /dev/null
- labels:
- - "com.microsoft.visualstudio.targetoperatingsystem=windows"
diff --git a/_docker/redis/Dockerfile.nanowin b/_docker/redis/Dockerfile.nanowin
new file mode 100644
index 000000000..6a36d1947
--- /dev/null
+++ b/_docker/redis/Dockerfile.nanowin
@@ -0,0 +1,28 @@
+# The MSI installs a service which is hard to override, so let's use a zip file.
+
+FROM microsoft/windowsservercore
+MAINTAINER alexellis2@gmail.com
+
+SHELL ["powershell"]
+RUN $ErrorActionPreference = 'Stop'; \
+ wget https://github.com/MSOpenTech/redis/releases/download/win-3.2.100/Redis-x64-3.2.100.zip -OutFile Redis-x64-3.2.100.zip ; \
+ Expand-Archive Redis-x64-3.2.100.zip -dest 'C:\\Program Files\\Redis\\' ; \
+ Remove-Item Redis-x64-3.2.100.zip -Force
+
+RUN setx PATH '%PATH%;C:\\Program Files\\Redis\\'
+WORKDIR 'C:\\Program Files\\Redis\\'
+
+
+
+RUN Get-Content redis.windows.conf | Where { $_ -notmatch 'bind 127.0.0.1' } | Set-Content redis.openport.conf ; \
+ Get-Content redis.openport.conf | Where { $_ -notmatch 'protected-mode yes' } | Set-Content redis.unprotected.conf ; \
+ Add-Content redis.unprotected.conf 'protected-mode no' ; \
+ Add-Content redis.unprotected.conf 'bind 0.0.0.0' ; \
+ Get-Content redis.unprotected.conf
+
+EXPOSE 6379
+
+# Define our command to be run when launching the container
+CMD .\\redis-server.exe .\\redis.unprotected.conf --port 6379 ; \
+ Write-Host Redis Started... ; \
+ while ($true) { Start-Sleep -Seconds 3600 }
diff --git a/docker-compose-external.override.yml b/docker-compose-external.override.yml
new file mode 100644
index 000000000..f20440ad7
--- /dev/null
+++ b/docker-compose-external.override.yml
@@ -0,0 +1,9 @@
+version: '2'
+
+services:
+ sql.data:
+ environment:
+ - SA_PASSWORD=Pass@word
+ - ACCEPT_EULA=Y
+ ports:
+ - "5433:1433"
\ No newline at end of file
diff --git a/docker-compose-external.yml b/docker-compose-external.yml
new file mode 100644
index 000000000..6bce32a3e
--- /dev/null
+++ b/docker-compose-external.yml
@@ -0,0 +1,10 @@
+version: '2'
+
+services:
+ sql.data:
+ image: microsoft/mssql-server-linux
+
+ basket.data:
+ image: redis
+ ports:
+ - "6379:6379"
diff --git a/docker-compose-windows.dcproj b/docker-compose-windows.dcproj
new file mode 100644
index 000000000..89b2fef3e
--- /dev/null
+++ b/docker-compose-windows.dcproj
@@ -0,0 +1,18 @@
+
+
+
+ 2ede831a-98f5-4f23-b2db-7e9dc935766a
+ True
+ http://localhost:5100
+ webmvc
+
+
+
+ docker-compose.yml
+
+
+ docker-compose.yml
+
+
+
+
\ No newline at end of file
diff --git a/_docker/nanowin/docker-compose.override.yml b/docker-compose-windows.override.yml
similarity index 100%
rename from _docker/nanowin/docker-compose.override.yml
rename to docker-compose-windows.override.yml
diff --git a/_docker/nanowin/docker-compose.yml b/docker-compose-windows.yml
similarity index 79%
rename from _docker/nanowin/docker-compose.yml
rename to docker-compose-windows.yml
index 1d27d2d43..3c4675466 100644
--- a/_docker/nanowin/docker-compose.yml
+++ b/docker-compose-windows.yml
@@ -5,7 +5,7 @@ services:
image: eshop/basket.api
build:
context: ./src/Services/Basket/Basket.API
- dockerfile: Dockerfile
+ dockerfile: Dockerfile.nanowin
depends_on:
- basket.data
- identity.api
@@ -14,7 +14,7 @@ services:
image: eshop/catalog.api
build:
context: ./src/Services/Catalog/Catalog.API
- dockerfile: Dockerfile
+ dockerfile: Dockerfile.nanowin
depends_on:
- sql.data
@@ -22,7 +22,7 @@ services:
image: eshop/identity.api
build:
context: ./src/Services/Identity/Identity.API
- dockerfile: Dockerfile
+ dockerfile: Dockerfile.nanowin
depends_on:
- sql.data
@@ -30,7 +30,7 @@ services:
image: eshop/ordering.api
build:
context: ./src/Services/Ordering/Ordering.API
- dockerfile: Dockerfile
+ dockerfile: Dockerfile.nanowin
depends_on:
- sql.data
@@ -38,7 +38,7 @@ services:
image: eshop/webspa
build:
context: ./src/Web/WebSPA
- dockerfile: Dockerfile
+ dockerfile: Dockerfile.nanowin
depends_on:
- identity.api
- basket.api
@@ -47,7 +47,7 @@ services:
image: eshop/webmvc
build:
context: ./src/Web/WebMVC
- dockerfile: Dockerfile
+ dockerfile: Dockerfile.nanowin
depends_on:
- catalog.api
- ordering.api
@@ -60,8 +60,8 @@ services:
basket.data:
image: eshop/redis
build:
- context: ./extradf
- dockerfile: Dockerfile
+ context: ./_docker/redis
+ dockerfile: Dockerfile.nanowin
ports:
- "6379:6379"
networks:
diff --git a/docker-use-platform.ps1 b/docker-use-platform.ps1
deleted file mode 100644
index 7233c3c1d..000000000
--- a/docker-use-platform.ps1
+++ /dev/null
@@ -1,49 +0,0 @@
-Param(
- [ValidateSet(nanowin", "linux")] [String] [Parameter(Mandatory=$true)] $Platform,
- [bool] $DeleteImages = $false
-
-)
-
-$scriptPath = Split-Path $script:MyInvocation.MyCommand.Path
-$Platform = $Platform.ToLowerInvariant()
-
-$SourcePerPlatformDockerFilesPath = "$ScriptPath\_docker\$Platform\extradf"
-$TargetPerPlatformDockerFilesPath = "$ScriptPath\extradf"
-
-Write-Host "Current script directory is $scriptPath" -ForegroundColor Yellow
-
-
-If ($DeleteImages) {
- Write-Host "Deleting eShop Docker images"
- & "$ScriptPath\delete-images.ps1"
-}
-
-If (Test-Path $TargetPerPlatformDockerFilesPath) {
- Write-Host "Found per-platform extra Docker files. Removing..."
- Remove-Item "$TargetPerPlatformDockerFilesPath\" -Recurse -Force
-}
-
-If (Test-Path $SourcePerPlatformDockerFilesPath) {
- Write-Host "Copying per-platform extra Dockerfiles"
- Copy-Item "$SourcePerPlatformDockerFilesPath\*" "$ScriptPath\extradf\" -Recurse -Force
-}
-else {
- Write-Host "There are not extra Dockerfiles for platform $Platform"
-}
-
-Write-Host "Changing Dockerfiles"
-Copy-Item "$ScriptPath\src\Services\Basket\Basket.API\Dockerfile.$Platform" "$ScriptPath\src\Services\Basket\Basket.API\Dockerfile" -Force
-Copy-Item "$ScriptPath\src\Services\Catalog\Catalog.API\Dockerfile.$Platform" "$ScriptPath\src\Services\Catalog\Catalog.API\Dockerfile" -Force
-Copy-Item "$ScriptPath\src\Services\Identity\Identity.API\Dockerfile.$Platform" "$ScriptPath\src\Services\Identity\Identity.API\Dockerfile" -Force
-Copy-Item "$ScriptPath\src\Services\Ordering\Ordering.API\Dockerfile.$Platform" "$ScriptPath\src\Services\Ordering\Ordering.API\Dockerfile" -Force
-
-Copy-Item "$ScriptPath\src\Web\WebMVC\Dockerfile.$Platform" "$ScriptPath\src\Web\WebMVC\Dockerfile" -Force
-Copy-Item "$ScriptPath\src\Web\WebSPA\Dockerfile.$Platform" "$ScriptPath\src\Web\WebSPA\Dockerfile" -Force
-
-Write-Host "Replacing Docker-compose"
-Copy-Item "$ScriptPath\_docker\$Platform\*.yml" "$ScriptPath\" -Force
-
-Remove-Item "$ScriptPath\.eshopdocker_*" -Force -ErrorAction SilentlyContinue
-New-Item "$ScriptPath\.eshopdocker_$Platform" -ItemType File | Out-Null
-
-Write-Host "Done. Docker files are set for platform: $Platform"
\ No newline at end of file
diff --git a/src/Services/Basket/Basket.API/Dockerfile.linux b/src/Services/Basket/Basket.API/Dockerfile.linux
deleted file mode 100644
index bfc575ee1..000000000
--- a/src/Services/Basket/Basket.API/Dockerfile.linux
+++ /dev/null
@@ -1,6 +0,0 @@
-FROM microsoft/aspnetcore:1.1
-ARG source
-WORKDIR /app
-EXPOSE 80
-COPY ${source:-obj/Docker/publish} .
-ENTRYPOINT ["dotnet", "Basket.API.dll"]
diff --git a/src/Services/Catalog/Catalog.API/Catalog.API.csproj b/src/Services/Catalog/Catalog.API/Catalog.API.csproj
index 15be6a8c2..6811e43cb 100644
--- a/src/Services/Catalog/Catalog.API/Catalog.API.csproj
+++ b/src/Services/Catalog/Catalog.API/Catalog.API.csproj
@@ -49,7 +49,7 @@
-
+
diff --git a/src/Services/Catalog/Catalog.API/Dockerfile.linux b/src/Services/Catalog/Catalog.API/Dockerfile.linux
deleted file mode 100644
index 67f47d60d..000000000
--- a/src/Services/Catalog/Catalog.API/Dockerfile.linux
+++ /dev/null
@@ -1,6 +0,0 @@
-FROM microsoft/aspnetcore:1.1
-ARG source
-WORKDIR /app
-EXPOSE 80
-COPY ${source:-obj/Docker/publish} .
-ENTRYPOINT ["dotnet", "Catalog.API.dll"]
diff --git a/src/Services/Catalog/Catalog.API/Startup.cs b/src/Services/Catalog/Catalog.API/Startup.cs
index 38bea3ee3..2b44d0183 100644
--- a/src/Services/Catalog/Catalog.API/Startup.cs
+++ b/src/Services/Catalog/Catalog.API/Startup.cs
@@ -12,6 +12,7 @@
using Microsoft.Extensions.Logging;
using System;
using System.IO;
+ using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
@@ -28,7 +29,7 @@
if (env.IsDevelopment())
{
- builder.AddUserSecrets();
+ builder.AddUserSecrets(typeof(Startup).GetTypeInfo().Assembly);
}
builder.AddEnvironmentVariables();
diff --git a/src/Services/Identity/Identity.API/Data/Migrations/20161019122215_Init_Scheme.Designer.cs b/src/Services/Identity/Identity.API/Data/Migrations/20161019122215_Init_Scheme.Designer.cs
index af45c0320..07e821f4c 100644
--- a/src/Services/Identity/Identity.API/Data/Migrations/20161019122215_Init_Scheme.Designer.cs
+++ b/src/Services/Identity/Identity.API/Data/Migrations/20161019122215_Init_Scheme.Designer.cs
@@ -124,7 +124,7 @@ namespace WebMVC.Migrations
b.ToTable("AspNetUserTokens");
});
- modelBuilder.Entity("Microsoft.eShopOnContainers.WebMVC.Models.ApplicationUser", b =>
+ modelBuilder.Entity("Microsoft.eShopOnContainers.WebMVC.ViewModels.ApplicationUser", b =>
{
b.Property("Id");
@@ -211,7 +211,7 @@ namespace WebMVC.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserClaim", b =>
{
- b.HasOne("Microsoft.eShopOnContainers.WebMVC.Models.ApplicationUser")
+ b.HasOne("Microsoft.eShopOnContainers.WebMVC.ViewModels.ApplicationUser")
.WithMany("Claims")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
@@ -219,7 +219,7 @@ namespace WebMVC.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserLogin", b =>
{
- b.HasOne("Microsoft.eShopOnContainers.WebMVC.Models.ApplicationUser")
+ b.HasOne("Microsoft.eShopOnContainers.WebMVC.ViewModels.ApplicationUser")
.WithMany("Logins")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
@@ -232,7 +232,7 @@ namespace WebMVC.Migrations
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
- b.HasOne("Microsoft.eShopOnContainers.WebMVC.Models.ApplicationUser")
+ b.HasOne("Microsoft.eShopOnContainers.WebMVC.ViewModels.ApplicationUser")
.WithMany("Roles")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
diff --git a/src/Services/Identity/Identity.API/Data/Migrations/20161020101725_extendProfile.Designer.cs b/src/Services/Identity/Identity.API/Data/Migrations/20161020101725_extendProfile.Designer.cs
index ac483149b..2d118647d 100644
--- a/src/Services/Identity/Identity.API/Data/Migrations/20161020101725_extendProfile.Designer.cs
+++ b/src/Services/Identity/Identity.API/Data/Migrations/20161020101725_extendProfile.Designer.cs
@@ -124,7 +124,7 @@ namespace WebMVC.Migrations
b.ToTable("AspNetUserTokens");
});
- modelBuilder.Entity("Microsoft.eShopOnContainers.WebMVC.Models.ApplicationUser", b =>
+ modelBuilder.Entity("Microsoft.eShopOnContainers.WebMVC.ViewModels.ApplicationUser", b =>
{
b.Property("Id");
@@ -215,7 +215,7 @@ namespace WebMVC.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserClaim", b =>
{
- b.HasOne("Microsoft.eShopOnContainers.WebMVC.Models.ApplicationUser")
+ b.HasOne("Microsoft.eShopOnContainers.WebMVC.ViewModels.ApplicationUser")
.WithMany("Claims")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
@@ -223,7 +223,7 @@ namespace WebMVC.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserLogin", b =>
{
- b.HasOne("Microsoft.eShopOnContainers.WebMVC.Models.ApplicationUser")
+ b.HasOne("Microsoft.eShopOnContainers.WebMVC.ViewModels.ApplicationUser")
.WithMany("Logins")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
@@ -236,7 +236,7 @@ namespace WebMVC.Migrations
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
- b.HasOne("Microsoft.eShopOnContainers.WebMVC.Models.ApplicationUser")
+ b.HasOne("Microsoft.eShopOnContainers.WebMVC.ViewModels.ApplicationUser")
.WithMany("Roles")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
diff --git a/src/Services/Identity/Identity.API/Data/Migrations/ApplicationDbContextModelSnapshot.cs b/src/Services/Identity/Identity.API/Data/Migrations/ApplicationDbContextModelSnapshot.cs
index 01bc906b0..1f14e2321 100644
--- a/src/Services/Identity/Identity.API/Data/Migrations/ApplicationDbContextModelSnapshot.cs
+++ b/src/Services/Identity/Identity.API/Data/Migrations/ApplicationDbContextModelSnapshot.cs
@@ -122,7 +122,7 @@ namespace WebMVC.Migrations
b.ToTable("AspNetUserTokens");
});
- modelBuilder.Entity("Microsoft.eShopOnContainers.WebMVC.Models.ApplicationUser", b =>
+ modelBuilder.Entity("Microsoft.eShopOnContainers.WebMVC.ViewModels.ApplicationUser", b =>
{
b.Property("Id");
@@ -213,7 +213,7 @@ namespace WebMVC.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserClaim", b =>
{
- b.HasOne("Microsoft.eShopOnContainers.WebMVC.Models.ApplicationUser")
+ b.HasOne("Microsoft.eShopOnContainers.WebMVC.ViewModels.ApplicationUser")
.WithMany("Claims")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
@@ -221,7 +221,7 @@ namespace WebMVC.Migrations
modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityUserLogin", b =>
{
- b.HasOne("Microsoft.eShopOnContainers.WebMVC.Models.ApplicationUser")
+ b.HasOne("Microsoft.eShopOnContainers.WebMVC.ViewModels.ApplicationUser")
.WithMany("Logins")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
@@ -234,7 +234,7 @@ namespace WebMVC.Migrations
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
- b.HasOne("Microsoft.eShopOnContainers.WebMVC.Models.ApplicationUser")
+ b.HasOne("Microsoft.eShopOnContainers.WebMVC.ViewModels.ApplicationUser")
.WithMany("Roles")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
diff --git a/src/Services/Identity/Identity.API/Dockerfile.linux b/src/Services/Identity/Identity.API/Dockerfile.linux
deleted file mode 100644
index 5ef6b4064..000000000
--- a/src/Services/Identity/Identity.API/Dockerfile.linux
+++ /dev/null
@@ -1,6 +0,0 @@
-FROM microsoft/aspnetcore:1.1
-ARG source
-WORKDIR /app
-EXPOSE 80
-COPY ${source:-obj/Docker/publish} .
-ENTRYPOINT ["dotnet", "Identity.API.dll"]
diff --git a/src/Services/Ordering/Ordering.API/Application/Commands/CreateOrderCommand.cs b/src/Services/Ordering/Ordering.API/Application/Commands/CreateOrderCommand.cs
index a1066de9d..a43c28417 100644
--- a/src/Services/Ordering/Ordering.API/Application/Commands/CreateOrderCommand.cs
+++ b/src/Services/Ordering/Ordering.API/Application/Commands/CreateOrderCommand.cs
@@ -64,7 +64,7 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands
_orderItems = new List();
}
- public CreateOrderCommand(string city, string street, string state, string country, string zipcode,
+ public CreateOrderCommand(string city, string street, string state, string country, string zipcode,
string cardNumber, string cardHolderName, DateTime cardExpiration,
string cardSecurityNumber, int cardTypeId) : this()
{
diff --git a/src/Services/Ordering/Ordering.API/Application/Commands/CreateOrderCommandHandler.cs b/src/Services/Ordering/Ordering.API/Application/Commands/CreateOrderCommandHandler.cs
index a73378735..bf8e90ea6 100644
--- a/src/Services/Ordering/Ordering.API/Application/Commands/CreateOrderCommandHandler.cs
+++ b/src/Services/Ordering/Ordering.API/Application/Commands/CreateOrderCommandHandler.cs
@@ -4,9 +4,23 @@
using Domain.AggregatesModel.OrderAggregate;
using MediatR;
using Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.Services;
+ using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Repositories;
using System;
using System.Threading.Tasks;
+
+ public class CreateOrderCommandIdentifiedHandler : IdentifierCommandHandler
+ {
+ public CreateOrderCommandIdentifiedHandler(IMediator mediator, IRequestManager requestManager) : base(mediator, requestManager)
+ {
+ }
+
+ protected override bool CreateResultForDuplicateRequest()
+ {
+ return true; // Ignore duplicate requests for creating order.
+ }
+ }
+
public class CreateOrderCommandHandler
: IAsyncRequestHandler
{
diff --git a/src/Services/Ordering/Ordering.API/Application/Commands/IdentifiedCommand.cs b/src/Services/Ordering/Ordering.API/Application/Commands/IdentifiedCommand.cs
new file mode 100644
index 000000000..823e10b69
--- /dev/null
+++ b/src/Services/Ordering/Ordering.API/Application/Commands/IdentifiedCommand.cs
@@ -0,0 +1,20 @@
+using MediatR;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands
+{
+ public class IdentifiedCommand : IAsyncRequest
+ where T : IAsyncRequest
+ {
+ public T Command { get; }
+ public Guid Id { get; }
+ public IdentifiedCommand(T command, Guid id)
+ {
+ Command = command;
+ Id = id;
+ }
+ }
+}
diff --git a/src/Services/Ordering/Ordering.API/Application/Commands/IdentifierCommandHandler.cs b/src/Services/Ordering/Ordering.API/Application/Commands/IdentifierCommandHandler.cs
new file mode 100644
index 000000000..5fdc0181b
--- /dev/null
+++ b/src/Services/Ordering/Ordering.API/Application/Commands/IdentifierCommandHandler.cs
@@ -0,0 +1,60 @@
+using MediatR;
+using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Repositories;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands
+{
+ ///
+ /// Provides a base implementation for handling duplicate request and ensuring idempotent updates, in the cases where
+ /// a requestid sent by client is used to detect duplicate requests.
+ ///
+ /// Type of the command handler that performs the operation if request is not duplicated
+ /// Return value of the inner command handler
+ public class IdentifierCommandHandler : IAsyncRequestHandler, R>
+ where T : IAsyncRequest
+ {
+ private readonly IMediator _mediator;
+ private readonly IRequestManager _requestManager;
+
+ public IdentifierCommandHandler(IMediator mediator, IRequestManager requestManager)
+ {
+ _mediator = mediator;
+ _requestManager = requestManager;
+ }
+
+ ///
+ /// Creates the result value to return if a previous request was found
+ ///
+ ///
+ protected virtual R CreateResultForDuplicateRequest()
+ {
+ return default(R);
+ }
+
+ ///
+ /// This method handles the command. It just ensures that no other request exists with the same ID, and if this is the case
+ /// just enqueues the original inner command.
+ ///
+ /// IdentifiedCommand which contains both original command & request ID
+ /// Return value of inner command or default value if request same ID was found
+ public async Task Handle(IdentifiedCommand message)
+ {
+ var alreadyExists = await _requestManager.ExistAsync(message.Id);
+ if (alreadyExists)
+ {
+ return CreateResultForDuplicateRequest();
+ }
+ else
+ {
+ await _requestManager.CreateRequestForCommandAsync(message.Id);
+ var result = await _mediator.SendAsync(message.Command);
+ return result;
+ }
+ }
+ }
+
+
+}
diff --git a/src/Services/Ordering/Ordering.API/Controllers/OrdersController.cs b/src/Services/Ordering/Ordering.API/Controllers/OrdersController.cs
index 4944617bd..d01150b9c 100644
--- a/src/Services/Ordering/Ordering.API/Controllers/OrdersController.cs
+++ b/src/Services/Ordering/Ordering.API/Controllers/OrdersController.cs
@@ -28,9 +28,21 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Controllers
[Route("new")]
[HttpPost]
- public async Task CreateOrder([FromBody]CreateOrderCommand createOrderCommand)
+ public async Task CreateOrder([FromBody]CreateOrderCommand createOrderCommand, [FromHeader(Name = "x-requestid")] string requestId)
{
- var result = await _mediator.SendAsync(createOrderCommand);
+ bool result = false;
+ if (Guid.TryParse(requestId, out Guid guid) && guid != Guid.Empty)
+ {
+ var requestCreateOrder = new IdentifiedCommand(createOrderCommand, guid);
+ result = await _mediator.SendAsync(requestCreateOrder);
+ }
+ else
+ {
+ // If no x-requestid header is found we process the order anyway. This is just temporary to not break existing clients
+ // that aren't still updated. When all clients were updated this could be removed.
+ result = await _mediator.SendAsync(createOrderCommand);
+ }
+
if (result)
{
return Ok();
diff --git a/src/Services/Ordering/Ordering.API/Dockerfile.linux b/src/Services/Ordering/Ordering.API/Dockerfile.linux
deleted file mode 100644
index 719bff2f4..000000000
--- a/src/Services/Ordering/Ordering.API/Dockerfile.linux
+++ /dev/null
@@ -1,6 +0,0 @@
-FROM microsoft/aspnetcore:1.1
-ARG source
-WORKDIR /app
-EXPOSE 80
-COPY ${source:-obj/Docker/publish} .
-ENTRYPOINT ["dotnet", "Ordering.API.dll"]
diff --git a/src/Services/Ordering/Ordering.API/Infrastructure/AutofacModules/ApplicationModule.cs b/src/Services/Ordering/Ordering.API/Infrastructure/AutofacModules/ApplicationModule.cs
index a953c2d2d..0d8e34476 100644
--- a/src/Services/Ordering/Ordering.API/Infrastructure/AutofacModules/ApplicationModule.cs
+++ b/src/Services/Ordering/Ordering.API/Infrastructure/AutofacModules/ApplicationModule.cs
@@ -33,6 +33,10 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.Autof
builder.RegisterType()
.As>()
.InstancePerLifetimeScope();
+
+ builder.RegisterType()
+ .As()
+ .InstancePerLifetimeScope();
}
}
}
diff --git a/src/Services/Ordering/Ordering.API/Infrastructure/Migrations/20170303085729_RequestsTable.Designer.cs b/src/Services/Ordering/Ordering.API/Infrastructure/Migrations/20170303085729_RequestsTable.Designer.cs
new file mode 100644
index 000000000..84d560ddc
--- /dev/null
+++ b/src/Services/Ordering/Ordering.API/Infrastructure/Migrations/20170303085729_RequestsTable.Designer.cs
@@ -0,0 +1,245 @@
+using System;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure;
+
+namespace Ordering.API.Migrations
+{
+ [DbContext(typeof(OrderingContext))]
+ [Migration("20170303085729_RequestsTable")]
+ partial class RequestsTable
+ {
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+ modelBuilder
+ .HasAnnotation("ProductVersion", "1.1.0-rtm-22752")
+ .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("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.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")
+ .ValueGeneratedOnAdd()
+ .HasAnnotation("SqlServer:HiLoSequenceName", "orderseq")
+ .HasAnnotation("SqlServer:HiLoSequenceSchema", "ordering")
+ .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo);
+
+ b.Property("AddressId");
+
+ b.Property("BuyerId");
+
+ b.Property("OrderDate");
+
+ b.Property("OrderStatusId");
+
+ b.Property("PaymentMethodId");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AddressId");
+
+ 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("Ordering.Infrastructure.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.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.OrderAggregate.Address", "Address")
+ .WithMany()
+ .HasForeignKey("AddressId");
+
+ b.HasOne("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate.Buyer", "Buyer")
+ .WithMany()
+ .HasForeignKey("BuyerId")
+ .OnDelete(DeleteBehavior.Cascade);
+
+ 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", "PaymentMethod")
+ .WithMany()
+ .HasForeignKey("PaymentMethodId");
+ });
+
+ 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);
+ });
+ }
+ }
+}
diff --git a/src/Services/Ordering/Ordering.API/Infrastructure/Migrations/20170303085729_RequestsTable.cs b/src/Services/Ordering/Ordering.API/Infrastructure/Migrations/20170303085729_RequestsTable.cs
new file mode 100644
index 000000000..5e5918c88
--- /dev/null
+++ b/src/Services/Ordering/Ordering.API/Infrastructure/Migrations/20170303085729_RequestsTable.cs
@@ -0,0 +1,33 @@
+using System;
+using System.Collections.Generic;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+namespace Ordering.API.Migrations
+{
+ public partial class RequestsTable : Migration
+ {
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.CreateTable(
+ name: "requests",
+ schema: "ordering",
+ columns: table => new
+ {
+ Id = table.Column(nullable: false),
+ Name = table.Column(nullable: false),
+ Time = table.Column(nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_requests", x => x.Id);
+ });
+ }
+
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropTable(
+ name: "requests",
+ schema: "ordering");
+ }
+ }
+}
diff --git a/src/Services/Ordering/Ordering.API/Infrastructure/Migrations/OrderingContextModelSnapshot.cs b/src/Services/Ordering/Ordering.API/Infrastructure/Migrations/OrderingContextModelSnapshot.cs
index 5c7b6d25b..654f93d6d 100644
--- a/src/Services/Ordering/Ordering.API/Infrastructure/Migrations/OrderingContextModelSnapshot.cs
+++ b/src/Services/Ordering/Ordering.API/Infrastructure/Migrations/OrderingContextModelSnapshot.cs
@@ -183,6 +183,21 @@ namespace Ordering.API.Migrations
b.ToTable("orderstatus","ordering");
});
+ modelBuilder.Entity("Ordering.Infrastructure.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.BuyerAggregate.PaymentMethod", b =>
{
b.HasOne("Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate.Buyer")
diff --git a/src/Services/Ordering/Ordering.API/Ordering.API.csproj b/src/Services/Ordering/Ordering.API/Ordering.API.csproj
index d83aed609..ce710c6a0 100644
--- a/src/Services/Ordering/Ordering.API/Ordering.API.csproj
+++ b/src/Services/Ordering/Ordering.API/Ordering.API.csproj
@@ -51,10 +51,11 @@
+
-
+
diff --git a/src/Services/Ordering/Ordering.API/Startup.cs b/src/Services/Ordering/Ordering.API/Startup.cs
index 539647514..0f75b6370 100644
--- a/src/Services/Ordering/Ordering.API/Startup.cs
+++ b/src/Services/Ordering/Ordering.API/Startup.cs
@@ -29,7 +29,7 @@
if (env.IsDevelopment())
{
- builder.AddUserSecrets();
+ builder.AddUserSecrets(typeof(Startup).GetTypeInfo().Assembly);
}
builder.AddEnvironmentVariables();
@@ -67,7 +67,7 @@
Title = "Ordering HTTP API",
Version = "v1",
Description = "The Ordering Service HTTP API",
- TermsOfService = "Terms Of Service"
+ TermsOfService = "Terms Of Service"
});
});
@@ -82,7 +82,7 @@
// Add application services.
services.AddSingleton();
- services.AddTransient();
+ services.AddTransient();
services.AddOptions();
@@ -92,7 +92,7 @@
container.Populate(services);
container.RegisterModule(new MediatorModule());
- container.RegisterModule(new ApplicationModule(Configuration["ConnectionString"] ));
+ container.RegisterModule(new ApplicationModule(Configuration["ConnectionString"]));
return new AutofacServiceProvider(container.Build());
}
diff --git a/src/Services/Ordering/Ordering.Domain/AggregatesModel/OrderAggregate/Order.cs b/src/Services/Ordering/Ordering.Domain/AggregatesModel/OrderAggregate/Order.cs
index 658f18967..fecc53d44 100644
--- a/src/Services/Ordering/Ordering.Domain/AggregatesModel/OrderAggregate/Order.cs
+++ b/src/Services/Ordering/Ordering.Domain/AggregatesModel/OrderAggregate/Order.cs
@@ -22,6 +22,7 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.O
public OrderStatus OrderStatus { get; private set; }
private int _orderStatusId;
+
// DDD Patterns comment
// Using a private collection field, better for DDD Aggregate's encapsulation
// so OrderItems cannot be added from "outside the AggregateRoot" directly to the collection,
@@ -46,7 +47,6 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.O
_paymentMethodId = paymentMethodId;
_orderStatusId = OrderStatus.InProcess.Id;
_orderDate = DateTime.UtcNow;
-
Address = address;
}
diff --git a/src/Services/Ordering/Ordering.Infrastructure/ClientRequest.cs b/src/Services/Ordering/Ordering.Infrastructure/ClientRequest.cs
new file mode 100644
index 000000000..47a401aab
--- /dev/null
+++ b/src/Services/Ordering/Ordering.Infrastructure/ClientRequest.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure
+{
+ public class ClientRequest
+ {
+ public Guid Id { get; set; }
+ public string Name { get; set; }
+ public DateTime Time { get; set; }
+ }
+}
diff --git a/src/Services/Ordering/Ordering.Infrastructure/OrderingContext.cs b/src/Services/Ordering/Ordering.Infrastructure/OrderingContext.cs
index 73d831eaf..7a9d192e4 100644
--- a/src/Services/Ordering/Ordering.Infrastructure/OrderingContext.cs
+++ b/src/Services/Ordering/Ordering.Infrastructure/OrderingContext.cs
@@ -30,6 +30,8 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
+
+ modelBuilder.Entity(ConfigureRequests);
modelBuilder.Entity(ConfigureAddress);
modelBuilder.Entity(ConfigurePayment);
modelBuilder.Entity(ConfigureOrder);
@@ -39,6 +41,14 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure
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 ConfigureAddress(EntityTypeBuilder addressConfiguration)
{
addressConfiguration.ToTable("address", DEFAULT_SCHEMA);
diff --git a/src/Services/Ordering/Ordering.Infrastructure/Repositories/IRequestManager.cs b/src/Services/Ordering/Ordering.Infrastructure/Repositories/IRequestManager.cs
new file mode 100644
index 000000000..ecb144695
--- /dev/null
+++ b/src/Services/Ordering/Ordering.Infrastructure/Repositories/IRequestManager.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Repositories
+{
+ public interface IRequestManager
+ {
+ Task ExistAsync(Guid id);
+ Task CreateRequestForCommandAsync(Guid id);
+ }
+}
diff --git a/src/Services/Ordering/Ordering.Infrastructure/Repositories/RequestManager.cs b/src/Services/Ordering/Ordering.Infrastructure/Repositories/RequestManager.cs
new file mode 100644
index 000000000..1661ab6e5
--- /dev/null
+++ b/src/Services/Ordering/Ordering.Infrastructure/Repositories/RequestManager.cs
@@ -0,0 +1,42 @@
+using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure;
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Repositories
+{
+ public class RequestManager : IRequestManager
+ {
+ private readonly OrderingContext _context;
+ public RequestManager(OrderingContext ctx)
+ {
+ _context = ctx;
+ }
+
+
+ public async Task ExistAsync(Guid id)
+ {
+ var request = await _context.FindAsync(id);
+ return request != null;
+ }
+
+ public async Task CreateRequestForCommandAsync(Guid id)
+ {
+
+ var exists = await ExistAsync(id);
+ var request = exists ?
+ throw new Exception($"Request with {id} already exists") :
+ new ClientRequest()
+ {
+ Id = id,
+ Name = typeof(T).Name,
+ Time = DateTime.UtcNow
+ };
+
+ _context.Add(request);
+ await _context.SaveChangesAsync();
+ }
+
+ }
+}
diff --git a/src/Web/WebMVC/Controllers/AccountController.cs b/src/Web/WebMVC/Controllers/AccountController.cs
index 0f14cf45f..1ea310785 100644
--- a/src/Web/WebMVC/Controllers/AccountController.cs
+++ b/src/Web/WebMVC/Controllers/AccountController.cs
@@ -1,7 +1,7 @@
using System.Security.Claims;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
-using Microsoft.eShopOnContainers.WebMVC.Models;
+using Microsoft.eShopOnContainers.WebMVC.ViewModels;
using Microsoft.eShopOnContainers.WebMVC.Services;
using Microsoft.AspNetCore.Http.Authentication;
diff --git a/src/Web/WebMVC/Controllers/CartController.cs b/src/Web/WebMVC/Controllers/CartController.cs
index ea657ae7c..9e5aa0a91 100644
--- a/src/Web/WebMVC/Controllers/CartController.cs
+++ b/src/Web/WebMVC/Controllers/CartController.cs
@@ -4,7 +4,7 @@ using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.eShopOnContainers.WebMVC.Services;
-using Microsoft.eShopOnContainers.WebMVC.Models;
+using Microsoft.eShopOnContainers.WebMVC.ViewModels;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Authentication;
diff --git a/src/Web/WebMVC/Controllers/CatalogController.cs b/src/Web/WebMVC/Controllers/CatalogController.cs
index 8c916a0e4..4c649e507 100644
--- a/src/Web/WebMVC/Controllers/CatalogController.cs
+++ b/src/Web/WebMVC/Controllers/CatalogController.cs
@@ -3,9 +3,9 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
-using Microsoft.eShopOnContainers.WebMVC.Models.Pagination;
+using Microsoft.eShopOnContainers.WebMVC.ViewModels.Pagination;
using Microsoft.eShopOnContainers.WebMVC.Services;
-using Microsoft.eShopOnContainers.WebMVC.Models.CatalogViewModels;
+using Microsoft.eShopOnContainers.WebMVC.ViewModels.CatalogViewModels;
namespace Microsoft.eShopOnContainers.WebMVC.Controllers
@@ -33,7 +33,7 @@ namespace Microsoft.eShopOnContainers.WebMVC.Controllers
PaginationInfo = new PaginationInfo()
{
ActualPage = page ?? 0,
- ItemsPerPage = (catalog.Count < itemsPage) ? catalog.Count : itemsPage,
+ ItemsPerPage = catalog.Data.Count,
TotalItems = catalog.Count,
TotalPages = int.Parse(Math.Ceiling(((decimal)catalog.Count / itemsPage)).ToString())
}
diff --git a/src/Web/WebMVC/Controllers/OrderController.cs b/src/Web/WebMVC/Controllers/OrderController.cs
index 8f1d1d612..fc435ef6b 100644
--- a/src/Web/WebMVC/Controllers/OrderController.cs
+++ b/src/Web/WebMVC/Controllers/OrderController.cs
@@ -4,7 +4,7 @@ using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.eShopOnContainers.WebMVC.Services;
-using Microsoft.eShopOnContainers.WebMVC.Models;
+using Microsoft.eShopOnContainers.WebMVC.ViewModels;
using Microsoft.AspNetCore.Authorization;
using System.Net.Http;
diff --git a/src/Web/WebMVC/Services/BasketService.cs b/src/Web/WebMVC/Services/BasketService.cs
index 6ddbf0485..c5b1bf0bc 100644
--- a/src/Web/WebMVC/Services/BasketService.cs
+++ b/src/Web/WebMVC/Services/BasketService.cs
@@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
-using Microsoft.eShopOnContainers.WebMVC.Models;
+using Microsoft.eShopOnContainers.WebMVC.ViewModels;
using Microsoft.AspNetCore.Http;
using System.Net.Http;
using Microsoft.Extensions.Options;
diff --git a/src/Web/WebMVC/Services/CatalogService.cs b/src/Web/WebMVC/Services/CatalogService.cs
index 39576c43c..2c2035873 100644
--- a/src/Web/WebMVC/Services/CatalogService.cs
+++ b/src/Web/WebMVC/Services/CatalogService.cs
@@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
-using Microsoft.eShopOnContainers.WebMVC.Models;
+using Microsoft.eShopOnContainers.WebMVC.ViewModels;
using Microsoft.CodeAnalysis.Options;
using Microsoft.Extensions.Options;
using System.Net.Http;
diff --git a/src/Web/WebMVC/Services/IBasketService.cs b/src/Web/WebMVC/Services/IBasketService.cs
index f022c9f33..114246d5e 100644
--- a/src/Web/WebMVC/Services/IBasketService.cs
+++ b/src/Web/WebMVC/Services/IBasketService.cs
@@ -1,4 +1,4 @@
-using Microsoft.eShopOnContainers.WebMVC.Models;
+using Microsoft.eShopOnContainers.WebMVC.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
diff --git a/src/Web/WebMVC/Services/ICatalogService.cs b/src/Web/WebMVC/Services/ICatalogService.cs
index 1abac2390..b126168fd 100644
--- a/src/Web/WebMVC/Services/ICatalogService.cs
+++ b/src/Web/WebMVC/Services/ICatalogService.cs
@@ -1,5 +1,5 @@
using Microsoft.AspNetCore.Mvc.Rendering;
-using Microsoft.eShopOnContainers.WebMVC.Models;
+using Microsoft.eShopOnContainers.WebMVC.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
diff --git a/src/Web/WebMVC/Services/IOrderingService.cs b/src/Web/WebMVC/Services/IOrderingService.cs
index 527be4fe3..e1a7e6f83 100644
--- a/src/Web/WebMVC/Services/IOrderingService.cs
+++ b/src/Web/WebMVC/Services/IOrderingService.cs
@@ -1,4 +1,4 @@
-using Microsoft.eShopOnContainers.WebMVC.Models;
+using Microsoft.eShopOnContainers.WebMVC.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
diff --git a/src/Web/WebMVC/Services/IdentityParser.cs b/src/Web/WebMVC/Services/IdentityParser.cs
index d60e69115..619cfa517 100644
--- a/src/Web/WebMVC/Services/IdentityParser.cs
+++ b/src/Web/WebMVC/Services/IdentityParser.cs
@@ -1,4 +1,4 @@
-using Microsoft.eShopOnContainers.WebMVC.Models;
+using Microsoft.eShopOnContainers.WebMVC.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
diff --git a/src/Web/WebMVC/Services/OrderingService.cs b/src/Web/WebMVC/Services/OrderingService.cs
index 652ee18b0..184592839 100644
--- a/src/Web/WebMVC/Services/OrderingService.cs
+++ b/src/Web/WebMVC/Services/OrderingService.cs
@@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
-using Microsoft.eShopOnContainers.WebMVC.Models;
+using Microsoft.eShopOnContainers.WebMVC.ViewModels;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Options;
using System.Net.Http;
@@ -79,14 +79,14 @@ namespace Microsoft.eShopOnContainers.WebMVC.Services
_apiClient = new HttpClient();
_apiClient.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", token);
-
+ _apiClient.DefaultRequestHeaders.Add("x-requestid", order.RequestId.ToString());
var ordersUrl = $"{_remoteServiceBaseUrl}/new";
order.CardTypeId = 1;
order.CardExpirationApiFormat();
SetFakeIdToProducts(order);
StringContent content = new StringContent(JsonConvert.SerializeObject(order), System.Text.Encoding.UTF8, "application/json");
-
+
var response = await _apiClient.PostAsync(ordersUrl, content);
if (response.StatusCode == System.Net.HttpStatusCode.InternalServerError)
diff --git a/src/Web/WebMVC/Startup.cs b/src/Web/WebMVC/Startup.cs
index c6020eeeb..8bd7708d3 100644
--- a/src/Web/WebMVC/Startup.cs
+++ b/src/Web/WebMVC/Startup.cs
@@ -7,7 +7,7 @@ using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
-using Microsoft.eShopOnContainers.WebMVC.Models;
+using Microsoft.eShopOnContainers.WebMVC.ViewModels;
using Microsoft.eShopOnContainers.WebMVC.Services;
using System.IdentityModel.Tokens.Jwt;
using Microsoft.IdentityModel.Tokens;
diff --git a/src/Web/WebMVC/ViewComponents/Cart.cs b/src/Web/WebMVC/ViewComponents/Cart.cs
index 70e96e208..952c5ed3f 100644
--- a/src/Web/WebMVC/ViewComponents/Cart.cs
+++ b/src/Web/WebMVC/ViewComponents/Cart.cs
@@ -1,6 +1,6 @@
using Microsoft.AspNetCore.Mvc;
-using Microsoft.eShopOnContainers.WebMVC.Models;
-using Microsoft.eShopOnContainers.WebMVC.Models.CartViewModels;
+using Microsoft.eShopOnContainers.WebMVC.ViewModels;
+using Microsoft.eShopOnContainers.WebMVC.ViewModels.CartViewModels;
using Microsoft.eShopOnContainers.WebMVC.Services;
using System;
using System.Collections.Generic;
diff --git a/src/Web/WebMVC/ViewComponents/CartList.cs b/src/Web/WebMVC/ViewComponents/CartList.cs
index 6cb29bd6b..fbb9894fe 100644
--- a/src/Web/WebMVC/ViewComponents/CartList.cs
+++ b/src/Web/WebMVC/ViewComponents/CartList.cs
@@ -1,5 +1,5 @@
using Microsoft.AspNetCore.Mvc;
-using Microsoft.eShopOnContainers.WebMVC.Models;
+using Microsoft.eShopOnContainers.WebMVC.ViewModels;
using Microsoft.eShopOnContainers.WebMVC.Services;
using System;
using System.Collections.Generic;
diff --git a/src/Web/WebMVC/Models/Annotations/CardExpiration.cs b/src/Web/WebMVC/ViewModels/Annotations/CardExpiration.cs
similarity index 91%
rename from src/Web/WebMVC/Models/Annotations/CardExpiration.cs
rename to src/Web/WebMVC/ViewModels/Annotations/CardExpiration.cs
index 96644d790..5955ab30f 100644
--- a/src/Web/WebMVC/Models/Annotations/CardExpiration.cs
+++ b/src/Web/WebMVC/ViewModels/Annotations/CardExpiration.cs
@@ -4,7 +4,7 @@ using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
-namespace Microsoft.eShopOnContainers.WebMVC.Models.Annotations
+namespace Microsoft.eShopOnContainers.WebMVC.ViewModels.Annotations
{
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = true)]
public class CardExpirationAttribute : ValidationAttribute
diff --git a/src/Web/WebMVC/Models/ApplicationUser.cs b/src/Web/WebMVC/ViewModels/ApplicationUser.cs
similarity index 95%
rename from src/Web/WebMVC/Models/ApplicationUser.cs
rename to src/Web/WebMVC/ViewModels/ApplicationUser.cs
index 722b1f072..0602a9c95 100644
--- a/src/Web/WebMVC/Models/ApplicationUser.cs
+++ b/src/Web/WebMVC/ViewModels/ApplicationUser.cs
@@ -5,7 +5,7 @@ using System.Threading.Tasks;
using System.ComponentModel.DataAnnotations;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
-namespace Microsoft.eShopOnContainers.WebMVC.Models
+namespace Microsoft.eShopOnContainers.WebMVC.ViewModels
{
// Add profile data for application users by adding properties to the ApplicationUser class
public class ApplicationUser : IdentityUser
diff --git a/src/Web/WebMVC/Models/Basket.cs b/src/Web/WebMVC/ViewModels/Basket.cs
similarity index 88%
rename from src/Web/WebMVC/Models/Basket.cs
rename to src/Web/WebMVC/ViewModels/Basket.cs
index 62ac09d17..aef34e4fd 100644
--- a/src/Web/WebMVC/Models/Basket.cs
+++ b/src/Web/WebMVC/ViewModels/Basket.cs
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
-namespace Microsoft.eShopOnContainers.WebMVC.Models
+namespace Microsoft.eShopOnContainers.WebMVC.ViewModels
{
public class Basket
{
diff --git a/src/Web/WebMVC/Models/BasketItem.cs b/src/Web/WebMVC/ViewModels/BasketItem.cs
similarity index 88%
rename from src/Web/WebMVC/Models/BasketItem.cs
rename to src/Web/WebMVC/ViewModels/BasketItem.cs
index 15ac19edf..9e38c5f8d 100644
--- a/src/Web/WebMVC/Models/BasketItem.cs
+++ b/src/Web/WebMVC/ViewModels/BasketItem.cs
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
-namespace Microsoft.eShopOnContainers.WebMVC.Models
+namespace Microsoft.eShopOnContainers.WebMVC.ViewModels
{
public class BasketItem
{
diff --git a/src/Web/WebMVC/Models/CartViewModels/IndexViewModel.cs b/src/Web/WebMVC/ViewModels/CartViewModels/IndexViewModel.cs
similarity index 82%
rename from src/Web/WebMVC/Models/CartViewModels/IndexViewModel.cs
rename to src/Web/WebMVC/ViewModels/CartViewModels/IndexViewModel.cs
index f7acb6612..e46fdd4a3 100644
--- a/src/Web/WebMVC/Models/CartViewModels/IndexViewModel.cs
+++ b/src/Web/WebMVC/ViewModels/CartViewModels/IndexViewModel.cs
@@ -4,7 +4,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
-namespace Microsoft.eShopOnContainers.WebMVC.Models.CartViewModels
+namespace Microsoft.eShopOnContainers.WebMVC.ViewModels.CartViewModels
{
public class CartComponentViewModel
{
diff --git a/src/Web/WebMVC/Models/Catalog.cs b/src/Web/WebMVC/ViewModels/Catalog.cs
similarity index 85%
rename from src/Web/WebMVC/Models/Catalog.cs
rename to src/Web/WebMVC/ViewModels/Catalog.cs
index 8e0bc8d64..d36968565 100644
--- a/src/Web/WebMVC/Models/Catalog.cs
+++ b/src/Web/WebMVC/ViewModels/Catalog.cs
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
-namespace Microsoft.eShopOnContainers.WebMVC.Models
+namespace Microsoft.eShopOnContainers.WebMVC.ViewModels
{
public class Catalog
{
diff --git a/src/Web/WebMVC/Models/CatalogItem.cs b/src/Web/WebMVC/ViewModels/CatalogItem.cs
similarity index 89%
rename from src/Web/WebMVC/Models/CatalogItem.cs
rename to src/Web/WebMVC/ViewModels/CatalogItem.cs
index 0908b5651..6dd216d1d 100644
--- a/src/Web/WebMVC/Models/CatalogItem.cs
+++ b/src/Web/WebMVC/ViewModels/CatalogItem.cs
@@ -1,6 +1,6 @@
using System;
-namespace Microsoft.eShopOnContainers.WebMVC.Models
+namespace Microsoft.eShopOnContainers.WebMVC.ViewModels
{
public class CatalogItem
{
diff --git a/src/Web/WebMVC/Models/CatalogViewModels/IndexViewModel.cs b/src/Web/WebMVC/ViewModels/CatalogViewModels/IndexViewModel.cs
similarity index 79%
rename from src/Web/WebMVC/Models/CatalogViewModels/IndexViewModel.cs
rename to src/Web/WebMVC/ViewModels/CatalogViewModels/IndexViewModel.cs
index 395c66cdd..ab14b4ee4 100644
--- a/src/Web/WebMVC/Models/CatalogViewModels/IndexViewModel.cs
+++ b/src/Web/WebMVC/ViewModels/CatalogViewModels/IndexViewModel.cs
@@ -1,11 +1,11 @@
using Microsoft.AspNetCore.Mvc.Rendering;
-using Microsoft.eShopOnContainers.WebMVC.Models.Pagination;
+using Microsoft.eShopOnContainers.WebMVC.ViewModels.Pagination;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
-namespace Microsoft.eShopOnContainers.WebMVC.Models.CatalogViewModels
+namespace Microsoft.eShopOnContainers.WebMVC.ViewModels.CatalogViewModels
{
public class IndexViewModel
{
diff --git a/src/Web/WebMVC/Models/Header.cs b/src/Web/WebMVC/ViewModels/Header.cs
similarity index 71%
rename from src/Web/WebMVC/Models/Header.cs
rename to src/Web/WebMVC/ViewModels/Header.cs
index bc0a5842b..212638fbc 100644
--- a/src/Web/WebMVC/Models/Header.cs
+++ b/src/Web/WebMVC/ViewModels/Header.cs
@@ -1,6 +1,6 @@
using System;
-namespace Microsoft.eShopOnContainers.WebMVC.Models
+namespace Microsoft.eShopOnContainers.WebMVC.ViewModels
{
public class Header
{
diff --git a/src/Web/WebMVC/Models/Order.cs b/src/Web/WebMVC/ViewModels/Order.cs
similarity index 91%
rename from src/Web/WebMVC/Models/Order.cs
rename to src/Web/WebMVC/ViewModels/Order.cs
index cfcae8a36..8f3acc562 100644
--- a/src/Web/WebMVC/Models/Order.cs
+++ b/src/Web/WebMVC/ViewModels/Order.cs
@@ -1,4 +1,4 @@
-using Microsoft.eShopOnContainers.WebMVC.Models.Annotations;
+using Microsoft.eShopOnContainers.WebMVC.ViewModels.Annotations;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
@@ -7,7 +7,7 @@ using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
-namespace Microsoft.eShopOnContainers.WebMVC.Models
+namespace Microsoft.eShopOnContainers.WebMVC.ViewModels
{
public class Order
{
@@ -55,6 +55,10 @@ namespace Microsoft.eShopOnContainers.WebMVC.Models
public List OrderItems { get; }
+ [Required]
+ public Guid RequestId { get; set; }
+
+
public void CardExpirationShortFormat()
{
CardExpirationShort = CardExpiration.ToString("MM/yy");
diff --git a/src/Web/WebMVC/Models/OrderItem.cs b/src/Web/WebMVC/ViewModels/OrderItem.cs
similarity index 88%
rename from src/Web/WebMVC/Models/OrderItem.cs
rename to src/Web/WebMVC/ViewModels/OrderItem.cs
index 5fc6273ae..3ba03b96a 100644
--- a/src/Web/WebMVC/Models/OrderItem.cs
+++ b/src/Web/WebMVC/ViewModels/OrderItem.cs
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
-namespace Microsoft.eShopOnContainers.WebMVC.Models
+namespace Microsoft.eShopOnContainers.WebMVC.ViewModels
{
public class OrderItem
{
diff --git a/src/Web/WebMVC/ViewModels/Pagination/PaginationInfo.cs b/src/Web/WebMVC/ViewModels/Pagination/PaginationInfo.cs
new file mode 100644
index 000000000..0baf8e961
--- /dev/null
+++ b/src/Web/WebMVC/ViewModels/Pagination/PaginationInfo.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace Microsoft.eShopOnContainers.WebMVC.ViewModels.Pagination
+{
+ public class PaginationInfo
+ {
+ public int TotalItems { get; set; }
+ public int ItemsPerPage { get; set; }
+ public int ActualPage { get; set; }
+ public int TotalPages { get; set; }
+ public string Previous { get; set; }
+ public string Next { get; set; }
+ }
+}
diff --git a/src/Web/WebMVC/Views/Cart/Index.cshtml b/src/Web/WebMVC/Views/Cart/Index.cshtml
index a60fa09ec..1111df0cf 100644
--- a/src/Web/WebMVC/Views/Cart/Index.cshtml
+++ b/src/Web/WebMVC/Views/Cart/Index.cshtml
@@ -1,7 +1,7 @@
@using Microsoft.eShopOnContainers.WebMVC.Services
-@using Microsoft.eShopOnContainers.WebMVC.Models
+@using Microsoft.eShopOnContainers.WebMVC.ViewModels
-@model Microsoft.eShopOnContainers.WebMVC.Models.Basket
+@model Microsoft.eShopOnContainers.WebMVC.ViewModels.Basket
@inject IIdentityParser UserManager
@{
diff --git a/src/Web/WebMVC/Views/Catalog/Index.cshtml b/src/Web/WebMVC/Views/Catalog/Index.cshtml
index 439293111..bd88264b3 100644
--- a/src/Web/WebMVC/Views/Catalog/Index.cshtml
+++ b/src/Web/WebMVC/Views/Catalog/Index.cshtml
@@ -1,6 +1,6 @@
@{
ViewData["Title"] = "Catalog";
- @model Microsoft.eShopOnContainers.WebMVC.Models.CatalogViewModels.IndexViewModel
+ @model Microsoft.eShopOnContainers.WebMVC.ViewModels.CatalogViewModels.IndexViewModel
}
diff --git a/src/Web/WebMVC/Views/Catalog/_pagination.cshtml b/src/Web/WebMVC/Views/Catalog/_pagination.cshtml
index c2479617b..5cb98c1e9 100644
--- a/src/Web/WebMVC/Views/Catalog/_pagination.cshtml
+++ b/src/Web/WebMVC/Views/Catalog/_pagination.cshtml
@@ -1,24 +1,28 @@
-@model Microsoft.eShopOnContainers.WebMVC.Models.Pagination.PaginationInfo
+@model Microsoft.eShopOnContainers.WebMVC.ViewModels.Pagination.PaginationInfo
diff --git a/src/Web/WebMVC/Views/Order/Detail.cshtml b/src/Web/WebMVC/Views/Order/Detail.cshtml
index 0be4cd99d..c3a371275 100644
--- a/src/Web/WebMVC/Views/Order/Detail.cshtml
+++ b/src/Web/WebMVC/Views/Order/Detail.cshtml
@@ -1,6 +1,6 @@
-@using Microsoft.eShopOnContainers.WebMVC.Models
+@using Microsoft.eShopOnContainers.WebMVC.ViewModels
-@model Microsoft.eShopOnContainers.WebMVC.Models.Order
+@model Microsoft.eShopOnContainers.WebMVC.ViewModels.Order
@{
ViewData["Title"] = "Order Detail";
diff --git a/src/Web/WebMVC/Views/Order/Index.cshtml b/src/Web/WebMVC/Views/Order/Index.cshtml
index 9ca57df7c..83cc8b992 100644
--- a/src/Web/WebMVC/Views/Order/Index.cshtml
+++ b/src/Web/WebMVC/Views/Order/Index.cshtml
@@ -1,6 +1,6 @@
-@using Microsoft.eShopOnContainers.WebMVC.Models
+@using Microsoft.eShopOnContainers.WebMVC.ViewModels
-@model IEnumerable
+@model IEnumerable
@{
ViewData["Title"] = "My Orders";
diff --git a/src/Web/WebMVC/Views/Order/_OrderItems.cshtml b/src/Web/WebMVC/Views/Order/_OrderItems.cshtml
index 9639d6bc2..8b9cdd534 100644
--- a/src/Web/WebMVC/Views/Order/_OrderItems.cshtml
+++ b/src/Web/WebMVC/Views/Order/_OrderItems.cshtml
@@ -1,4 +1,4 @@
-@model Microsoft.eShopOnContainers.WebMVC.Models.Order
+@model Microsoft.eShopOnContainers.WebMVC.ViewModels.Order
diff --git a/src/Web/WebMVC/Views/Shared/Components/Cart/Default.cshtml b/src/Web/WebMVC/Views/Shared/Components/Cart/Default.cshtml
index e8699f930..faa4280a5 100644
--- a/src/Web/WebMVC/Views/Shared/Components/Cart/Default.cshtml
+++ b/src/Web/WebMVC/Views/Shared/Components/Cart/Default.cshtml
@@ -1,4 +1,4 @@
-@model Microsoft.eShopOnContainers.WebMVC.Models.CartViewModels.CartComponentViewModel
+@model Microsoft.eShopOnContainers.WebMVC.ViewModels.CartViewModels.CartComponentViewModel
@{
ViewData["Title"] = "My Cart";
diff --git a/src/Web/WebMVC/Views/Shared/Components/CartList/Default.cshtml b/src/Web/WebMVC/Views/Shared/Components/CartList/Default.cshtml
index d28705ec3..d3c2abaed 100644
--- a/src/Web/WebMVC/Views/Shared/Components/CartList/Default.cshtml
+++ b/src/Web/WebMVC/Views/Shared/Components/CartList/Default.cshtml
@@ -1,4 +1,4 @@
-@model Microsoft.eShopOnContainers.WebMVC.Models.Basket
+@model Microsoft.eShopOnContainers.WebMVC.ViewModels.Basket
@{
ViewData["Title"] = "My Cart";
diff --git a/src/Web/WebMVC/Views/Shared/_Header.cshtml b/src/Web/WebMVC/Views/Shared/_Header.cshtml
index d76250b49..894a92af2 100644
--- a/src/Web/WebMVC/Views/Shared/_Header.cshtml
+++ b/src/Web/WebMVC/Views/Shared/_Header.cshtml
@@ -1,4 +1,4 @@
-@model Microsoft.eShopOnContainers.WebMVC.Models.Header
+@model Microsoft.eShopOnContainers.WebMVC.ViewModels.Header