protected override Contest GetItemFromDataReader(IDataReader reader) { int id = Convert.ToInt32(reader.GetColumnValue(ID)); string name = reader.GetColumnValue(NAME).ToString(); string timeKeeperId = reader.GetColumnValue(TIME_KEEPER_ID).ToString(); long? maxDurationTicks = reader.GetColumnValue(MAX_DURATION) as long?; TimeSpan maxDuration = new TimeSpan((maxDurationTicks ?? 0)); string description = reader.GetColumnValue(DESCRIPTION).ToString(); string status = reader.GetColumnValue(STATUS).ToString(); Contest contest = new Contest(id, name, description, timeKeeperId, maxDuration, status); var contestants = new ContestantRepo().GetWhereParentForeignKeyIs(contest.Id); foreach (var contestant in contestants) { contest.Contestants.Add(contestant); } var judges = new JudgeRepo().GetWhereParentForeignKeyIs(contest.Id); foreach (var judge in judges) { contest.Judges.Add(judge); } var contestScoreCardCollection = new ContestScoreCardRepo().GetWhereForeignKeyIs(contest.Id); var scoreCardRepo = new ScoreCardRepo(); foreach (var sc in contestScoreCardCollection) { if (scoreCardRepo.Exists(sc.ScoreCardId)) { contest.ScoreCards.Add(scoreCardRepo.Get(sc.ScoreCardId)); } } var scoreCriteria = new ScoreCriterionRepo().GetWhereParentForeignKeyIs(contest.Id); foreach (var scoreCriterion in scoreCriteria) { contest.ScoreCriteria.Add(scoreCriterion); } return(contest); }