Skip to content

Instantly share code, notes, and snippets.

@dcomartin
Last active April 4, 2016 21:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dcomartin/a776c018fed567a96fda087719bb0f0b to your computer and use it in GitHub Desktop.
Save dcomartin/a776c018fed567a96fda087719bb0f0b to your computer and use it in GitHub Desktop.
public abstract class AggregateRoot
{
private IList<Guid> Operations { get; } = new List<Guid>();
public void SetOperation(Guid operationId)
{
if (Operations.Contains(operationId)) throw new InvalidOperationException("Duplicate Operation.");
Operations.Add(operationId);
}
}
public class Customer : AggregateRoot
{
private Guid _customerId;
private string _name;
private Region _region;
private bool _active;
private PricingLevel _pricingLevel;
public void ChangePricingLevel(PricingLevel pricingLevel)
{
_pricingLevel = pricingLevel;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment