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