Objective
This text describes how this framework is used, answers questions, and uses the framework more precisely to build functionality
After several iterations, the system is more convenient to use, the code is more concise and more intelligent, so the previous 61 sections of the article also need to be rearranged
Understanding of the project
Project is not particularly difficult to understand the class library, as a normal MVC, three-tier project view can
Directory
We only need a few steps to quickly build a function with permissions
- Table Design and conventions
- Generate Code (code generator and TT template)
- Configuration (URL configuration and permission settings)
1. Table Design and conventions
The design of the frame table must be designed according to the Convention, otherwise the generated code needs to be overloaded, and the Convention requires only 2 principles to be followed.
1. The table name must have a prefix (prefixed to the functional directory), such as Flow_ (Workflow) format: flow_table
2. The table must have a primary key ID, and the field createtime (Creation time datetime type)
Standard design (after establishing a table, you can describe the table's fields "Database Settings" is not mandatory , the TT template will generate the final rendering in the interface according to the description of the field, eliminating the purpose of manual writing instructions, later there is a description of usage)
CREATE TABLE [dbo]. [Spl_sample] (--spl_ Must [ID] [varchar] (primary key,--primary key (must) [name] [varchar] () null,--name [age] [int.] NOT NULL,--ages [Bir] [datetime] Not N ULL,--birthday [PHOTO] [varchar] (+) null,--picture Path [note] [text] null,--description [createtime] [datetime] NOT NULL --creation date (required))
Well-designed table to add it to EF
2. Generate Code
The generation is divided into two parts "the first part of the TT is the second part of the code generator"
TT templates
After we have saved EF we need to have the TT template generate the corresponding classes, respectively: Ibll,bll,idal,dal,models and injected configuration
The way to build is very simple, open the TT template press Save, it will be generated according to EF, no need to operate after the build
( Here is a description of the usage of a data set, which will generate comments, which will be brought to the front as a display, very convenient )
Code Generator
1. Open code Generator
2. Select the table you want to generate and click "Export Build"
3. Copy to Project
Note: SPL is an area that is built on the prefix of the table when the zone is established (the code generator can generate a list, which requires data to reflect the piping of the set table)
3. Configuration 1. Run the system in turn: "System Rights Management----> Personnel Management----> Module Maintenance"
Note: 1. The operation code is automatically appended to the background after the successful addition, and the opcode is the action method (button)
2. The purple box represents the opcode, the blue box represents the permission for the field (field permissions correspond to the database field, and in the next step you can set whether the role has permission to view and modify the column)
2. After the URL is added: Open role permission settings to set permissions for the administrator
3. Re-login to see the results of the run
In the results, the description of the red callout is our first step to set the data field, the description of the database settings, very convenient, all brought over!
Summarize:
The Convention is larger than the configuration, we set the table and description of the database according to the Convention, generate a series of results through the generator!
When the generated code does not meet the business, we only need to follow the gourd to draw a scoop, quickly can be overloaded or new processing methods, focus on the business layer only
The code generator is also smart after several iterations to generate an upload image or a date selection box based on the type
ASP. Mvc5+ef6+easyui Admin System (999)-How to use