Merge branch 'vs2017' of https://github.com/dotnet/eShopOnContainers into vs2017
This commit is contained in:
commit
b4162035f9
@ -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("/")]
|
||||
|
@ -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.
|
||||
|
||||
- <a href='build-image-services-basket.ps1'>build-image-services-basket.ps1</a> <b>Build .net applications and docker images</b>: This power shell script that you will find in the <u>root directory of the solution</u> 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.
|
||||
- <a href='build-image-services-basket.ps1'>build-image-services-basket.ps1</a> <b>Build .net applications and docker images</b>: This PowerShell script that you will find in the <u>root directory of the solution</u> 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.
|
||||
|
||||
- <b>Compose containers in your docker local VM</b>: Finally you have to open your favourite command tool pointing to the <u>root directory of this project</u> where docker-compose.yml file is located and run the command `docker-compose up`
|
||||
- <b>Compose containers in your docker local VM</b>: Finally you have to open your favorite command tool pointing to the <u>root directory of this project</u> 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
|
||||
|
@ -37,9 +37,9 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
|
||||
services.AddMvc();
|
||||
services.Configure<BasketSettings>(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.
|
||||
|
@ -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.
|
||||
|
||||
- <a href='build-image-services-catalog.ps1'>build-image-services-catalog.ps1</a> <b>Build .net applications and docker images</b>: This power shell script that you will find in the <u>root directory of the solution</u> 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.
|
||||
- <a href='build-image-services-catalog.ps1'>build-image-services-catalog.ps1</a> <b>Build .net applications and docker images</b>: This PowerShell script that you will find in the <u>root directory of the solution</u> 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.
|
||||
|
||||
- <b>Compose containers in your docker local VM</b>: Finally you have to open your favourite command tool pointing to the <u>root directory of this project</u> where docker-compose.yml file is located and run the command `docker-compose up`
|
||||
|
||||
|
@ -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;}
|
||||
|
@ -9,11 +9,11 @@
|
||||
public class CreateOrderCommandHandler
|
||||
: IAsyncRequestHandler<CreateOrderCommand, bool>
|
||||
{
|
||||
private readonly IBuyerRepository _buyerRepository;
|
||||
private readonly IOrderRepository _orderRepository;
|
||||
private readonly IBuyerRepository<Buyer> _buyerRepository;
|
||||
private readonly IOrderRepository<Order> _orderRepository;
|
||||
|
||||
// Using DI to inject infrastructure persistence Repositories
|
||||
public CreateOrderCommandHandler(IBuyerRepository buyerRepository, IOrderRepository orderRepository)
|
||||
public CreateOrderCommandHandler(IBuyerRepository<Buyer> buyerRepository, IOrderRepository<Order> orderRepository)
|
||||
{
|
||||
_buyerRepository = buyerRepository ?? throw new ArgumentNullException(nameof(buyerRepository));
|
||||
_orderRepository = orderRepository ?? throw new ArgumentNullException(nameof(orderRepository));
|
||||
|
@ -27,11 +27,11 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.Autof
|
||||
.InstancePerLifetimeScope();
|
||||
|
||||
builder.RegisterType<BuyerRepository>()
|
||||
.As<IBuyerRepository>()
|
||||
.As<IBuyerRepository<Buyer>>()
|
||||
.InstancePerLifetimeScope();
|
||||
|
||||
builder.RegisterType<OrderRepository>()
|
||||
.As<IOrderRepository>()
|
||||
.As<IOrderRepository<Order>>()
|
||||
.InstancePerLifetimeScope();
|
||||
}
|
||||
}
|
||||
|
@ -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<OrderingContext>(options =>
|
||||
|
@ -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<T> : IRepository<T> where T : IAggregateRoot
|
||||
{
|
||||
Buyer Add(Buyer buyer);
|
||||
|
||||
|
@ -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<T> : IRepository<T> where T : IAggregateRoot
|
||||
{
|
||||
Order Add(Order order);
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -1,6 +1,6 @@
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.Seedwork
|
||||
{
|
||||
public interface IAggregateRepository
|
||||
public interface IRepository<T> where T : IAggregateRoot
|
||||
{
|
||||
IUnitOfWork UnitOfWork { get; }
|
||||
}
|
@ -8,7 +8,7 @@ using System.Threading.Tasks;
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Repositories
|
||||
{
|
||||
public class BuyerRepository
|
||||
: IBuyerRepository
|
||||
: IBuyerRepository<Buyer>
|
||||
{
|
||||
private readonly OrderingContext _context;
|
||||
|
||||
|
@ -5,7 +5,7 @@ using System;
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Repositories
|
||||
{
|
||||
public class OrderRepository
|
||||
: IOrderRepository
|
||||
: IOrderRepository<Order>
|
||||
{
|
||||
private readonly OrderingContext _context;
|
||||
|
||||
|
@ -11,14 +11,14 @@ namespace UnitTest.Ordering.Application
|
||||
{
|
||||
public class NewOrderRequestHandlerTest
|
||||
{
|
||||
private readonly Mock<IBuyerRepository> _buyerRepositoryMock;
|
||||
private readonly Mock<IOrderRepository> _orderRepositoryMock;
|
||||
private readonly Mock<IBuyerRepository<Buyer>> _buyerRepositoryMock;
|
||||
private readonly Mock<IOrderRepository<Order>> _orderRepositoryMock;
|
||||
|
||||
public NewOrderRequestHandlerTest()
|
||||
{
|
||||
|
||||
_buyerRepositoryMock = new Mock<IBuyerRepository>();
|
||||
_orderRepositoryMock = new Mock<IOrderRepository>();
|
||||
_buyerRepositoryMock = new Mock<IBuyerRepository<Buyer>>();
|
||||
_orderRepositoryMock = new Mock<IOrderRepository<Order>>();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
Loading…
x
Reference in New Issue
Block a user