Skip to content

Commit 42501a5

Browse files
Minor refactoring and docs updates
1 parent 2babf6e commit 42501a5

8 files changed

Lines changed: 38 additions & 5 deletions

File tree

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# eShopOnContainers - Microservices Architecture and Containers based Reference Application (**ALPHA state**)
2-
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.
2+
Sample .NET Core reference application, powered by Microsoft, based on a simplified microservices architecture and Docker containers. <p>
3+
<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>
4+
<p>
5+
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.
36

47
<img src="img/eshop_logo.png">
58
<img src="img/eShopOnContainers_Architecture_Diagram.png">
26 KB
Loading

src/Services/Ordering/Ordering.API/Application/Commands/CreateOrderCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public class CreateOrderCommand
1414
:IAsyncRequest<bool>
1515
{
1616
//(CDLTLL) TO DO: This is wrong, we must NOT use a child-entity class (OrderItem) within a Command class!!
17-
//Need to create a different DTO class, like OrderLineDTO or similar...
17+
//Need to create a different DTO class, like OrderLineData or similar within the CreateOrderCommand class...
1818
private readonly List<OrderItem> _orderItems;
1919
public string City { get; set; }
2020

src/Services/Ordering/Ordering.API/Models/NewOrderViewModel.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Models
55
{
6+
//TO DO: Confirm if this class is not needed, if not, remove it
7+
//(CDLTLL)
68
public class NewOrderViewModel
79
{
810
public string ShippingCity { get; set; }

src/Services/Ordering/Ordering.API/Models/OrderItemViewModel.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Models
22
{
3+
//TO DO: Confirm if this class is not needed, if not, remove it
4+
//(CDLTLL)
35
public class OrderItemViewModel
46
{
57
public int ProductId { get; set; }
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+

2+
REFACTORING TO DO:
3+
//TO DO: Confirm if these ViewModel classes are still needed, if not, remove it
4+
//and remove the related Unit Tests
5+
//(CDLTLL)

src/Services/Ordering/Ordering.Domain/AggregatesModel/OrderAggregate/Order.cs

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,28 @@ public void SetAddress(Address address)
5252
ShippingAddress = address;
5353
}
5454

55+
//TO DO:
56+
// (CDLTLL) Bad implementation, needs to be changed.
57+
// The AddOrderItem should have the needed data params
58+
// instead of an already created OrderItem object.
59+
// The Aggregate-Root is responsible for any Update/Creation of its child entities
60+
// If we are providing an already created OrderItem, that was created from the outside
61+
// and the AggregateRoot cannot control/validate any rule/invariants/consistency.
5562
public void AddOrderItem(OrderItem item)
5663
{
57-
// Note: Some logic could be added here (like grouping items in one single OrderItem)
58-
// Also validation logic could be added here (like ensuring adding almost one item)
64+
//TO DO: Bad implementation, need to change.
65+
// The code "new OrderItem(params);" should be done here
66+
// Plus any validation/rule related
5967
OrderItems.Add(item);
68+
69+
//(CDLTLL)
70+
// TO DO: Some more logic needs to be added here,
71+
// Like consolidating items that are the same product in one single OrderItem with several units
72+
// Also validation logic could be added here (like ensuring it is adding at least one item unit)
73+
74+
//Or, If there are different amounts of discounts per added OrderItem
75+
//but the product Id is the same to existing Order Items, you should
76+
//apply the higher discount, or any other domain logic that makes sense.
6077
}
6178
}
6279
}

src/Services/Ordering/Ordering.Domain/AggregatesModel/OrderAggregate/OrderItem.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22
{
33
using Microsoft.eShopOnContainers.Services.Ordering.Domain.SeedWork;
44

5-
5+
//TO DO:
6+
//(CDLTLL) Wrong implementation. Need to put Setters as private
7+
// and only be able to update the OrderItem through specific methods, if needed, so we can
8+
// have validations/control/logic in those "update or set methods".
9+
//We also need to have a constructor with the needed params, we must not use the "setters"..
610
public class OrderItem
711
:Entity
812
{

0 commit comments

Comments
 (0)