I have recently been reading an article about creating a blog using ASP.NET and MVC, and in the article the user splits the Data Access Layer into a separate Class Library, and creates an interface for this to allow the DAL to be mocked for testing.
This works great for small projects, but I am struggling to see how this will scale. For example in the article you end up with the following Interface:
public interface IBlogRepository
{
IList<Objects.Post> Posts(int pageNo, int pageSize);
int TotalPosts(bool checkIsPublished = true);
IList<Objects.Post> PostsForCategory(string categorySlug, int pageNo, int pageSize);
int TotalPostsForCategory(string categorySlug);
Objects.Category Category(string categorySlug);
IList<Objects.Post> PostsForTag(string tagSlug, int pageNo, int pageSize);
int TotalPostsForTag(string tagSlug);
Objects.Tag Tag(string tagSlug);
IList<Objects.Post> PostsForSearch(string search, int pageNo, int pageSize);
int TotalPostsForSearch(string search);
Objects.Post Post(int year, int month, string titleSlug);
IList<Objects.Category> Categories();
IList<Objects.Tag> Tags();
IList<Objects.Post> Posts(int pageNo, int pageSize, string sortColumn, bool sortByAscending);
void AddPost(Objects.Post post);
}
There is then an associated .cs file with the implementation of this interface.
How would you implement a similar architecture for a much larger project? For example the project I have at work consists of 25 controllers, each having as a minimum list, add, edit, view, delete and count. That would lead to an interface with 150+ functions.
Is this kind of architecture still suitable for larger projects, and if so how would you structure this to avoid having a single file implementing 150+ functions?