diff --git a/src/Services/Basket/Basket.API/Controllers/BasketController.cs b/src/Services/Basket/Basket.API/Controllers/BasketController.cs index 548eb2bbf..2cb3fcafe 100644 --- a/src/Services/Basket/Basket.API/Controllers/BasketController.cs +++ b/src/Services/Basket/Basket.API/Controllers/BasketController.cs @@ -9,7 +9,7 @@ using Microsoft.AspNetCore.Authorization; namespace Microsoft.eShopOnContainers.Services.Basket.API.Controllers { //TODO NOTE: Right now this is a very chunky API, as the app evolves it is possible we would - //want to make the actions more fine graned, add basket item as an action for example. + //want to make the actions more fine grained, add basket item as an action for example. //If this is the case we should also investigate changing the serialization format used for Redis, //using a HashSet instead of a simple string. [Route("/")] diff --git a/src/Services/Basket/Basket.API/README.md b/src/Services/Basket/Basket.API/README.md index aa8a68c02..796cf031f 100644 --- a/src/Services/Basket/Basket.API/README.md +++ b/src/Services/Basket/Basket.API/README.md @@ -3,17 +3,17 @@ Sample reference containerized application, cross-platform and microservices arc Powered by Microsoft #Overview -This sample runs a microservices oriented application and a .net core Mvc application that consumes this services. You can find more information about how to set up docker in your machine in the global directory solution. +This sample runs a microservices oriented application and an ASP.NET Core MVC application that consumes this services. You can find more information about how to set up docker in your machine in the global directory solution. #Deploy -In the global directory you will find the scripts needed to run and deploy the demo into your local docker infraestructure. +In the global directory you will find the scripts needed to run and deploy the demo into your local docker infrastructure. -- build-image-services-basket.ps1 Build .net applications and docker images: This power shell script that you will find in the root directory of the solution is the responsible of building .net applications and package in a pub folder and use docker commands to build the images needed to run the previously packaged .net applications. +- build-image-services-basket.ps1 Build .net applications and docker images: This PowerShell script that you will find in the root directory of the solution is responsible for building .NET applications and package in a pub folder and use docker commands to build the images needed to run the previously packaged .NET applications. -- Compose containers in your docker local VM: Finally you have to open your favourite command tool pointing to the root directory of this project where docker-compose.yml file is located and run the command `docker-compose up` +- Compose containers in your docker local VM: Finally you have to open your favorite command tool pointing to the root directory of this project where docker-compose.yml file is located and run the command `docker-compose up` #Run -Once the deploy process of docker-compose finishes you have to be able to access the services in this urls: +Once the deploy process of docker-compose finishes you have to be able to access the services in these urls: - Basket service: http://localhost:5103 - Identity service: http://localhost:5105 - Basket data (Redis): listening in localhost:6379 diff --git a/src/Services/Basket/Basket.API/Startup.cs b/src/Services/Basket/Basket.API/Startup.cs index 35ac63f1e..c72d68533 100644 --- a/src/Services/Basket/Basket.API/Startup.cs +++ b/src/Services/Basket/Basket.API/Startup.cs @@ -37,9 +37,9 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API services.AddMvc(); services.Configure(Configuration); - //By connection here we are making sure that our service + //By connecting here we are making sure that our service //cannot start until redis is ready. This might slow down startup, - //but given that it is there is a delay on resolving the ip address + //but given that there is a delay on resolving the ip address //and then creating the connection it seems reasonable to move //that cost to startup instead of having the first request pay the //penalty. diff --git a/src/Services/Catalog/Catalog.API/README.md b/src/Services/Catalog/Catalog.API/README.md index 5616bab52..681da9965 100644 --- a/src/Services/Catalog/Catalog.API/README.md +++ b/src/Services/Catalog/Catalog.API/README.md @@ -3,12 +3,12 @@ Sample reference containerized application, cross-platform and microservices arc Powered by Microsoft #Overview -This sample runs a microservices oriented application and a .net core Mvc application that consumes this services. You can find more information about how to set up docker in your machine in the global directory solution. +This sample runs a microservices oriented application and an ASP.NET Core MVC application that consumes these services. You can find more information about how to set up docker in your machine in the global directory solution. #Deploy -In the global directory you will find the scripts needed to run and deploy the demo into your local docker infraestructure. +In the global directory you will find the scripts needed to run and deploy the demo into your local docker infrastructure. -- build-image-services-catalog.ps1 Build .net applications and docker images: This power shell script that you will find in the root directory of the solution is the responsible of building .net applications and package in a pub folder and use docker commands to build the images needed to run the previously packaged .net applications. +- build-image-services-catalog.ps1 Build .net applications and docker images: This PowerShell script that you will find in the root directory of the solution is responsible for building .NET applications and package in a pub folder and use docker commands to build the images needed to run the previously packaged .NET applications. - Compose containers in your docker local VM: Finally you have to open your favourite command tool pointing to the root directory of this project where docker-compose.yml file is located and run the command `docker-compose up` diff --git a/src/Services/Catalog/Catalog.API/settings.cs b/src/Services/Catalog/Catalog.API/settings.cs index e73359302..76091c409 100644 --- a/src/Services/Catalog/Catalog.API/settings.cs +++ b/src/Services/Catalog/Catalog.API/settings.cs @@ -5,6 +5,7 @@ using System.Threading.Tasks; namespace Microsoft.eShopOnContainers.Services.Catalog.API { + // TODO: Rename CatalogSettings for consistency? public class Settings { public string ExternalCatalogBaseUrl {get;set;} diff --git a/src/Services/Ordering/Ordering.API/Application/Commands/CreateOrderCommandHandler.cs b/src/Services/Ordering/Ordering.API/Application/Commands/CreateOrderCommandHandler.cs index 27d828b9f..04f3bc3fd 100644 --- a/src/Services/Ordering/Ordering.API/Application/Commands/CreateOrderCommandHandler.cs +++ b/src/Services/Ordering/Ordering.API/Application/Commands/CreateOrderCommandHandler.cs @@ -9,11 +9,11 @@ public class CreateOrderCommandHandler : IAsyncRequestHandler { - private readonly IBuyerRepository _buyerRepository; - private readonly IOrderRepository _orderRepository; + private readonly IBuyerRepository _buyerRepository; + private readonly IOrderRepository _orderRepository; // Using DI to inject infrastructure persistence Repositories - public CreateOrderCommandHandler(IBuyerRepository buyerRepository, IOrderRepository orderRepository) + public CreateOrderCommandHandler(IBuyerRepository buyerRepository, IOrderRepository orderRepository) { _buyerRepository = buyerRepository ?? throw new ArgumentNullException(nameof(buyerRepository)); _orderRepository = orderRepository ?? throw new ArgumentNullException(nameof(orderRepository)); diff --git a/src/Services/Ordering/Ordering.API/Infrastructure/AutofacModules/ApplicationModule.cs b/src/Services/Ordering/Ordering.API/Infrastructure/AutofacModules/ApplicationModule.cs index b8bc98442..a953c2d2d 100644 --- a/src/Services/Ordering/Ordering.API/Infrastructure/AutofacModules/ApplicationModule.cs +++ b/src/Services/Ordering/Ordering.API/Infrastructure/AutofacModules/ApplicationModule.cs @@ -27,11 +27,11 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.Autof .InstancePerLifetimeScope(); builder.RegisterType() - .As() + .As>() .InstancePerLifetimeScope(); builder.RegisterType() - .As() + .As>() .InstancePerLifetimeScope(); } } diff --git a/src/Services/Ordering/Ordering.API/Startup.cs b/src/Services/Ordering/Ordering.API/Startup.cs index b0e4a67f2..539647514 100644 --- a/src/Services/Ordering/Ordering.API/Startup.cs +++ b/src/Services/Ordering/Ordering.API/Startup.cs @@ -45,7 +45,8 @@ services.AddMvc(options => { options.Filters.Add(typeof(HttpGlobalExceptionFilter)); - }).AddControllersAsServices(); //Controllers are also injected thru DI + }).AddControllersAsServices(); //Injecting Controllers themselves thru DI + //For further info see: http://docs.autofac.org/en/latest/integration/aspnetcore.html#controllers-as-services services.AddEntityFrameworkSqlServer() .AddDbContext(options => diff --git a/src/Services/Ordering/Ordering.Domain/AggregatesModel/BuyerAggregate/IBuyerRepository.cs b/src/Services/Ordering/Ordering.Domain/AggregatesModel/BuyerAggregate/IBuyerRepository.cs index ccd0efe39..2fdaaf29f 100644 --- a/src/Services/Ordering/Ordering.Domain/AggregatesModel/BuyerAggregate/IBuyerRepository.cs +++ b/src/Services/Ordering/Ordering.Domain/AggregatesModel/BuyerAggregate/IBuyerRepository.cs @@ -1,13 +1,12 @@ using Microsoft.eShopOnContainers.Services.Ordering.Domain.Seedwork; -using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate; using System.Threading.Tasks; namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate { //This is just the RepositoryContracts or Interface defined at the Domain Layer //as requisite for the Buyer Aggregate - public interface IBuyerRepository - :IAggregateRepository + + public interface IBuyerRepository : IRepository where T : IAggregateRoot { Buyer Add(Buyer buyer); diff --git a/src/Services/Ordering/Ordering.Domain/AggregatesModel/OrderAggregate/IOrderRepository.cs b/src/Services/Ordering/Ordering.Domain/AggregatesModel/OrderAggregate/IOrderRepository.cs index c16caa4a3..81869a457 100644 --- a/src/Services/Ordering/Ordering.Domain/AggregatesModel/OrderAggregate/IOrderRepository.cs +++ b/src/Services/Ordering/Ordering.Domain/AggregatesModel/OrderAggregate/IOrderRepository.cs @@ -1,11 +1,11 @@ using Microsoft.eShopOnContainers.Services.Ordering.Domain.Seedwork; namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate -{ +{ //This is just the RepositoryContracts or Interface defined at the Domain Layer //as requisite for the Order Aggregate - public interface IOrderRepository - :IAggregateRepository + + public interface IOrderRepository : IRepository where T : IAggregateRoot { Order Add(Order order); } diff --git a/src/Services/Ordering/Ordering.Domain/AggregatesModel/OrderAggregate/Order.cs b/src/Services/Ordering/Ordering.Domain/AggregatesModel/OrderAggregate/Order.cs index 3c856f09a..658f18967 100644 --- a/src/Services/Ordering/Ordering.Domain/AggregatesModel/OrderAggregate/Order.cs +++ b/src/Services/Ordering/Ordering.Domain/AggregatesModel/OrderAggregate/Order.cs @@ -7,7 +7,7 @@ using System.Linq; namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate { public class Order - : Entity + : Entity, IAggregateRoot { // DDD Patterns comment // Using private fields, allowed since EF Core 1.1, is a much better encapsulation diff --git a/src/Services/Ordering/Ordering.Domain/SeedWork/IAggregateRepository.cs b/src/Services/Ordering/Ordering.Domain/SeedWork/IRepository.cs similarity index 68% rename from src/Services/Ordering/Ordering.Domain/SeedWork/IAggregateRepository.cs rename to src/Services/Ordering/Ordering.Domain/SeedWork/IRepository.cs index c2983d290..3657ec092 100644 --- a/src/Services/Ordering/Ordering.Domain/SeedWork/IAggregateRepository.cs +++ b/src/Services/Ordering/Ordering.Domain/SeedWork/IRepository.cs @@ -1,6 +1,6 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.Seedwork { - public interface IAggregateRepository + public interface IRepository where T : IAggregateRoot { IUnitOfWork UnitOfWork { get; } } diff --git a/src/Services/Ordering/Ordering.Infrastructure/Repositories/BuyerRepository.cs b/src/Services/Ordering/Ordering.Infrastructure/Repositories/BuyerRepository.cs index 3a6bcede9..693717dac 100644 --- a/src/Services/Ordering/Ordering.Infrastructure/Repositories/BuyerRepository.cs +++ b/src/Services/Ordering/Ordering.Infrastructure/Repositories/BuyerRepository.cs @@ -8,7 +8,7 @@ using System.Threading.Tasks; namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Repositories { public class BuyerRepository - : IBuyerRepository + : IBuyerRepository { private readonly OrderingContext _context; diff --git a/src/Services/Ordering/Ordering.Infrastructure/Repositories/OrderRepository.cs b/src/Services/Ordering/Ordering.Infrastructure/Repositories/OrderRepository.cs index 89a63e028..ecdc705dd 100644 --- a/src/Services/Ordering/Ordering.Infrastructure/Repositories/OrderRepository.cs +++ b/src/Services/Ordering/Ordering.Infrastructure/Repositories/OrderRepository.cs @@ -5,7 +5,7 @@ using System; namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Repositories { public class OrderRepository - : IOrderRepository + : IOrderRepository { private readonly OrderingContext _context; diff --git a/test/Services/UnitTest/Ordering/Application/NewOrderCommandHandlerTest.cs b/test/Services/UnitTest/Ordering/Application/NewOrderCommandHandlerTest.cs index 0d219d594..9582a137c 100644 --- a/test/Services/UnitTest/Ordering/Application/NewOrderCommandHandlerTest.cs +++ b/test/Services/UnitTest/Ordering/Application/NewOrderCommandHandlerTest.cs @@ -11,14 +11,14 @@ namespace UnitTest.Ordering.Application { public class NewOrderRequestHandlerTest { - private readonly Mock _buyerRepositoryMock; - private readonly Mock _orderRepositoryMock; + private readonly Mock> _buyerRepositoryMock; + private readonly Mock> _orderRepositoryMock; public NewOrderRequestHandlerTest() { - _buyerRepositoryMock = new Mock(); - _orderRepositoryMock = new Mock(); + _buyerRepositoryMock = new Mock>(); + _orderRepositoryMock = new Mock>(); } [Fact]