public void Publish() { if (enabled == false) { throw new DomainException("The blog is disabled. Enable this before making any changes."); } if (published == true) { throw new DomainException("The post is already published."); } Raise(PostPublishedDomainEvent.Create(this)); }
protected void When(PostPublishedDomainEvent @event) { published = true; }