Last active
October 13, 2019 20:13
-
-
Save MarcoNicolodi/5d8f0b0d7487076cf4a0bcf9e432090a to your computer and use it in GitHub Desktop.
Proposal aggregate root relationship with Comment entity
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Proposal | |
{ | |
private List<Comments> _comments; | |
public ReadOnlyList<Comments> Comments => _comments.AsReadOnly(); | |
public void Discuss(Guid userId, string content) | |
{ | |
if(Status != ProposalStatus.Pending) | |
throw new DomainException("Can't discuss about an closed proposal"); | |
_comments.Add(new Comment(Id, userId, content)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment