Recently the company's project to switch to ABP framework, had to start to try, first get a simple blog to try Taker, we can go to the Sun-Rui Big blog To see About the ABP introduction bar.
-: Download sample template to ABP website;
Here are a few options, first of all we use the mvc5.x, and then select the classic multi-page program, fill in the project name and verification code, click the Create button below.
Second: Initialize your program;
1: After opening to see the ABP architecture, according to my understanding is probably divided into these several layers. To see if there is no lack of us first to NuGet restore;
2: Click to restore NuGet bag ~
3: Using Codefirst to generate the database ~ ~
Change Data Link
Because I am using a local database, so I use the system authentication directly, please change the database link by yourself.
Input Update-database
If the update occurs incorrectly, check to see if the program is running with errors or if the data link is correct. You should be able to open it here. Click to run ~ ~ Account password is: admin 123qwe tenant Default, the latest version of ABP Best Use vs2017 run.
4: Create a new entity
First open the domain layer, create a new file folder named Random, in the directory to build an entity class, I simply create a column, inherited entity will default to use the ABP defined primary key, the default is the ID int type, then update the new good entity to the database.
First go to DbContext to define the corresponding dbset of the entity, add the new entity to the Blogabpdbcontext
Open the Package control console Enter the "add-migration 20171127_channel" command, enter the migrations file at the infrastructure level to see if the file is generated, if there is an execute command to update the "Update-database" When the update is successful, the database automatically creates a new table.
After the entity is created, the most important part is the one that will be described in detail in the next Application service layer.