Get the App
SLTechnology News&Howtos  ›  Development  › 

How to realize the Management Framework of ASP.NET MVC5 website Development articles

Shulou Source: shulou.com Published: 2022-06-03 09:03:39 09月29日 Update

This article mainly explains "how to achieve the ASP.NET MVC5 website development article management architecture". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to achieve the ASP.NET MVC5 website development article management architecture".

I. General explanation

First, take a look at the functions that the article management envisages to achieve:

Take another look at the class diagram.

Here Category is the column; CommonModel is the common model; Article is the article; Attachment is the attachment

CommonModel is the public part extracted from the content management area. Articles, consultants, and even products all have something in common. Here, it is extracted separately as a class. The CommonModel may contain a piece of article, a set of attachments, and a series of comments that are already shown in the class diagram of the relationship between them.

Second, set up the structure

This order is the same as before.

1 、 IDAL

Adding the interface InterfaceCommonModelRepository to IDAL only inherits from InterfaceBaseRepository and does not add anything else.

Namespace Ninesky.IDAL {/ Common Model Interface / create: 2014.02.23 / modify: 2014.02.28 / public interface InterfaceCommonModelRepository:InterfaceBaseRepository {}}

Then add InterfaceCategory,InterfaceArticle,InterfaceAttachment in the same way as the common model interface.

2 、 DAL

Whether to implement the IDAL interface in DAL, or to start with CommonModel and add CommonModelRepository first, there is no code to inherit directly as before.

Namespace Ninesky.DAL {/ Public model repository / create: 2014.02.23 / public class CommonModelRepository:BaseRepository, IDAL.InterfaceCommonModel {}}

Then add CategoryRepository,ArticleRepository,AttachmentRepository in turn.

3.IBLL

This time let's start with InterfaceCategoryService, InterfaceArticleService,InterfaceCommentService,InterfaceAttachmentService. Most of the contents of InterfaceCommonModelService are put at the end.

InterfaceCategoryService

The specific functions will be written when you do the column, which is temporarily vacant.

Namespace Ninesky.IBLL {/ column service interface / create: 2014.02.23 / public class InterfaceCategoryService:InterfaceBaseService {}}

4.BLL

Again, start with CategoryService, and then add ArticleService,AttachmentService in turn. CommonModelService .

Using Ninesky.DAL;using Ninesky.IBLL;using Ninesky.Models;using System;using System.Collections.Generic;using System.Linq;namespace Ninesky.BLL {/ column service / create: 2014.02.27 / public class CategoryService:BaseService,InterfaceCategoryService {public CategoryService (): base (RepositoryFactory.CategoryRepository) {}

5 、 Web

Add three empty controllers under the Member area of the web project.

Column controller CategoryController

Using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.Mvc;using Ninesky.IBLL;using Ninesky.BLL; using Ninesky.Models;namespace Ninesky.Web.Areas.Member.Controllers {[Authorize] public class CategoryController: Controller {private InterfaceCategoryService categoryRepository; public CategoryController () {categoryRepository = new CategoryService ();}

Article Controller ArticleController

Using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.Mvc;using Ninesky.Models;using Ninesky.IBLL;using Ninesky.BLL;namespace Ninesky.Web.Areas.Member.Controllers {public class ArticleController: Controller {private InterfaceArticleService articleService; private InterfaceCommonModelService commonModelService; public ArticleController () {articleService = new ArticleService (); commonModelService = new CommonModelService ();}

Accessory controller AttachmentController

Using System;using System.Collections.Generic;using System.Linq;using System.Collections;using System.Web;using System.Web.Mvc;using System.IO;using Ninesky.IBLL;using Ninesky.BLL;using Ninesky.Models Namespace Ninesky.Web.Areas.Member.Controllers {/ attachment controller / [Authorize] public class AttachmentController: Controller {}} Thank you for reading. This is the content of "how to implement the ASP.NET MVC5 website development article management architecture". After the study of this article I believe that you have a deeper understanding of how to achieve the ASP.NET MVC5 website development article management architecture, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Tags: Article management content architecture interface controller column control website development development model attachment learning function service same three between products Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB Docker Apple Xiaomi NVidia