Create a new project
This tutorial uses ABP CLI to create a new project. For more options, see Getting Started page.
If you have not previously installed, use the command line to install ABP CLI:
dotnet tool install -g Volo.Abp.Cli
Use an empty folder abp new
to create a project command:
abp new Acme.BookStore
You can use different levels of the namespace; for example BookStore, Acme.BookStore or Acme.Retail.BookStore.
new
Command creates a hierarchical MVC application , the Entity Framework Core as a database provider, but it also has other options. For all available options, see CLI documentation
Prior request
Create project requirements:
Solution structure
In Visual Studio Open the solution:
This solution has a layered structure (based on the Domain Driven Design & integrated test items, can), and comprising a unit configured with EF Core and SQLite used with database memory.
See Application template document to learn more about the solution structure.
Database connection string
Check .Web
under the project appsettings.json
file in the connection string:
{
"ConnectionStrings": {
"Default": "Server=localhost;Database=BookStore;Trusted_Connection=True"
}
}
Solutions using Entity Framework Core and MS SQL Server . EF Core supports a variety of database provider, so you can, if necessary, change the connection string according to the actual need to use other DBMS.
Create a database application and database migration
You have two options to create the database.
Use DbMigrator application
The solution includes a console application (called in this example Acme.BookStore.DbMigrator
), you can create a database, application migration and initialization data. It is very useful in the development and production environments.
.DbMigrator
Project has its own appsettings.json
, so if you change the connection string above, you should also change this string.
Right-click the .DbMigrator
project and select Set as StartUp Project:
Press F5 (or Ctrl + F5) having an output which will run the application as shown below:
Use EF Core Update-Database command
Ef Core has a Update-Database
command, you can create a database and application migration needed to hang a right click. .Web
Project and select Set as StartUp Project:
Open the Package Manager Console (Package Penalty for Manager Console) , select the .EntityFrameworkCore.DbMigrations
item as the default project and run the Update-Database
command:
This will create a new database based on the connection string configuration.
Use .Migrator
tools is the recommended method because it can initialize the initial data can run Web applications correctly.
Run the application
You can now run the application, it will open the home page:
Click the Login button and enter your user name admin
, password 1q2w3E*
, login application.
Start templates include identity management and tenant management module After login, the "Management" menu, you can manage. Tenants , roles , user and permissions User Management page as follows: