Skip to content

Instantly share code, notes, and snippets.

@dcomartin
Created October 20, 2021 21:18
Show Gist options
  • Save dcomartin/c07bbe8bfb4a1bd316afd6b81a302a25 to your computer and use it in GitHub Desktop.
Save dcomartin/c07bbe8bfb4a1bd316afd6b81a302a25 to your computer and use it in GitHub Desktop.
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