From a07bb18dca9f591e95b37bfb9a2ccc7572533a9a Mon Sep 17 00:00:00 2001 From: Cesar De la Torre Date: Mon, 27 Feb 2017 21:05:28 -0800 Subject: [PATCH] Added some comments about immutability Commands --- .../Application/Commands/CreateOrderCommand.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Services/Ordering/Ordering.API/Application/Commands/CreateOrderCommand.cs b/src/Services/Ordering/Ordering.API/Application/Commands/CreateOrderCommand.cs index 389d23119..3bcb2425b 100644 --- a/src/Services/Ordering/Ordering.API/Application/Commands/CreateOrderCommand.cs +++ b/src/Services/Ordering/Ordering.API/Application/Commands/CreateOrderCommand.cs @@ -5,6 +5,15 @@ using System.Runtime.Serialization; namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands { + // DDD and CQRS patterns comment: Note that it is recommened to implement immutable Commands + // In this case, its immutability is achieved by having all the setters as private + // plus only being able to update the data just once, when creating the object through its constructor. + // References on Immutable Commands: + // http://cqrs.nu/Faq + // https://docs.spine3.org/motivation/immutability.html + // http://blog.gauffin.org/2012/06/griffin-container-introducing-command-support/ + // https://msdn.microsoft.com/en-us/library/bb383979.aspx + [DataContract] public class CreateOrderCommand :IAsyncRequest