Skip to content

Instantly share code, notes, and snippets.

@dcomartin
Created Oct 20, 2021
Embed
What would you like to do?
using System;
using ValueObject;
namespace ValueObject3
{
public record PlaceOrderCommand(Guid CustomerId, string ProductSku, int Quantity, PlaceOrderCurrency Currency)
{
public PlaceOrderCommand(Guid customerId, string productSku)
: this(customerId, productSku, 1, PlaceOrderCurrency.Default) { }
public PlaceOrderCommand(Guid customerId, string productSku, Currency currency)
: this(customerId, productSku, 1, new PlaceOrderCurrency(currency.Symbol)) { }
public PlaceOrderCommand(Guid customerId, string productSku, int quantity)
: this(customerId, productSku, quantity, PlaceOrderCurrency.Default) { }
}
public record PlaceOrderCurrency(string Symbol)
{
public static PlaceOrderCurrency Default => new("USD");
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment