MVC Controller with Warehouse design

Source: Internet
Author: User

In order to develop the MVC project more efficiently, we have the controller in a single package, which allows the controller to get a good inheritance relationship, and can be less

Code to implement the development of Web projects, the entire controller design ideas are as follows.

as you can see from the design, I put the crud methods, which are mainly through the abstract encapsulation, into the Repocontroller<tentity> class,

This article continues to detail the CRUD implementation of this web framework controller class to give you an idea of how the base class controller for the entire Web development framework works.
The specific code for using the default warehouse is as follows:

public class Userscontroller:repocontroller<user>

{

Public Userscontroller ()

{

Base. Bundle = Bundleactivator.bundle;

}

}


Basecontroller's design:

The main solution is the JSON date problem, and some common function functions.

The package of the jump page.

Verify the login.

Warehouse controller base class design:

Design of controller permissions:

Add the following code to the action method that requires permission control

[Permission ("Add" and "add")]

MVC Controller with Warehouse design

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.