Browse Source

Minor refactoring and docs updates

pull/49/merge
CESARDELATORRE 8 years ago
parent
commit
42501a5a0b
8 changed files with 38 additions and 5 deletions
  1. +4
    -1
      README.md
  2. BIN
      img/eShopOnContainers_Architecture_Diagram.png
  3. +1
    -1
      src/Services/Ordering/Ordering.API/Application/Commands/CreateOrderCommand.cs
  4. +2
    -0
      src/Services/Ordering/Ordering.API/Models/NewOrderViewModel.cs
  5. +2
    -0
      src/Services/Ordering/Ordering.API/Models/OrderItemViewModel.cs
  6. +5
    -0
      src/Services/Ordering/Ordering.API/Models/_REFACTORING TO DO - Remove ViewModel classes.txt
  7. +19
    -2
      src/Services/Ordering/Ordering.Domain/AggregatesModel/OrderAggregate/Order.cs
  8. +5
    -1
      src/Services/Ordering/Ordering.Domain/AggregatesModel/OrderAggregate/OrderItem.cs

+ 4
- 1
README.md View File

@ -1,5 +1,8 @@
# 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/eShopOnContainers_Architecture_Diagram.png">


BIN
img/eShopOnContainers_Architecture_Diagram.png View File

Before After
Width: 2262  |  Height: 1273  |  Size: 402 KiB Width: 2034  |  Height: 1078  |  Size: 428 KiB

+ 1
- 1
src/Services/Ordering/Ordering.API/Application/Commands/CreateOrderCommand.cs View File

@ -14,7 +14,7 @@
:IAsyncRequest<bool>
{
//(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;
public string City { get; set; }


+ 2
- 0
src/Services/Ordering/Ordering.API/Models/NewOrderViewModel.cs View File

@ -3,6 +3,8 @@ using System.Collections.Generic;
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 string ShippingCity { get; set; }


+ 2
- 0
src/Services/Ordering/Ordering.API/Models/OrderItemViewModel.cs View File

@ -1,5 +1,7 @@
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 int ProductId { get; set; }


+ 5
- 0
src/Services/Ordering/Ordering.API/Models/_REFACTORING TO DO - Remove ViewModel classes.txt View File

@ -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)

+ 19
- 2
src/Services/Ordering/Ordering.Domain/AggregatesModel/OrderAggregate/Order.cs View File

@ -52,11 +52,28 @@
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)
{
// Note: Some logic could be added here (like grouping items in one single OrderItem)
// Also validation logic could be added here (like ensuring adding almost one item)
//TO DO: Bad implementation, need to change.
// The code "new OrderItem(params);" should be done here
// Plus any validation/rule related
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.
}
}
}

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

@ -2,7 +2,11 @@
{
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
:Entity
{


Loading…
Cancel
Save