Minor refactoring and docs updates
This commit is contained in:
parent
2babf6e4fe
commit
42501a5a0b
@ -1,5 +1,8 @@
|
|||||||
# eShopOnContainers - Microservices Architecture and Containers based Reference Application (**ALPHA state**)
|
# eShopOnContainers - Microservices Architecture and Containers based Reference Application (**ALPHA state**)
|
||||||
Sample .NET Core reference application, powered by Microsoft, based on a simplified microservices architecture and Docker containers. <p>It is cross-platform either in the server and client side, thanks to .NET Core services capable of running on Linux or Windows containers depending on your Docker host, and to Xamarin for mobile apps running on Android, iOS or Windows/UWP plus any browser for the client web apps.
|
Sample .NET Core reference application, powered by Microsoft, based on a simplified microservices architecture and Docker containers. <p>
|
||||||
|
<b>DISCLAIMER: This reference application proposes a simplified microservice oriented architecture implementation (currently in ALPHA state) to introduce technologies like .NET Core with Docker containers and a comprehensive but easy to get started approach. However, this reference application it is not trying to solve all the complexities in a large and mission-critical distributed system. </b>
|
||||||
|
<p>
|
||||||
|
This reference application is cross-platform either in the server and client side, thanks to .NET Core services capable of running on Linux or Windows containers depending on your Docker host, and to Xamarin for mobile apps running on Android, iOS or Windows/UWP plus any browser for the client web apps.
|
||||||
|
|
||||||
<img src="img/eshop_logo.png">
|
<img src="img/eshop_logo.png">
|
||||||
<img src="img/eShopOnContainers_Architecture_Diagram.png">
|
<img src="img/eShopOnContainers_Architecture_Diagram.png">
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 402 KiB After Width: | Height: | Size: 428 KiB |
@ -14,7 +14,7 @@
|
|||||||
:IAsyncRequest<bool>
|
:IAsyncRequest<bool>
|
||||||
{
|
{
|
||||||
//(CDLTLL) TO DO: This is wrong, we must NOT use a child-entity class (OrderItem) within a Command class!!
|
//(CDLTLL) TO DO: This is wrong, we must NOT use a child-entity class (OrderItem) within a Command class!!
|
||||||
//Need to create a different DTO class, like OrderLineDTO or similar...
|
//Need to create a different DTO class, like OrderLineData or similar within the CreateOrderCommand class...
|
||||||
private readonly List<OrderItem> _orderItems;
|
private readonly List<OrderItem> _orderItems;
|
||||||
public string City { get; set; }
|
public string City { get; set; }
|
||||||
|
|
||||||
|
@ -3,6 +3,8 @@ using System.Collections.Generic;
|
|||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Models
|
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Models
|
||||||
{
|
{
|
||||||
|
//TO DO: Confirm if this class is not needed, if not, remove it
|
||||||
|
//(CDLTLL)
|
||||||
public class NewOrderViewModel
|
public class NewOrderViewModel
|
||||||
{
|
{
|
||||||
public string ShippingCity { get; set; }
|
public string ShippingCity { get; set; }
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Models
|
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Models
|
||||||
{
|
{
|
||||||
|
//TO DO: Confirm if this class is not needed, if not, remove it
|
||||||
|
//(CDLTLL)
|
||||||
public class OrderItemViewModel
|
public class OrderItemViewModel
|
||||||
{
|
{
|
||||||
public int ProductId { get; set; }
|
public int ProductId { get; set; }
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
|
||||||
|
REFACTORING TO DO:
|
||||||
|
//TO DO: Confirm if these ViewModel classes are still needed, if not, remove it
|
||||||
|
//and remove the related Unit Tests
|
||||||
|
//(CDLTLL)
|
@ -52,11 +52,28 @@
|
|||||||
ShippingAddress = address;
|
ShippingAddress = address;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TO DO:
|
||||||
|
// (CDLTLL) Bad implementation, needs to be changed.
|
||||||
|
// The AddOrderItem should have the needed data params
|
||||||
|
// instead of an already created OrderItem object.
|
||||||
|
// The Aggregate-Root is responsible for any Update/Creation of its child entities
|
||||||
|
// If we are providing an already created OrderItem, that was created from the outside
|
||||||
|
// and the AggregateRoot cannot control/validate any rule/invariants/consistency.
|
||||||
public void AddOrderItem(OrderItem item)
|
public void AddOrderItem(OrderItem item)
|
||||||
{
|
{
|
||||||
// Note: Some logic could be added here (like grouping items in one single OrderItem)
|
//TO DO: Bad implementation, need to change.
|
||||||
// Also validation logic could be added here (like ensuring adding almost one item)
|
// The code "new OrderItem(params);" should be done here
|
||||||
|
// Plus any validation/rule related
|
||||||
OrderItems.Add(item);
|
OrderItems.Add(item);
|
||||||
|
|
||||||
|
//(CDLTLL)
|
||||||
|
// TO DO: Some more logic needs to be added here,
|
||||||
|
// Like consolidating items that are the same product in one single OrderItem with several units
|
||||||
|
// Also validation logic could be added here (like ensuring it is adding at least one item unit)
|
||||||
|
|
||||||
|
//Or, If there are different amounts of discounts per added OrderItem
|
||||||
|
//but the product Id is the same to existing Order Items, you should
|
||||||
|
//apply the higher discount, or any other domain logic that makes sense.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,11 @@
|
|||||||
{
|
{
|
||||||
using Microsoft.eShopOnContainers.Services.Ordering.Domain.SeedWork;
|
using Microsoft.eShopOnContainers.Services.Ordering.Domain.SeedWork;
|
||||||
|
|
||||||
|
//TO DO:
|
||||||
|
//(CDLTLL) Wrong implementation. Need to put Setters as private
|
||||||
|
// and only be able to update the OrderItem through specific methods, if needed, so we can
|
||||||
|
// have validations/control/logic in those "update or set methods".
|
||||||
|
//We also need to have a constructor with the needed params, we must not use the "setters"..
|
||||||
public class OrderItem
|
public class OrderItem
|
||||||
:Entity
|
:Entity
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user