ArticleDirectory
- View code in MVC
- Controller code in MVC
- Model Code in MVC
The list page and add, delete, modify, and query page of a single table in a real project are recorded in detail.
LangbenCodeThe builder can automatically generate ASP. NET pages and background code.
The technologies used by the generated project include jquery + MVC + Entity Framework.
In practical development, we use powerdesigner to design a database model. The langben code generator reads the database model designed by powerdesigner, analyzes the relationship model between the table and the table, and analyzes the keywords in the description information of the table and field, automatically generate different ASP.. NET page.
The relational models between tables include:
- Single Table Data Model
- Self-connection data model
- One-to-one Data Model
- One-to-Multiple Data Models
- One table in the one-to-multiple data model is self-join.
- Multi-to-multi-data model
- One table in the many-to-many data model is self-join.
Keywords include
- Query
- Status
- Upload
- Workflow
Architecture Diagram
Component Description
Chart 1 project component description
- App-page display Layer
The MVC framework is used, the jquery script library is used, and easyui is used for the control.
- Wcfhost -- service host (post-extension)
Provides a host for external services, using the WCF technology and HTTPS communication protocol.
- Ibll-business interface layer
APIs and service contracts exposed by methods at the business logic layer.
- Bll-business logic layer
Business logic operations, including business processing, transactions, and logs.
- Dal-data access layer
Database Access operations, data entities, business entities, data validation, using Entity Framework.
- Common -- public component layer
Entire ApplicationProgramThe public auxiliary method used.
- Wfactivitys -- workflow activity layer (post-extension)
Defines the activities required by the workflow and uses Microsoft WF technology.
- Wfdesigner-workflow designer (later extension)
It allows implementers to freely configure the workflow designer and use Microsoft WPF technology.
Functions of Data Dictionary
On other pages, some fields are displayed in a drop-down box. The data in these drop-down boxes can be configured using the data dictionary to facilitate later maintenance and modification. For example:
In the data dictionary configuration, the Status field (State) in the module table (sysmenu) is a drop-down box
The Status field (State) on the module page is displayed as a drop-down box. Because the enabled sorting is smaller than disabled, it is enabled on the top.
The following uses the data dictionary as an example to analyze the single table data model. The code is already in the generated file and the comment is detailed. This article will not go into detail.
Single Table Data Model
There is a primary key and no foreign key for a table.
List
View code in appmvc on the page display Layer
Controller code in MVC
Model Code in MVC
Because a single table is simple, model is the entity automatically generated by Entity Framework.
Business interface layer ibll
This layer serves as the interface of the business logic layer method and is also a contract exposed by WCF.
Business logic layer BLL
The business logic of the data dictionary class is written in the BLL class library, and the transaction usesTransactionscopeThe sysfieldbll. CS class file encapsulates the operation methods of the business logic and inheritsBasebllBase Class
The entire project should follow the following principles: fat Bll, thin MVC
Data access layer dal
The sysfield. CS file is used to verify the entity and entity metadata of the data dictionary table, while the sysfieldrepository. CS file is used to access the database of the data dictionary.
The business entity is in sysfield. the sysfield class in the CS file. It is a partial class that can be customized internally. The metadatatype attribute specifies the validation class sysfieldmetadata for this object attribute, and it inherits the ibaseentity interface (this interface does not have any members at the moment );
The sysfield. CS file also contains a sysmessagemetadata class used to verify members in the sysfield class. Note that the verification class must reference using system. componentmodel. dataannotations; namespace.
Service Layer
(Extension later)
Query
Delete
Select one or more items, and then click Delete.
Create
View Details