Skip to content

Instantly share code, notes, and snippets.

@ankitvijay

ankitvijay/Order.cs

Last active May 15, 2020
Embed
What would you like to do?
DDD Example - Version 3
public class Order
{
private List<OrderItem> _orderItems;
public Order()
{
_orderItems = new List<OrderItem>();
}
public IReadOnlyCollection<OrderItem> OrderItems
{
get => _orderItems.ToImmutableList();
private set => _orderItems = value.ToList();
}
public void AddOrderItem(OrderItem orderItem)
{
_orderItems.Add(orderItem);
}
public void RemoveOrderItem(OrderItem orderItem)
{
_orderItems.Add(orderItem);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.