Browse Source

Merge branch 'master' into xamarin

pull/125/head
David Britch 8 years ago
parent
commit
721e35f724
61 changed files with 349 additions and 360 deletions
  1. +8
    -0
      .env
  2. +12
    -5
      README.md
  3. +0
    -0
      cli-linux/docker-compose.local.build.yml
  4. +3
    -0
      docker-compose.dcproj
  5. +15
    -8
      docker-compose.override.yml
  6. +80
    -0
      docker-compose.prod.yml
  7. BIN
      img/exploring-to-production-ready.png
  8. +0
    -71
      src/Console/eShopConsole/Program.cs
  9. +0
    -19
      src/Console/eShopConsole/Properties/AssemblyInfo.cs
  10. +0
    -8
      src/Console/eShopConsole/Properties/launchSettings.json
  11. +0
    -18
      src/Console/eShopConsole/eShopConsole.xproj
  12. +0
    -29
      src/Console/eShopConsole/project.json
  13. +39
    -0
      src/Mobile/AndroidSDKManager.ps1
  14. +6
    -5
      src/Mobile/README.md
  15. +3
    -4
      src/Mobile/eShopOnContainers/eShopOnContainers.Core/App.xaml.cs
  16. +3
    -3
      src/Mobile/eShopOnContainers/eShopOnContainers.Core/Helpers/ServicesHelper.cs
  17. +2
    -2
      src/Mobile/eShopOnContainers/eShopOnContainers.Core/Helpers/Settings.cs
  18. +1
    -1
      src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Navigation/INavigationService.cs
  19. +38
    -12
      src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Navigation/NavigationService.cs
  20. +3
    -1
      src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/RequestProvider/RequestProvider.cs
  21. +1
    -1
      src/Mobile/eShopOnContainers/eShopOnContainers.Core/Validations/ValidatableObject.cs
  22. +1
    -1
      src/Mobile/eShopOnContainers/eShopOnContainers.Core/ViewModels/Base/ExtendedBindableObject.cs
  23. +6
    -5
      src/Mobile/eShopOnContainers/eShopOnContainers.Core/ViewModels/Base/ViewModelBase.cs
  24. +57
    -59
      src/Mobile/eShopOnContainers/eShopOnContainers.Core/ViewModels/Base/ViewModelLocator.cs
  25. +2
    -0
      src/Mobile/eShopOnContainers/eShopOnContainers.Core/ViewModels/BasketViewModel.cs
  26. +4
    -1
      src/Mobile/eShopOnContainers/eShopOnContainers.Core/ViewModels/CatalogViewModel.cs
  27. +2
    -2
      src/Mobile/eShopOnContainers/eShopOnContainers.Core/ViewModels/CheckoutViewModel.cs
  28. +3
    -2
      src/Mobile/eShopOnContainers/eShopOnContainers.Core/ViewModels/LoginViewModel.cs
  29. +1
    -1
      src/Mobile/eShopOnContainers/eShopOnContainers.Core/ViewModels/MainViewModel.cs
  30. +1
    -1
      src/Mobile/eShopOnContainers/eShopOnContainers.Core/ViewModels/OrderDetailViewModel.cs
  31. +1
    -1
      src/Mobile/eShopOnContainers/eShopOnContainers.Core/ViewModels/ProfileViewModel.cs
  32. +2
    -2
      src/Mobile/eShopOnContainers/eShopOnContainers.Core/ViewModels/SettingsViewModel.cs
  33. +2
    -4
      src/Mobile/eShopOnContainers/eShopOnContainers.Core/Views/BasketView.xaml
  34. +3
    -5
      src/Mobile/eShopOnContainers/eShopOnContainers.Core/Views/CatalogView.xaml
  35. +2
    -4
      src/Mobile/eShopOnContainers/eShopOnContainers.Core/Views/CheckoutView.xaml
  36. +1
    -3
      src/Mobile/eShopOnContainers/eShopOnContainers.Core/Views/LoginView.xaml
  37. +2
    -4
      src/Mobile/eShopOnContainers/eShopOnContainers.Core/Views/MainView.xaml
  38. +12
    -3
      src/Mobile/eShopOnContainers/eShopOnContainers.Core/Views/MainView.xaml.cs
  39. +2
    -4
      src/Mobile/eShopOnContainers/eShopOnContainers.Core/Views/OrderDetailView.xaml
  40. +3
    -5
      src/Mobile/eShopOnContainers/eShopOnContainers.Core/Views/ProfileView.xaml
  41. +3
    -5
      src/Mobile/eShopOnContainers/eShopOnContainers.Core/Views/SettingsView.xaml
  42. +1
    -1
      src/Mobile/eShopOnContainers/eShopOnContainers.Droid/eShopOnContainers.Droid.csproj
  43. +1
    -1
      src/Mobile/eShopOnContainers/eShopOnContainers.TestRunner.Droid/eShopOnContainers.TestRunner.Droid.csproj
  44. +1
    -1
      src/Mobile/eShopOnContainers/eShopOnContainers.TestRunner.iOS/eShopOnContainers.TestRunner.iOS.csproj
  45. +1
    -1
      src/Mobile/eShopOnContainers/eShopOnContainers.iOS/eShopOnContainers.iOS.csproj
  46. +0
    -4
      src/Services/Basket/Basket.API/Properties/launchSettings.json
  47. +0
    -4
      src/Services/Catalog/Catalog.API/Properties/launchSettings.json
  48. +2
    -2
      src/Services/Identity/Identity.API/Configuration/Config.cs
  49. +1
    -19
      src/Services/Identity/Identity.API/Identity.API.csproj
  50. +3
    -3
      src/Services/Ordering/Ordering.API/Application/Commands/CreateOrderCommandHandler.cs
  51. +2
    -2
      src/Services/Ordering/Ordering.API/Infrastructure/AutofacModules/ApplicationModule.cs
  52. +0
    -6
      src/Services/Ordering/Ordering.API/Properties/launchSettings.json
  53. +1
    -1
      src/Services/Ordering/Ordering.Domain/AggregatesModel/BuyerAggregate/IBuyerRepository.cs
  54. +1
    -1
      src/Services/Ordering/Ordering.Domain/AggregatesModel/OrderAggregate/IOrderRepository.cs
  55. +1
    -1
      src/Services/Ordering/Ordering.Infrastructure/Repositories/BuyerRepository.cs
  56. +1
    -1
      src/Services/Ordering/Ordering.Infrastructure/Repositories/OrderRepository.cs
  57. +0
    -4
      src/Web/WebMVC/Properties/launchSettings.json
  58. +1
    -1
      src/Web/WebMVC/Services/Utilities/RetryWithExponentialBackoff.cs
  59. +1
    -1
      src/Web/WebSPA/Client/modules/shared/services/configuration.service.ts
  60. +3
    -3
      src/Web/WebSPA/Client/modules/shared/services/security.service.ts
  61. +4
    -4
      test/Services/UnitTest/Ordering/Application/NewOrderCommandHandlerTest.cs

+ 8
- 0
.env View File

@ -0,0 +1,8 @@
# Compose supports declaring default environment variables in an environment file named .env placed in the folder docker-compose command is executed from (current working directory).
# Compose expects each line in an env file to be in VAR=VAL format. Lines beginning with # (i.e. comments) are ignored, as are blank lines.
# Note: Values present in the environment at runtime will always override those defined inside the .env file. Similarly, values passed via command-line arguments take precedence as well.
# The IP below should be swapped to your real IP or DNS name, like 192.168.88.248, etc. if testing from remote browsers or mobile devices
ESHOP_EXTERNAL_DNS_NAME_OR_IP=localhost
ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP=10.121.122.92

+ 12
- 5
README.md View File

@ -5,7 +5,10 @@ Sample .NET Core reference application, powered by Microsoft, based on a simplif
> **IMPORTANT:** The current state of this sample application is **ALPHA**, consider it version a 0.1 foundational version, therefore, many areas could be improved and change significantly while refactoring current code and implementing new features. **Feedback with improvements and pull requests from the community will be highly appreciated and accepted.**
>
> This reference application proposes a simplified microservice oriented architecture implementation to introduce technologies like .NET Core with Docker containers through a comprehensive 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.
> <p>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. <p>
> <p>For example, the next step (still not covered in eShopOnContainers) after understanding Docker containers and microservices development with .NET Core, 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).
> Or moving your databases to HA cloud services, or implementing your EventBus with Azure Service Bus or any other production ready Service Bus in the market.
> <p> In the future we might fork this project and make multiple versions targeting specific microservice cluster/orchestrators plus using additional cloud infrastructure. <p>
> <img src="img/exploring-to-production-ready.png">
> Read the planned <a href='https://github.com/dotnet/eShopOnContainers/wiki/01.-Roadmap-and-Milestones-for-future-releases'>Roadmap and Milestones for future releases of eShopOnContainers</a> within the Wiki for further info about possible new implementations and provide feedback at the <a href='https://github.com/dotnet/eShopOnContainers/issues'>ISSUES section</a> if you'd like to see any specific scenario implemented or improved. Also, feel free to discuss on any current issue.
**Architecture overview**: This reference application is cross-platform either at 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.
@ -17,7 +20,7 @@ The plan is to add asynchronous communication for data updates propagation acros
<img src="img/eShopOnContainers_Architecture_Diagram.png">
<p>
<p>
Additional miroservice styles with other frameworks and No-SQL databases will be added, eventually. This is a great opportunity for pull requests from the community, like a new microservice using Nancy, or even other languages like Node, Go, Python or data containers with MongoDB with Azure DocDB compatibility, Postgress, RavenDB, Event Store, MySql, etc. You name it! :)
Additional miroservice styles with other frameworks and No-SQL databases will be added, eventually. This is a great opportunity for pull requests from the community, like a new microservice using Nancy, or even other languages like Node, Go, Python or data containers with MongoDB with Azure DocDB compatibility, PostgreSQL, RavenDB, Event Store, MySql, etc. You name it! :)
> ### 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 to any cloud or specific server. Each database could also be deployed as a single Docker container, but then you'd need more then 8GB or memory RAM assigned to Docker 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.
@ -55,13 +58,13 @@ The screenshot below shows the VS Solution structure for those microservices/con
Finally, those microservices are consumed by multiple client web and mobile apps, as described below.
<br>
<b>*MVC Application (ASP.NET Core)*</b>: 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.
<b>*MVC Application (ASP.NET Core)*</b>: Its an MVC 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.
<img src="img/eshop-webmvc-app-screenshot.png">
<br>
<b>*SPA (Single Page Application)*</b>: 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).
<b>*SPA (Single Page Application)*</b>: Providing similar "eShop business functionality" but developed with Angular 2, Typescript and slightly using ASP.NET Core MVC. 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).
<img src="img/eshop-webspa-app-screenshot.png">
<br>
<b>*Xamarin Mobile App (For iOS, Android and Windows/UWP)*</b>: 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).
<b>*Xamarin Mobile App (For iOS, Android and Windows/UWP)*</b>: It is a client mobile app supporting the most common mobile 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).
<img src="img/xamarin-mobile-App.png">
@ -87,3 +90,7 @@ The app was also partially tested on "Docker for Mac" using a development MacOS
## Sending feedback and pull requests
As mentioned, we'd appreciate to your feedback, improvements and ideas.
You can create new issues at the issues section, do pull requests and/or send emails to eshop_feedback@service.microsoft.com
## Questions
[QUESTION] Answer +1 if the solution is working for you (Through VS2017 or CLI environment):
https://github.com/dotnet/eShopOnContainers/issues/107

docker-compose.local.build.yml → cli-linux/docker-compose.local.build.yml View File


+ 3
- 0
docker-compose.dcproj View File

@ -11,6 +11,9 @@
<None Include="docker-compose.override.yml">
<DependentUpon>docker-compose.yml</DependentUpon>
</None>
<None Include="docker-compose.prod.yml">
<DependentUpon>docker-compose.yml</DependentUpon>
</None>
<None Include="docker-compose.vs.debug.yml">
<DependentUpon>docker-compose.yml</DependentUpon>
</None>


+ 15
- 8
docker-compose.override.yml View File

@ -1,5 +1,11 @@
version: '2'
# 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:
@ -16,7 +22,7 @@ services:
- ASPNETCORE_ENVIRONMENT=Development
- ASPNETCORE_URLS=http://0.0.0.0:5101
- ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word
- ExternalCatalogBaseUrl=http://localhost:5101 #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105.
- ExternalCatalogBaseUrl=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5101 #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105.
ports:
- "5101:5101"
@ -24,9 +30,9 @@ services:
environment:
- ASPNETCORE_ENVIRONMENT=Development
- ASPNETCORE_URLS=http://0.0.0.0:5105
- SpaClient=http://localhost:5104
- SpaClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5104
- ConnectionStrings__DefaultConnection=Server=sql.data;Database=Microsoft.eShopOnContainers.Service.IdentityDb;User Id=sa;Password=Pass@word
- MvcClient=http://localhost:5100 #Local: You need to open your local dev-machine firewall at range 5100-5105.
- MvcClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5100 #Local: You need to open your local dev-machine firewall at range 5100-5105.
ports:
- "5105:5105"
@ -43,10 +49,10 @@ services:
environment:
- ASPNETCORE_ENVIRONMENT=Development
- ASPNETCORE_URLS=http://0.0.0.0:5104
- CatalogUrl=http://localhost:5101
- OrderingUrl=http://localhost:5102
- 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
- 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
ports:
- "5104:5104"
@ -56,8 +62,9 @@ services:
- ASPNETCORE_URLS=http://0.0.0.0:5100
- CatalogUrl=http://catalog.api:5101
- OrderingUrl=http://ordering.api:5102
- 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
- IdentityUrl=http://10.0.75.1:5105 #Local: Use 10.0.75.1 in a "Docker for Windows" environment, if using "localhost" from browser.
#Remote: Use ${ESHOP_EXTERNAL_DNS_NAME_OR_IP} if using external IP or DNS name from browser.
ports:
- "5100:5100"


+ 80
- 0
docker-compose.prod.yml View File

@ -0,0 +1,80 @@
version: '2'
# The Production docker-compose file has to have the external/real IPs or DNS names for the services
# The ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP environment variable is taken, by default, from the ".env" file defined like:
# ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP=192.168.88.248
# 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 when testing the Web apps and the Xamarin apps from remote machines/devices using the same WiFi, for instance.
#
# Set ASPNETCORE_ENVIRONMENT=Development to get errors while testing.
#
# You need to start it with the following CLI command:
# docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d
services:
basket.api:
environment:
- ASPNETCORE_ENVIRONMENT=Production
- ASPNETCORE_URLS=http://0.0.0.0:5103
- ConnectionString=basket.data
- identityUrl=http://identity.api:5105 #Local: You need to open your host's firewall at range 5100-5105. at range 5100-5105.
ports:
- "5103:5103"
catalog.api:
environment:
- ASPNETCORE_ENVIRONMENT=Production
- ASPNETCORE_URLS=http://0.0.0.0:5101
- ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word
- ExternalCatalogBaseUrl=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5101 #Local: You need to open your host's firewall at range 5100-5105. at range 5100-5105.
ports:
- "5101:5101"
identity.api:
environment:
- ASPNETCORE_ENVIRONMENT=Production
- ASPNETCORE_URLS=http://0.0.0.0:5105
- SpaClient=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5104
- ConnectionStrings__DefaultConnection=Server=sql.data;Database=Microsoft.eShopOnContainers.Service.IdentityDb;User Id=sa;Password=Pass@word
- MvcClient=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5100 #Local: You need to open your host's firewall at range 5100-5105.
ports:
- "5105:5105"
ordering.api:
environment:
- ASPNETCORE_ENVIRONMENT=Production
- ASPNETCORE_URLS=http://0.0.0.0:5102
- ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word
- identityUrl=http://identity.api:5105 #Local: You need to open your host's firewall at range 5100-5105. at range 5100-5105.
ports:
- "5102:5102"
webspa:
environment:
- ASPNETCORE_ENVIRONMENT=Production
- ASPNETCORE_URLS=http://0.0.0.0:5104
- CatalogUrl=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5101
- OrderingUrl=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5102
- IdentityUrl=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5105 #Local: You need to open your host's firewall at range 5100-5105. at range 5100-5105.
- BasketUrl=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5103
ports:
- "5104:5104"
webmvc:
environment:
- ASPNETCORE_ENVIRONMENT=Production
- ASPNETCORE_URLS=http://0.0.0.0:5100
- CatalogUrl=http://catalog.api:5101
- OrderingUrl=http://ordering.api:5102
- IdentityUrl=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5105 #Local: Use ${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}, if using external IP or DNS name from browser.
- BasketUrl=http://basket.api:5103
ports:
- "5100:5100"
sql.data:
environment:
- SA_PASSWORD=Pass@word
- ACCEPT_EULA=Y
ports:
- "5433:1433"

BIN
img/exploring-to-production-ready.png View File

Before After
Width: 2342  |  Height: 1285  |  Size: 211 KiB

+ 0
- 71
src/Console/eShopConsole/Program.cs View File

@ -1,71 +0,0 @@
using System;
using System.Linq;
using Microsoft.eShopOnContainers.Services.Ordering.SqlData.UnitOfWork;
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel;
using Microsoft.eShopOnContainers.Services.Ordering.Domain.Contracts;
using Microsoft.eShopOnContainers.Services.Ordering.SqlData.Repositories;
using Microsoft.EntityFrameworkCore;
namespace eShopConsole
{
public class Program
{
public static void Main(string[] args)
{
//// All contexts that share the same service provider will share the same database
////Using InMemory DB
////var options = DbContextUtil.CreateNewContextOptionsForInMemoryDB();
////Using Sql Server
//var options = DbContextUtil.CreateNewContextOptionsForSqlDb();
//// Run the test against one instance of the context
//using (var context = new OrderingDbContext(options))
//{
// IOrderRepository orderRepository = new OrderRepository(context);
// //Create generic Address ValueObject
// Address sampleAddress = new Address("15703 NE 61st Ct.",
// "Redmond",
// "Washington",
// "WA",
// "United States",
// "US",
// "98052",
// 47.661492,
// -122.131309
// );
// //Create sample Orders
// Order order1 = new Order(Guid.NewGuid(), sampleAddress, sampleAddress);
// //Add a few OrderItems
// order1.AddNewOrderItem(Guid.NewGuid(), 2, 25, 30);
// order1.AddNewOrderItem(Guid.NewGuid(), 1, 58, 0);
// order1.AddNewOrderItem(Guid.NewGuid(), 1, 60, 0);
// order1.AddNewOrderItem(Guid.NewGuid(), 3, 12, 0);
// order1.AddNewOrderItem(Guid.NewGuid(), 5, 3, 0);
// orderRepository.Add(order1);
// orderRepository.UnitOfWork.CommitAsync();
// //With no Async Repository
// //context.Orders.Add(order1);
// //context.SaveChanges();
//}
////// Use a separate instance of the context to verify correct data was saved to database
//using (var context = new OrderingDbContext(options))
//{
// var orders = context.Orders
// .Include(o => o.ShippingAddress)
// .Include(o => o.BillingAddress)
// .ToList();
// string cityName = orders.First<Order>().ShippingAddress.City;
// Console.WriteLine("City name retreived from SQL Server: "+cityName);
//}
}
}
}

+ 0
- 19
src/Console/eShopConsole/Properties/AssemblyInfo.cs View File

@ -1,19 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("eShopConsole")]
[assembly: AssemblyTrademark("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("c10c7b69-ce4f-4167-928e-33b7fa1dffc7")]

+ 0
- 8
src/Console/eShopConsole/Properties/launchSettings.json View File

@ -1,8 +0,0 @@
{
"profiles": {
"Docker": {
"executablePath": "%WINDIR%\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
"commandLineArgs": "-ExecutionPolicy RemoteSigned .\\DockerTask.ps1 -Run -Environment $(Configuration) -Machine '$(DockerMachineName)'"
}
}
}

+ 0
- 18
src/Console/eShopConsole/eShopConsole.xproj View File

@ -1,18 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>c10c7b69-ce4f-4167-928e-33b7fa1dffc7</ProjectGuid>
<RootNamespace>eShopConsole</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

+ 0
- 29
src/Console/eShopConsole/project.json View File

@ -1,29 +0,0 @@
{
"version": "1.0.0-*",
"buildOptions": {
"emitEntryPoint": true,
"debugType": "portable"
},
"dependencies": {
"Microsoft.EntityFrameworkCore": "1.0.0",
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.0"
},
"Ordering.Domain": "1.0.0-*",
},
"frameworks": {
"netcoreapp1.0": {
"imports": "dnxcore50"
}
},
"publishOptions": {
"include": [
"docker-compose.yml",
"docker-compose.debug.yml",
"Dockerfile.debug",
"Dockerfile",
".dockerignore"
]
}
}

+ 39
- 0
src/Mobile/AndroidSDKManager.ps1 View File

@ -0,0 +1,39 @@
$AndroidToolPath = "${env:ProgramFiles(x86)}\Android\android-sdk\tools\android.bat"
if (!(Test-Path $AndroidToolPath)) {
$AndroidToolPath = "$env:localappdata\Android\android-sdk\tools\android.bat"
} elseif (!(Test-Path $AndroidToolPath)) {
Write-Error "Unable to find Android SDK Manager tools."
return
}
Function Get-AndroidSDKs() {
$output = & $AndroidToolPath list sdk --all
$sdks = $output |% {
if ($_ -match '(?<index>\d+)- (?<sdk>.+), revision (?<revision>[\d\.]+)') {
$sdk = New-Object PSObject
Add-Member -InputObject $sdk -MemberType NoteProperty -Name Index -Value $Matches.index
Add-Member -InputObject $sdk -MemberType NoteProperty -Name Name -Value $Matches.sdk
Add-Member -InputObject $sdk -MemberType NoteProperty -Name Revision -Value $Matches.revision
$sdk
}
}
$sdks
}
Function Install-AndroidSDK() {
[CmdletBinding()]
Param(
[Parameter(Mandatory=$true, Position=0)]
[PSObject[]]$sdks
)
$sdkIndexes = $sdks |% { $_.Index }
$sdkIndexArgument = [string]::Join(',', $sdkIndexes)
Echo 'y' | & $AndroidToolPath update sdk -u -a -t $sdkIndexArgument
}
# Example usage:
# $sdks = Get-AndroidSDKs |? { $_.name -like 'sdk platform*API 10*' -or $_.name -like 'google apis*api 10' }
# Install-AndroidSDK -sdks $sdks
# https://github.com/AArnott

+ 6
- 5
src/Mobile/README.md View File

@ -16,6 +16,7 @@ This project exercises the following platforms, frameworks or features:
* Xamarin.Forms
* XAML
* Behaviors
* Bindings
* Converters
* Central Styles
@ -39,10 +40,10 @@ The app targets **three** platforms:
* iOS
* Android
* Universal Windows Platform (UWP)
* UWP supported only in Visual Studio, not Xamarin Studio
* UWP supported only in Visual Studio, not Xamarin Studio or Visual Studio for MacOS
As of 19/12/2016, eShopOnContainers features **89.2% code share** (7.2% iOS / 16.7% Android / 8.7% Windows).
As of 07/03/2017, eShopOnContainers features **89.2% code share** (7.2% iOS / 16.7% Android / 8.7% Windows).
##Licenses
@ -55,12 +56,12 @@ This project uses some third-party assets with a license that requires attributi
- [SlideOverKit](https://github.com/XAM-Consulting/SlideOverKit): by XAM-Consulting
## Requirements
### Requirements for Jan. 2017 version of eShopOnContainers
### Requirements for March 2017 version of eShopOnContainers
* [Visual Studio __2015__](https://www.visualstudio.com/en-us/products/vs-2015-product-editions.aspx) (14.0 or higher) to compile C# 6 langage features (or Visual Studio MacOS)
* Xamarin add-ons for Visual Studio (available via the Visual Studio installer)
* __Visual Studio Community Edition is fully supported!__
* Android SDK Tools 25.2.3 or higher
* [Android SDK Tools](https://developer.xamarin.com/guides/android/getting_started/installation/windows/) 25.2.3 or higher
* JDK 8.0
## Setup
@ -154,4 +155,4 @@ In the configuration window of the machine, go to the Compatibility section and
<img src="Images/set-compatibility-vs-sml.png" alt="Migrate to a physical computer with a different processor version" Width="600" />
## Copyright and license
* Code and documentation copyright 2016 Microsoft Corp. Code released under the [MIT license](https://opensource.org/licenses/MIT).
* Code and documentation copyright 2017 Microsoft Corp. Code released under the [MIT license](https://opensource.org/licenses/MIT).

+ 3
- 4
src/Mobile/eShopOnContainers/eShopOnContainers.Core/App.xaml.cs View File

@ -1,6 +1,6 @@
using eShopOnContainers.Core.Helpers;
using eShopOnContainers.Services;
using eShopOnContainers.Core.ViewModels.Base;
using eShopOnContainers.ViewModels.Base;
using System.Threading.Tasks;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
@ -28,13 +28,12 @@ namespace eShopOnContainers
{
UseMockServices = Settings.UseMocks;
ViewModelLocator.Initialize();
ViewModelLocator.UpdateDependencies(UseMockServices);
ViewModelLocator.Instance.UpdateDependencies(UseMockServices);
}
private Task InitNavigation()
{
var navigationService = ViewModelLocator.Resolve<INavigationService>();
var navigationService = ViewModelLocator.Instance.Resolve<INavigationService>();
return navigationService.InitializeAsync();
}


+ 3
- 3
src/Mobile/eShopOnContainers/eShopOnContainers.Core/Helpers/ServicesHelper.cs View File

@ -1,6 +1,6 @@
using eShopOnContainers.Core.Models.Basket;
using eShopOnContainers.Core.Models.Catalog;
using eShopOnContainers.Core.ViewModels.Base;
using eShopOnContainers.ViewModels.Base;
using System;
using System.Collections.Generic;
using System.Diagnostics;
@ -21,7 +21,7 @@ namespace eShopOnContainers.Core.Helpers
try
{
if (!ViewModelLocator.UseMockService
if (!ViewModelLocator.Instance.UseMockService
&& Settings.UrlBase != GlobalSetting.DefaultEndpoint)
{
foreach (var catalogItem in catalogItems)
@ -54,7 +54,7 @@ namespace eShopOnContainers.Core.Helpers
try
{
if (!ViewModelLocator.UseMockService
if (!ViewModelLocator.Instance.UseMockService
&& Settings.UrlBase != GlobalSetting.DefaultEndpoint)
{
foreach (var basketItem in basketItems)


+ 2
- 2
src/Mobile/eShopOnContainers/eShopOnContainers.Core/Helpers/Settings.cs View File

@ -1,4 +1,4 @@
using eShopOnContainers.Core.ViewModels.Base;
using eShopOnContainers.ViewModels.Base;
using Plugin.Settings;
using Plugin.Settings.Abstractions;
@ -27,7 +27,7 @@ namespace eShopOnContainers.Core.Helpers
private const string IdUrlBase = "url_base";
private static readonly string AccessTokenDefault = string.Empty;
private static readonly string IdTokenDefault = string.Empty;
private static readonly bool UseMocksDefault = ViewModelLocator.UseMockService;
private static readonly bool UseMocksDefault = ViewModelLocator.Instance.UseMockService;
private static readonly string UrlBaseDefault = GlobalSetting.Instance.BaseEndpoint;
#endregion


+ 1
- 1
src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Navigation/INavigationService.cs View File

@ -1,4 +1,4 @@
using eShopOnContainers.Core.ViewModels.Base;
using eShopOnContainers.ViewModels.Base;
using System;
using System.Threading.Tasks;


+ 38
- 12
src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Navigation/NavigationService.cs View File

@ -1,10 +1,9 @@
using eShopOnContainers.Core.Helpers;
using eShopOnContainers.Core.ViewModels;
using eShopOnContainers.Core.Views;
using eShopOnContainers.Core.ViewModels.Base;
using eShopOnContainers.ViewModels.Base;
using System;
using System.Globalization;
using System.Reflection;
using System.Collections.Generic;
using System.Threading.Tasks;
using Xamarin.Forms;
@ -12,7 +11,9 @@ namespace eShopOnContainers.Services
{
public class NavigationService : INavigationService
{
protected Application CurrentApplication
protected readonly Dictionary<Type, Type> _mappings;
protected Application CurrentApplication
{
get
{
@ -20,6 +21,13 @@ namespace eShopOnContainers.Services
}
}
public NavigationService()
{
_mappings = new Dictionary<Type, Type>();
CreatePageViewModelMappings();
}
public Task InitializeAsync()
{
if(string.IsNullOrEmpty(Settings.AuthAccessToken))
@ -92,7 +100,7 @@ namespace eShopOnContainers.Services
protected virtual async Task InternalNavigateToAsync(Type viewModelType, object parameter)
{
Page page = CreatePage(viewModelType, parameter);
Page page = CreateAndBindPage(viewModelType, parameter);
if (page is LoginView)
{
@ -101,6 +109,7 @@ namespace eShopOnContainers.Services
else
{
var navigationPage = CurrentApplication.MainPage as CustomNavigationView;
if (navigationPage != null)
{
await navigationPage.PushAsync(page);
@ -116,23 +125,40 @@ namespace eShopOnContainers.Services
protected Type GetPageTypeForViewModel(Type viewModelType)
{
var viewName = viewModelType.FullName.Replace("Model", string.Empty);
var viewModelAssemblyName = viewModelType.GetTypeInfo().Assembly.FullName;
var viewAssemblyName = string.Format(CultureInfo.InvariantCulture, "{0}, {1}", viewName, viewModelAssemblyName);
var viewType = Type.GetType(viewAssemblyName);
return viewType;
if (!_mappings.ContainsKey(viewModelType))
{
throw new KeyNotFoundException($"No map for ${viewModelType} was found on navigation mappings");
}
return _mappings[viewModelType];
}
protected Page CreatePage(Type viewModelType, object parameter)
protected Page CreateAndBindPage(Type viewModelType, object parameter)
{
Type pageType = GetPageTypeForViewModel(viewModelType);
if (pageType == null)
{
throw new Exception($"Cannot locate page type for {viewModelType}");
throw new Exception($"Mapping type for {viewModelType} is not a page");
}
Page page = Activator.CreateInstance(pageType) as Page;
ViewModelBase viewModel = ViewModelLocator.Instance.Resolve(viewModelType) as ViewModelBase;
page.BindingContext = viewModel;
return page;
}
private void CreatePageViewModelMappings()
{
_mappings.Add(typeof(BasketViewModel), typeof(BasketView));
_mappings.Add(typeof(CatalogViewModel), typeof(CatalogView));
_mappings.Add(typeof(CheckoutViewModel), typeof(CheckoutView));
_mappings.Add(typeof(LoginViewModel), typeof(LoginView));
_mappings.Add(typeof(MainViewModel), typeof(MainView));
_mappings.Add(typeof(OrderDetailViewModel), typeof(OrderDetailView));
_mappings.Add(typeof(ProfileViewModel), typeof(ProfileView));
_mappings.Add(typeof(SettingsViewModel), typeof(SettingsView));
}
}
}

+ 3
- 1
src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/RequestProvider/RequestProvider.cs View File

@ -51,7 +51,9 @@ namespace eShopOnContainers.Core.Services.RequestProvider
AddHeaderParameter(httpClient, header);
}
HttpResponseMessage response = await httpClient.GetAsync(uri);
var content = new StringContent(JsonConvert.SerializeObject(data));
content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
HttpResponseMessage response = await httpClient.PostAsync(uri, content);
await HandleResponse(response);


+ 1
- 1
src/Mobile/eShopOnContainers/eShopOnContainers.Core/Validations/ValidatableObject.cs View File

@ -1,4 +1,4 @@
using eShopOnContainers.Core.ViewModels.Base;
using eShopOnContainers.ViewModels.Base;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;


+ 1
- 1
src/Mobile/eShopOnContainers/eShopOnContainers.Core/ViewModels/Base/ExtendedBindableObject.cs View File

@ -3,7 +3,7 @@ using System.Linq.Expressions;
using System.Reflection;
using Xamarin.Forms;
namespace eShopOnContainers.Core.ViewModels.Base
namespace eShopOnContainers.ViewModels.Base
{
public abstract class ExtendedBindableObject : BindableObject
{


+ 6
- 5
src/Mobile/eShopOnContainers/eShopOnContainers.Core/ViewModels/Base/ViewModelBase.cs View File

@ -1,8 +1,9 @@
using eShopOnContainers.Core.Helpers;
using eShopOnContainers.Core;
using eShopOnContainers.Core.Helpers;
using eShopOnContainers.Services;
using System.Threading.Tasks;
namespace eShopOnContainers.Core.ViewModels.Base
namespace eShopOnContainers.ViewModels.Base
{
public abstract class ViewModelBase : ExtendedBindableObject
{
@ -27,14 +28,14 @@ namespace eShopOnContainers.Core.ViewModels.Base
public ViewModelBase()
{
DialogService = ViewModelLocator.Resolve<IDialogService>();
NavigationService = ViewModelLocator.Resolve<INavigationService>();
DialogService = ViewModelLocator.Instance.Resolve<IDialogService>();
NavigationService = ViewModelLocator.Instance.Resolve<INavigationService>();
GlobalSetting.Instance.BaseEndpoint = Settings.UrlBase;
}
public virtual Task InitializeAsync(object navigationData)
{
return Task.FromResult(false);
return Task.FromResult(false);
}
}
}

+ 57
- 59
src/Mobile/eShopOnContainers/eShopOnContainers.Core/ViewModels/Base/ViewModelLocator.cs View File

@ -1,8 +1,7 @@
using Microsoft.Practices.Unity;
using eShopOnContainers.Core.ViewModels;
using eShopOnContainers.Services;
using System;
using System.Globalization;
using System.Reflection;
using eShopOnContainers.Core.Services.Catalog;
using eShopOnContainers.Core.Services.OpenUrl;
using eShopOnContainers.Core.Services.RequestProvider;
@ -10,53 +9,54 @@ using eShopOnContainers.Core.Services.Basket;
using eShopOnContainers.Core.Services.Identity;
using eShopOnContainers.Core.Services.Order;
using eShopOnContainers.Core.Services.User;
using Xamarin.Forms;
namespace eShopOnContainers.Core.ViewModels.Base
namespace eShopOnContainers.ViewModels.Base
{
public static class ViewModelLocator
public class ViewModelLocator
{
private static readonly IUnityContainer _unityContainer = new UnityContainer();
private bool _useMockService;
private readonly IUnityContainer _unityContainer;
public static readonly BindableProperty AutoWireViewModelProperty =
BindableProperty.CreateAttached("AutoWireViewModel", typeof(bool), typeof(ViewModelLocator), default(bool), propertyChanged: OnAutoWireViewModelChanged);
private static readonly ViewModelLocator _instance = new ViewModelLocator();
public static bool GetAutoWireViewModel(BindableObject bindable)
{
return (bool)bindable.GetValue(ViewModelLocator.AutoWireViewModelProperty);
}
public static ViewModelLocator Instance
{
get { return _instance; }
}
public bool UseMockService
{
get { return _useMockService; }
set { _useMockService = value; ; }
}
public static void SetAutoWireViewModel(BindableObject bindable, bool value)
{
bindable.SetValue(ViewModelLocator.AutoWireViewModelProperty, value);
}
protected ViewModelLocator()
{
_unityContainer = new UnityContainer();
public static bool UseMockService { get; set; }
// Services
_unityContainer.RegisterType<IDialogService, DialogService>();
RegisterSingleton<INavigationService, NavigationService>();
_unityContainer.RegisterType<IOpenUrlService, OpenUrlService>();
_unityContainer.RegisterType<IRequestProvider, RequestProvider>();
_unityContainer.RegisterType<IIdentityService, IdentityService>();
public static void Initialize()
{
// Services
_unityContainer.RegisterType<IDialogService, DialogService>();
_unityContainer.RegisterType<INavigationService, NavigationService>(new ContainerControlledLifetimeManager());
_unityContainer.RegisterType<IOpenUrlService, OpenUrlService>();
_unityContainer.RegisterType<IRequestProvider, RequestProvider>();
_unityContainer.RegisterType<IIdentityService, IdentityService>();
_unityContainer.RegisterType<ICatalogService, CatalogMockService>();
_unityContainer.RegisterType<IBasketService, BasketMockService>();
_unityContainer.RegisterType<IUserService, UserMockService>();
_unityContainer.RegisterType<ICatalogService, CatalogMockService>();
_unityContainer.RegisterType<IBasketService, BasketMockService>();
_unityContainer.RegisterType<IUserService, UserMockService>();
// View models
_unityContainer.RegisterType<BasketViewModel>();
_unityContainer.RegisterType<CatalogViewModel>();
_unityContainer.RegisterType<CheckoutViewModel>();
_unityContainer.RegisterType<LoginViewModel>();
_unityContainer.RegisterType<MainViewModel>();
_unityContainer.RegisterType<OrderDetailViewModel>();
_unityContainer.RegisterType<ProfileViewModel>();
_unityContainer.RegisterType<SettingsViewModel>();
}
// View models
_unityContainer.RegisterType<BasketViewModel>();
_unityContainer.RegisterType<CatalogViewModel>();
_unityContainer.RegisterType<CheckoutViewModel>();
_unityContainer.RegisterType<LoginViewModel>();
_unityContainer.RegisterType<MainViewModel>();
_unityContainer.RegisterType<OrderDetailViewModel>();
_unityContainer.RegisterType<ProfileViewModel>();
_unityContainer.RegisterType<SettingsViewModel>();
}
public static void UpdateDependencies(bool useMockServices)
public void UpdateDependencies(bool useMockServices)
{
// Change injected dependencies
if (useMockServices)
@ -80,31 +80,29 @@ namespace eShopOnContainers.Core.ViewModels.Base
}
}
public static T Resolve<T>()
public T Resolve<T>()
{
return _unityContainer.Resolve<T>();
}
private static void OnAutoWireViewModelChanged(BindableObject bindable, object oldValue, object newValue)
{
var view = bindable as Element;
if (view == null)
{
return;
}
public object Resolve(Type type)
{
return _unityContainer.Resolve(type);
}
public void Register<T>(T instance)
{
_unityContainer.RegisterInstance<T>(instance);
}
var viewType = view.GetType();
var viewName = viewType.FullName.Replace(".Views.", ".ViewModels.");
var viewAssemblyName = viewType.GetTypeInfo().Assembly.FullName;
var viewModelName = string.Format(CultureInfo.InvariantCulture, "{0}Model, {1}", viewName, viewAssemblyName);
public void Register<TInterface, T>() where T : TInterface
{
_unityContainer.RegisterType<TInterface, T>();
}
var viewModelType = Type.GetType(viewModelName);
if (viewModelType == null)
{
return;
}
var viewModel = _unityContainer.Resolve(viewModelType);
view.BindingContext = viewModel;
}
public void RegisterSingleton<TInterface, T>() where T : TInterface
{
_unityContainer.RegisterType<TInterface, T>(new ContainerControlledLifetimeManager());
}
}
}

+ 2
- 0
src/Mobile/eShopOnContainers/eShopOnContainers.Core/ViewModels/BasketViewModel.cs View File

@ -4,6 +4,8 @@ using eShopOnContainers.Core.Models.Catalog;
using eShopOnContainers.Core.Services.Basket;
using eShopOnContainers.Core.Services.User;
using eShopOnContainers.Core.ViewModels.Base;
using eShopOnContainers.ViewModels.Base;
using System;
using System.Collections.ObjectModel;
using System.Linq;
using System.Threading.Tasks;


+ 4
- 1
src/Mobile/eShopOnContainers/eShopOnContainers.Core/ViewModels/CatalogViewModel.cs View File

@ -1,11 +1,14 @@
using System.Threading.Tasks;
using eShopOnContainers.Core.ViewModels.Base;
using eShopOnContainers.ViewModels.Base;
using System.Collections.ObjectModel;
using Xamarin.Forms;
using eShopOnContainers.Core.ViewModels.Base;
using eShopOnContainers.Core.Models.Catalog;
using eShopOnContainers.Core.Services.Catalog;
using System.Windows.Input;
using System.Linq;
using eShopOnContainers.Core.Services.Basket;
using eShopOnContainers.Core.Helpers;
using eShopOnContainers.Core.Services.User;
namespace eShopOnContainers.Core.ViewModels


+ 2
- 2
src/Mobile/eShopOnContainers/eShopOnContainers.Core/ViewModels/CheckoutViewModel.cs View File

@ -1,5 +1,5 @@
using eShopOnContainers.Core.Models.Navigation;
using eShopOnContainers.Core.ViewModels.Base;
using eShopOnContainers.ViewModels.Base;
using System.Windows.Input;
using Xamarin.Forms;
using System.Threading.Tasks;
@ -138,7 +138,7 @@ namespace eShopOnContainers.Core.ViewModels
await _basketService.ClearBasketAsync(_shippingAddress.Id.ToString(), authToken);
// Reset Basket badge
var basketViewModel = ViewModelLocator.Resolve<BasketViewModel>();
var basketViewModel = ViewModelLocator.Instance.Resolve<BasketViewModel>();
basketViewModel.BadgeCount = 0;
// Navigate to Orders


+ 3
- 2
src/Mobile/eShopOnContainers/eShopOnContainers.Core/ViewModels/LoginViewModel.cs View File

@ -4,7 +4,7 @@ using eShopOnContainers.Core.Services.Identity;
using eShopOnContainers.Core.Services.OpenUrl;
using eShopOnContainers.Core.Services.User;
using eShopOnContainers.Core.Validations;
using eShopOnContainers.Core.ViewModels.Base;
using eShopOnContainers.ViewModels.Base;
using IdentityModel.Client;
using System;
using System.Diagnostics;
@ -133,9 +133,10 @@ namespace eShopOnContainers.Core.ViewModels
public override Task InitializeAsync(object navigationData)
{
if (navigationData is LogoutParameter)
if(navigationData is LogoutParameter)
{
var logoutParameter = (LogoutParameter)navigationData;
if (logoutParameter.Logout)
{
Logout();


+ 1
- 1
src/Mobile/eShopOnContainers/eShopOnContainers.Core/ViewModels/MainViewModel.cs View File

@ -1,5 +1,5 @@
using System.Threading.Tasks;
using eShopOnContainers.Core.ViewModels.Base;
using eShopOnContainers.ViewModels.Base;
using eShopOnContainers.Core.Models.Navigation;
using Xamarin.Forms;
using eShopOnContainers.Core.ViewModels.Base;


+ 1
- 1
src/Mobile/eShopOnContainers/eShopOnContainers.Core/ViewModels/OrderDetailViewModel.cs View File

@ -1,6 +1,6 @@
using System.Threading.Tasks;
using eShopOnContainers.Core.Models.Orders;
using eShopOnContainers.Core.ViewModels.Base;
using eShopOnContainers.ViewModels.Base;
using eShopOnContainers.Core.Services.Catalog;
using eShopOnContainers.Core.Services.Basket;
using eShopOnContainers.Core.Services.Order;


+ 1
- 1
src/Mobile/eShopOnContainers/eShopOnContainers.Core/ViewModels/ProfileViewModel.cs View File

@ -3,7 +3,7 @@ using eShopOnContainers.Core.Helpers;
using eShopOnContainers.Core.Models.Orders;
using eShopOnContainers.Core.Models.User;
using eShopOnContainers.Core.Services.Order;
using eShopOnContainers.Core.ViewModels.Base;
using eShopOnContainers.ViewModels.Base;
using System.Collections.ObjectModel;
using System.Threading.Tasks;
using System.Windows.Input;


+ 2
- 2
src/Mobile/eShopOnContainers/eShopOnContainers.Core/ViewModels/SettingsViewModel.cs View File

@ -1,4 +1,4 @@
using eShopOnContainers.Core.ViewModels.Base;
using eShopOnContainers.ViewModels.Base;
using System.Windows.Input;
using Xamarin.Forms;
using System.Threading.Tasks;
@ -71,7 +71,7 @@ namespace eShopOnContainers.Core.ViewModels
private void MockServices()
{
ViewModelLocator.UpdateDependencies(!UseAzureServices);
ViewModelLocator.Instance.UpdateDependencies(!UseAzureServices);
UpdateInfo();
}


+ 2
- 4
src/Mobile/eShopOnContainers/eShopOnContainers.Core/Views/BasketView.xaml View File

@ -1,11 +1,9 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="eShopOnContainers.Core.Views.BasketView"
xmlns:viewModelBase="clr-namespace:eShopOnContainers.Core.ViewModels.Base;assembly=eShopOnContainers.Core"
x:Class="eShopOnContainers.Core.Views.BasketView"
xmlns:behaviors="clr-namespace:eShopOnContainers.Core.Behaviors;assembly=eShopOnContainers.Core"
xmlns:templates="clr-namespace:eShopOnContainers.Core.Views.Templates;assembly=eShopOnContainers.Core"
viewModelBase:ViewModelLocator.AutoWireViewModel="true"
xmlns:templates="clr-namespace:eShopOnContainers.Core.Views.Templates;assembly=eShopOnContainers.Core"
Title="Cart">
<ContentPage.Resources>
<ResourceDictionary>


+ 3
- 5
src/Mobile/eShopOnContainers/eShopOnContainers.Core/Views/CatalogView.xaml View File

@ -1,14 +1,12 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="eShopOnContainers.Core.Views.CatalogView"
xmlns:templates="clr-namespace:eShopOnContainers.Core.Views.Templates;assembly=eShopOnContainers.Core"
xmlns:views="clr-namespace:eShopOnContainers.Core.Views;assembly=eShopOnContainers.Core"
xmlns:viewModelBase="clr-namespace:eShopOnContainers.Core.ViewModels.Base;assembly=eShopOnContainers.Core"
xmlns:views="clr-namespace:eShopOnContainers.Core.Views;assembly=eShopOnContainers.Core"
xmlns:animations="clr-namespace:eShopOnContainers.Core.Animations;assembly=eShopOnContainers.Core"
xmlns:triggers="clr-namespace:eShopOnContainers.Core.Triggers;assembly=eShopOnContainers.Core"
xmlns:behaviors="clr-namespace:eShopOnContainers.Core.Behaviors;assembly=eShopOnContainers.Core"
viewModelBase:ViewModelLocator.AutoWireViewModel="true"
xmlns:behaviors="clr-namespace:eShopOnContainers.Core.Behaviors;assembly=eShopOnContainers.Core"
Title="Catalog">
<ContentPage.Resources>
<ResourceDictionary>


+ 2
- 4
src/Mobile/eShopOnContainers/eShopOnContainers.Core/Views/CheckoutView.xaml View File

@ -1,10 +1,8 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="eShopOnContainers.Core.Views.CheckoutView"
xmlns:viewModelBase="clr-namespace:eShopOnContainers.Core.ViewModels.Base;assembly=eShopOnContainers.Core"
xmlns:templates="clr-namespace:eShopOnContainers.Core.Views.Templates;assembly=eShopOnContainers.Core"
viewModelBase:ViewModelLocator.AutoWireViewModel="true"
xmlns:templates="clr-namespace:eShopOnContainers.Core.Views.Templates;assembly=eShopOnContainers.Core"
Title="Checkout">
<ContentPage.Resources>
<ResourceDictionary>


+ 1
- 3
src/Mobile/eShopOnContainers/eShopOnContainers.Core/Views/LoginView.xaml View File

@ -2,11 +2,9 @@
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="eShopOnContainers.Core.Views.LoginView"
xmlns:viewModelBase="clr-namespace:eShopOnContainers.Core.ViewModels.Base;assembly=eShopOnContainers.Core"
xmlns:animations="clr-namespace:eShopOnContainers.Core.Animations;assembly=eShopOnContainers.Core"
xmlns:triggers="clr-namespace:eShopOnContainers.Core.Triggers;assembly=eShopOnContainers.Core"
xmlns:behaviors="clr-namespace:eShopOnContainers.Core.Behaviors;assembly=eShopOnContainers.Core"
viewModelBase:ViewModelLocator.AutoWireViewModel="true">
xmlns:behaviors="clr-namespace:eShopOnContainers.Core.Behaviors;assembly=eShopOnContainers.Core">
<ContentPage.Title>
<OnPlatform
x:TypeArguments="x:String"


+ 2
- 4
src/Mobile/eShopOnContainers/eShopOnContainers.Core/Views/MainView.xaml View File

@ -1,14 +1,12 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8" ?>
<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="eShopOnContainers.Core.Views.MainView"
xmlns:views="clr-namespace:eShopOnContainers.Core.Views;assembly=eShopOnContainers.Core"
xmlns:viewModelBase="clr-namespace:eShopOnContainers.Core.ViewModels.Base;assembly=eShopOnContainers.Core"
xmlns:controls="clr-namespace:eShopOnContainers.Core.Controls;assembly=eShopOnContainers.Core"
BarBackgroundColor="{StaticResource DarkGreenColor}"
BackgroundColor="{StaticResource BackgroundColor}"
BarTextColor="{StaticResource WhiteColor}"
viewModelBase:ViewModelLocator.AutoWireViewModel="true">
BarTextColor="{StaticResource WhiteColor}">
<TabbedPage.Title>
<OnPlatform
x:TypeArguments="x:String"


+ 12
- 3
src/Mobile/eShopOnContainers/eShopOnContainers.Core/Views/MainView.xaml.cs View File

@ -1,5 +1,6 @@
using eShopOnContainers.Core.ViewModels;
using eShopOnContainers.Core.ViewModels.Base;
using eShopOnContainers.ViewModels.Base;
using Xamarin.Forms;
namespace eShopOnContainers.Core.Views
@ -31,9 +32,17 @@ namespace eShopOnContainers.Core.Views
}
});
await ((CatalogViewModel)HomeView.BindingContext).InitializeAsync(null);
await ((BasketViewModel)BasketView.BindingContext).InitializeAsync(null);
await ((ProfileViewModel)ProfileView.BindingContext).InitializeAsync(null);
var homeViewModel = ViewModelLocator.Instance.Resolve<CatalogViewModel>();
await homeViewModel.InitializeAsync(null);
HomeView.BindingContext = homeViewModel;
var basketViewModel = ViewModelLocator.Instance.Resolve<BasketViewModel>();
await basketViewModel.InitializeAsync(null);
BasketView.BindingContext = basketViewModel;
var profileViewModel = ViewModelLocator.Instance.Resolve<ProfileViewModel>();
await profileViewModel.InitializeAsync(null);
ProfileView.BindingContext = profileViewModel;
}
}
}

+ 2
- 4
src/Mobile/eShopOnContainers/eShopOnContainers.Core/Views/OrderDetailView.xaml View File

@ -1,12 +1,10 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="eShopOnContainers.Core.Views.OrderDetailView"
xmlns:viewModelBase="clr-namespace:eShopOnContainers.Core.ViewModels.Base;assembly=eShopOnContainers.Core"
x:Class="eShopOnContainers.Core.Views.OrderDetailView"
xmlns:templates="clr-namespace:eShopOnContainers.Core.Views.Templates;assembly=eShopOnContainers.Core"
xmlns:animations="clr-namespace:eShopOnContainers.Core.Animations;assembly=eShopOnContainers.Core"
xmlns:triggers="clr-namespace:eShopOnContainers.Core.Triggers;assembly=eShopOnContainers.Core"
viewModelBase:ViewModelLocator.AutoWireViewModel="true"
Title="{Binding Order.OrderNumber}">
<ContentPage.Resources>
<ResourceDictionary>


+ 3
- 5
src/Mobile/eShopOnContainers/eShopOnContainers.Core/Views/ProfileView.xaml View File

@ -1,13 +1,11 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="eShopOnContainers.Core.Views.ProfileView"
xmlns:views="clr-namespace:eShopOnContainers.Core.Views;assembly=eShopOnContainers.Core"
xmlns:viewModelBase="clr-namespace:eShopOnContainers.Core.ViewModels.Base;assembly=eShopOnContainers.Core"
xmlns:views="clr-namespace:eShopOnContainers.Core.Views;assembly=eShopOnContainers.Core"
xmlns:templates="clr-namespace:eShopOnContainers.Core.Views.Templates;assembly=eShopOnContainers.Core"
xmlns:behaviors="clr-namespace:eShopOnContainers.Core.Behaviors;assembly=eShopOnContainers.Core"
viewModelBase:ViewModelLocator.AutoWireViewModel="true"
Title="My profile">
Title="My profile">
<ContentPage.Resources>
<ResourceDictionary>


+ 3
- 5
src/Mobile/eShopOnContainers/eShopOnContainers.Core/Views/SettingsView.xaml View File

@ -1,13 +1,11 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="eShopOnContainers.Core.Views.SettingsView"
xmlns:viewModelBase="clr-namespace:eShopOnContainers.Core.ViewModels.Base;assembly=eShopOnContainers.Core"
x:Class="eShopOnContainers.Core.Views.SettingsView"
xmlns:controls="clr-namespace:eShopOnContainers.Core.Controls;assembly=eShopOnContainers.Core"
xmlns:animations="clr-namespace:eShopOnContainers.Core.Animations;assembly=eShopOnContainers.Core"
xmlns:triggers="clr-namespace:eShopOnContainers.Core.Triggers;assembly=eShopOnContainers.Core"
xmlns:behaviors="clr-namespace:eShopOnContainers.Core.Behaviors;assembly=eShopOnContainers.Core"
viewModelBase:ViewModelLocator.AutoWireViewModel="true"
xmlns:behaviors="clr-namespace:eShopOnContainers.Core.Behaviors;assembly=eShopOnContainers.Core"
Title="Settings">
<ContentPage.Resources>
<ResourceDictionary>


+ 1
- 1
src/Mobile/eShopOnContainers/eShopOnContainers.Droid/eShopOnContainers.Droid.csproj View File

@ -385,7 +385,7 @@
<Import Project="..\..\..\..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\build\Xamarin.Android.Support.Vector.Drawable.targets" Condition="Exists('..\..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\build\Xamarin.Android.Support.Vector.Drawable.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>Este proyecto hace referencia a los paquetes NuGet que faltan en este equipo. Use la restauración de paquetes NuGet para descargarlos. Para obtener más información, consulte http://go.microsoft.com/fwlink/?LinkID=322105. El archivo que falta es {0}.</ErrorText>
<ErrorText>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}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\..\..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\build\Xamarin.Android.Support.Vector.Drawable.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\build\Xamarin.Android.Support.Vector.Drawable.targets'))" />
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets'))" />


+ 1
- 1
src/Mobile/eShopOnContainers/eShopOnContainers.TestRunner.Droid/eShopOnContainers.TestRunner.Droid.csproj View File

@ -170,7 +170,7 @@
<Import Project="..\..\..\..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\build\Xamarin.Android.Support.Vector.Drawable.targets" Condition="Exists('..\..\..\..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\build\Xamarin.Android.Support.Vector.Drawable.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>Este proyecto hace referencia a los paquetes NuGet que faltan en este equipo. Use la restauración de paquetes NuGet para descargarlos. Para obtener más información, consulte http://go.microsoft.com/fwlink/?LinkID=322105. El archivo que falta es {0}.</ErrorText>
<ErrorText>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}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\..\..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\build\Xamarin.Android.Support.Vector.Drawable.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\build\Xamarin.Android.Support.Vector.Drawable.targets'))" />
<Error Condition="!Exists('..\..\..\..\packages\xunit.runner.devices.2.1.0\build\MonoAndroid\xunit.runner.devices.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\xunit.runner.devices.2.1.0\build\MonoAndroid\xunit.runner.devices.targets'))" />


+ 1
- 1
src/Mobile/eShopOnContainers/eShopOnContainers.TestRunner.iOS/eShopOnContainers.TestRunner.iOS.csproj View File

@ -169,7 +169,7 @@
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>Este proyecto hace referencia a los paquetes NuGet que faltan en este equipo. Use la restauración de paquetes NuGet para descargarlos. Para obtener más información, consulte http://go.microsoft.com/fwlink/?LinkID=322105. El archivo que falta es {0}.</ErrorText>
<ErrorText>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}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\..\..\packages\xunit.runner.devices.2.1.0\build\Xamarin.iOS\xunit.runner.devices.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\xunit.runner.devices.2.1.0\build\Xamarin.iOS\xunit.runner.devices.targets'))" />
<Error Condition="!Exists('..\..\..\..\packages\Xamarin.Forms.2.3.3.175\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Xamarin.Forms.2.3.3.175\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.targets'))" />


+ 1
- 1
src/Mobile/eShopOnContainers/eShopOnContainers.iOS/eShopOnContainers.iOS.csproj View File

@ -433,7 +433,7 @@
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>Este proyecto hace referencia a los paquetes NuGet que faltan en este equipo. Use la restauración de paquetes NuGet para descargarlos. Para obtener más información, consulte http://go.microsoft.com/fwlink/?LinkID=322105. El archivo que falta es {0}.</ErrorText>
<ErrorText>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}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets'))" />
<Error Condition="!Exists('..\..\..\..\packages\Xamarin.Forms.2.3.3.175\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Xamarin.Forms.2.3.3.175\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.targets'))" />


+ 0
- 4
src/Services/Basket/Basket.API/Properties/launchSettings.json View File

@ -23,10 +23,6 @@
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Docker": {
"launchBrowser": true,
"launchUrl": "http://localhost:{ServicePort}/api/values"
}
}
}

+ 0
- 4
src/Services/Catalog/Catalog.API/Properties/launchSettings.json View File

@ -22,10 +22,6 @@
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Docker": {
"launchBrowser": true,
"launchUrl": "http://localhost:{ServicePort}/api/values"
}
}
}

+ 2
- 2
src/Services/Identity/Identity.API/Configuration/Config.cs View File

@ -91,8 +91,8 @@ namespace Identity.API.Configuration
},
PostLogoutRedirectUris = new List<string>
{
$"{clientsUrl["Mvc"]}/",
"http://localhost:5100/"
$"{clientsUrl["Mvc"]}/signout-callback-oidc",
"http://localhost:5100/signout-callback-oidc"
},
AllowedScopes = new List<string>
{


+ 1
- 19
src/Services/Identity/Identity.API/Identity.API.csproj View File

@ -13,20 +13,6 @@
<DockerComposeProjectPath>..\..\..\..\docker-compose.dcproj</DockerComposeProjectPath>
</PropertyGroup>
<ItemGroup>
<None Include="wwwroot\css\*.min.css" CopyToPublishDirectory="PreserveNewest" />
<None Include="wwwroot\fonts\**\*" CopyToPublishDirectory="PreserveNewest" />
<None Include="wwwroot\images\**\*" CopyToPublishDirectory="PreserveNewest" />
<None Include="wwwroot\js\*.min.js" CopyToPublishDirectory="PreserveNewest" />
<None Include="wwwroot\*.*" CopyToPublishDirectory="PreserveNewest" />
<None Include="wwwroot\lib\bootstrap\dist\**\*.min.*" CopyToPublishDirectory="PreserveNewest" />
<None Include="wwwroot\lib\jquery*\**\*.min.*" CopyToPublishDirectory="PreserveNewest" />
<Content Update="wwwroot\**\*;" CopyToPublishDirectory="Never" />
<Content Update="Views\**\*;" CopyToPublishDirectory="PreserveNewest" />
<Content Update="web.config" CopyToPublishDirectory="PreserveNewest" />
<Content Update=".dockerignore" CopyToPublishDirectory="PreserveNewest" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="1.1.0" />
@ -61,7 +47,7 @@
<Target Name="PrepublishScript" BeforeTargets="PrepareForPublish">
<Exec Command="bower install --allow-root" />
<Exec Command="dotnet bundle" />
<Exec Command="dotnet bundle" Condition="'$(ASPNETCORE_ENVIRONMENT)'!='Development'" />
</Target>
<ItemGroup>
@ -77,8 +63,4 @@
</None>
</ItemGroup>
<ItemGroup>
<Folder Include="wwwroot\css\" />
</ItemGroup>
</Project>

+ 3
- 3
src/Services/Ordering/Ordering.API/Application/Commands/CreateOrderCommandHandler.cs View File

@ -24,12 +24,12 @@
public class CreateOrderCommandHandler
: IAsyncRequestHandler<CreateOrderCommand, bool>
{
private readonly IBuyerRepository<Buyer> _buyerRepository;
private readonly IOrderRepository<Order> _orderRepository;
private readonly IBuyerRepository _buyerRepository;
private readonly IOrderRepository _orderRepository;
private readonly IIdentityService _identityService;
// Using DI to inject infrastructure persistence Repositories
public CreateOrderCommandHandler(IBuyerRepository<Buyer> buyerRepository, IOrderRepository<Order> orderRepository, IIdentityService identityService)
public CreateOrderCommandHandler(IBuyerRepository buyerRepository, IOrderRepository orderRepository, IIdentityService identityService)
{
_buyerRepository = buyerRepository ?? throw new ArgumentNullException(nameof(buyerRepository));
_orderRepository = orderRepository ?? throw new ArgumentNullException(nameof(orderRepository));


+ 2
- 2
src/Services/Ordering/Ordering.API/Infrastructure/AutofacModules/ApplicationModule.cs View File

@ -27,11 +27,11 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.Autof
.InstancePerLifetimeScope();
builder.RegisterType<BuyerRepository>()
.As<IBuyerRepository<Buyer>>()
.As<IBuyerRepository>()
.InstancePerLifetimeScope();
builder.RegisterType<OrderRepository>()
.As<IOrderRepository<Order>>()
.As<IOrderRepository>()
.InstancePerLifetimeScope();
builder.RegisterType<RequestManager>()


+ 0
- 6
src/Services/Ordering/Ordering.API/Properties/launchSettings.json View File

@ -23,12 +23,6 @@
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Docker": {
"executablePath": "%WINDIR%\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
"commandLineArgs": "-ExecutionPolicy RemoteSigned .\\DockerTask.ps1 -Run -Environment $(Configuration) -Machine '$(DockerMachineName)'",
"launchBrowser": true,
"launchUrl": "http://localhost:{ServicePort}/api/environmentInfo/machinename"
}
}
}

+ 1
- 1
src/Services/Ordering/Ordering.Domain/AggregatesModel/BuyerAggregate/IBuyerRepository.cs View File

@ -6,7 +6,7 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.B
//This is just the RepositoryContracts or Interface defined at the Domain Layer
//as requisite for the Buyer Aggregate
public interface IBuyerRepository<T> : IRepository<T> where T : IAggregateRoot
public interface IBuyerRepository : IRepository<Buyer>
{
Buyer Add(Buyer buyer);


+ 1
- 1
src/Services/Ordering/Ordering.Domain/AggregatesModel/OrderAggregate/IOrderRepository.cs View File

@ -5,7 +5,7 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.O
//This is just the RepositoryContracts or Interface defined at the Domain Layer
//as requisite for the Order Aggregate
public interface IOrderRepository<T> : IRepository<T> where T : IAggregateRoot
public interface IOrderRepository : IRepository<Order>
{
Order Add(Order order);
}


+ 1
- 1
src/Services/Ordering/Ordering.Infrastructure/Repositories/BuyerRepository.cs View File

@ -8,7 +8,7 @@ using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Repositories
{
public class BuyerRepository
: IBuyerRepository<Buyer>
: IBuyerRepository
{
private readonly OrderingContext _context;


+ 1
- 1
src/Services/Ordering/Ordering.Infrastructure/Repositories/OrderRepository.cs View File

@ -5,7 +5,7 @@ using System;
namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Repositories
{
public class OrderRepository
: IOrderRepository<Order>
: IOrderRepository
{
private readonly OrderingContext _context;


+ 0
- 4
src/Web/WebMVC/Properties/launchSettings.json View File

@ -21,10 +21,6 @@
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Docker": {
"launchBrowser": true,
"launchUrl": "http://localhost:{ServicePort}"
}
}
}

+ 1
- 1
src/Web/WebMVC/Services/Utilities/RetryWithExponentialBackoff.cs View File

@ -21,7 +21,7 @@ namespace Microsoft.eShopOnContainers.WebMVC.Services
{
private readonly int maxRetries, delayMilliseconds, maxDelayMilliseconds;
public RetryWithExponentialBackoff(int maxRetries = 10, int delayMilliseconds = 200, int maxDelayMilliseconds = 2000)
public RetryWithExponentialBackoff(int maxRetries = 50, int delayMilliseconds = 200, int maxDelayMilliseconds = 2000)
{
this.maxRetries = maxRetries;
this.delayMilliseconds = delayMilliseconds;


+ 1
- 1
src/Web/WebSPA/Client/modules/shared/services/configuration.service.ts View File

@ -22,7 +22,7 @@ export class ConfigurationService {
constructor(private http: Http, private storageService: StorageService) { }
load() {
let url = "http://localhost:5104/Home/Configuration";
let url = "/Home/Configuration";
this.http.get(url).subscribe((response: Response) => {
console.log('server settings loaded');
this.serverSettings = response.json();


+ 3
- 3
src/Web/WebSPA/Client/modules/shared/services/security.service.ts View File

@ -67,7 +67,7 @@ export class SecurityService {
this.storage.store('userData', data);
// emit observable
this.authenticationSource.next(true);
window.location.href = 'http://localhost:5104';
window.location.href = location.origin;
},
error => this.HandleError(error),
() => {
@ -80,7 +80,7 @@ export class SecurityService {
let authorizationUrl = this.authorityUrl + '/connect/authorize';
let client_id = 'js';
let redirect_uri = 'http://localhost:5104/';
let redirect_uri = location.origin + '/';
let response_type = 'id_token token';
let scope = 'openid profile orders basket';
let nonce = 'N' + Math.random() + '' + Date.now();
@ -152,7 +152,7 @@ export class SecurityService {
public Logoff() {
let authorizationUrl = this.authorityUrl + '/connect/endsession';
let id_token_hint = this.storage.retrieve('authorizationDataIdToken');
let post_logout_redirect_uri = 'http://localhost:5104/';
let post_logout_redirect_uri = location.origin + '/';
let url =
authorizationUrl + '?' +


+ 4
- 4
test/Services/UnitTest/Ordering/Application/NewOrderCommandHandlerTest.cs View File

@ -15,15 +15,15 @@ namespace UnitTest.Ordering.Application
using Xunit;
public class NewOrderRequestHandlerTest
{
private readonly Mock<IBuyerRepository<Buyer>> _buyerRepositoryMock;
private readonly Mock<IOrderRepository<Order>> _orderRepositoryMock;
private readonly Mock<IBuyerRepository> _buyerRepositoryMock;
private readonly Mock<IOrderRepository> _orderRepositoryMock;
private readonly Mock<IIdentityService> _identityServiceMock;
public NewOrderRequestHandlerTest()
{
_buyerRepositoryMock = new Mock<IBuyerRepository<Buyer>>();
_orderRepositoryMock = new Mock<IOrderRepository<Order>>();
_buyerRepositoryMock = new Mock<IBuyerRepository>();
_orderRepositoryMock = new Mock<IOrderRepository>();
_identityServiceMock = new Mock<IIdentityService>();
}


Loading…
Cancel
Save