//Leaving in for backwards compatibility public static Voat.Data.Models.Subverse Retrieve(string subverse) { if (!String.IsNullOrEmpty(subverse)) { var q = new QuerySubverse(subverse); var sub = q.Execute(); return(sub); } return(null); }
protected override object GetMissingValue(string name) { switch (name) { case "Subverse": if (SubmissionID != null) { var cmd = new QuerySubmission(SubmissionID.Value); var submission = cmd.Execute(); PropertyBag.Submission = submission; var cmdSubverse = new QuerySubverse(submission.Subverse); var subverse = cmdSubverse.Execute(); return(subverse); } if (CommentID != null) { var cmdComment = new QueryComment(CommentID.Value); var comment = cmdComment.Execute(); PropertyBag.Comment = comment; var cmd = new QuerySubmission(comment.SubmissionID.Value); var submission = cmd.Execute(); PropertyBag.Submission = submission; var cmdSubverse = new QuerySubverse(submission.Subverse); var subverse = cmdSubverse.Execute(); return(subverse); } break; } return(base.GetMissingValue(name)); }
protected override object GetMissingValue(string name) { //TODO: This lazy loading needs to be optimized and rewritten. I. Don't. Like. This. switch (name) { case "Comment": if (CommentID != null) { var cmdComment = new QueryComment(CommentID.Value); var comment = cmdComment.Execute(); PropertyBag.Comment = comment; return(comment); } break; case "Submission": if (SubmissionID != null) { var cmd = new QuerySubmission(SubmissionID.Value); var submission = cmd.Execute(); return(submission); } if (CommentID != null) { var cmdComment = new QueryComment(CommentID.Value); var comment = cmdComment.Execute(); PropertyBag.Comment = comment; var cmd = new QuerySubmission(comment.SubmissionID.Value); var submission = cmd.Execute(); return(submission); } break; case "Subverse": if (SubmissionID != null) { var cmd = new QuerySubmission(SubmissionID.Value); var submission = cmd.Execute(); PropertyBag.Submission = submission; var cmdSubverse = new QuerySubverse(submission.Subverse); var subverse = cmdSubverse.Execute(); return(subverse); } if (CommentID != null) { var cmdComment = new QueryComment(CommentID.Value); var comment = cmdComment.Execute(); PropertyBag.Comment = comment; var cmd = new QuerySubmission(comment.SubmissionID.Value); var submission = cmd.Execute(); PropertyBag.Submission = submission; var cmdSubverse = new QuerySubverse(submission.Subverse); var subverse = cmdSubverse.Execute(); return(subverse); } break; } return(base.GetMissingValue(name)); }