Skip to content

Instantly share code, notes, and snippets.

@cbcwebdev
Created May 20, 2012 18:40
Show Gist options
  • Save cbcwebdev/2759099 to your computer and use it in GitHub Desktop.
Save cbcwebdev/2759099 to your computer and use it in GitHub Desktop.
TCOT base comain class
public abstract class Story : AggregateBase
{
private readonly ISet<Vote> _votes = new HashSet<Vote>();
private readonly ISet<Commentary> _comments = new HashSet<Commentary>();
private readonly ISet<Relevancy> _relevancies = new HashSet<Relevancy>();
protected Story()
{ }
public virtual Relevancy Relate(Story story, User contributor, RelevancyScore score)
{
// construct relevancy
var relevancy = RelevancyFactory.Create(this, story, contributor, score);
// tally relevancy against story
_relevancies.Add(relevancy);
// pass vote back to client
return relevancy;
}
public virtual Vote Vote(User contributor, VoteScore score)
{
// construct vote
var vote = VoteFactory.Create(this, contributor, score);
// tally vote against story
_votes.Add(vote);
// pass vote back to client
return vote;
}
public virtual Commentary Comment(User contributor, CommentaryDetail detail)
{
// construct comment
var comment = CommentaryFactory.Create(this, contributor, detail);
// tally comment against story
_comments.Add(comment);
// pass comment back to client
return comment;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment