Suppose I have a Comment class having properties and their methods like
public Comment GetComment(Guid id)
And
public static List<Comment> GetComments()
public static List<Comment> GetCommentsByAuthor(Author id)
Now, What I usually do is write the database logic for each of the above methods . That said, Now I am seeing BlogEngine.NET code and He wrote in this way; He wrote the Database logic for GetComments() method and extracted from it for all remaining methods, even for GetComment(Guid id) by using something like
//FindAll is a method in List<T> class
FindAll(delegate(Comment comment)
{
return comment.Author.Equals(author ,
StringComparison.OrdinalIgnoreCase);
}
);
My question is, is it a good idea to do it in this way rather than the first approach? Any pros and cons of this way and suggestions and pointers and resources are most welcome. TIA Srinivas