Download the official framework, using the EF Core.
Use application migration, reverse generated database, configure database connection address good appsettings.json file.
According to the database you want to configure the connection address.
For example, you want to use sql server, then you configure the connection string sql server database.
You have to use the Oracle database, then you configure the Oracle database connection string.
Generating a reverse, it will automatically recognize the address, thereby generating a corresponding database.
If you run xxx.Web project, reported the other end of the pipe without any process, please review the items below appsettings.json file
Database Connection address is correct.
Domain layer starting template is divided into two items:
xxx.BookStore.Domain
Include your entity , field service and other core domain objects.xxx.BookStore.Domain.Shared
It containsconstants
,enums
or other related fields of objects can be shared with end customers.
EF Core requires an entity associated with your DbContext . The easiest way is to place a DbSet
property is added to xxx.BookStore.EntityFrameworkCore project in the BookStoreDbContext
class.
In xxx.BookStore.EntityFrameworkCore
the project opened BookStoreDbContextModelCreatingExtensions.cs file and add the following code to the ConfigureBookStore
method of the end to configure the Book entity:
builder.Entity<Book>(b => { b.ToTable(BookStoreConsts.DbTablePrefix + "Books", BookStoreConsts.DbSchema); b.ConfigureByConvention(); //auto configure for the base class props b.Property(x => x.Name).IsRequired().HasMaxLength(128); });
b.Property (x => x.Name) .IsRequired () HasMaxLength (128);. is the maximum length of the Name property of the requesting entity.
Add the using Volo.Abp.EntityFrameworkCore.Modeling;
statement to address the ConfigureByConvention
extension method.
After completion of the association, open NuGet VS console, set xxx .BookStore.EntityFrameworkCore.DbMigrations
as the default startup project and execute the following command:
Add-Migration "Created_Book_Entity"
This will be the xxx.BookStore.EntityFrameworkCore.DbMigrations
project 's Migrations folder to create a new category within the migration .
Then execute the Update-Database
command to update the database schema:
When performing the migration, pay attention to whether they contain the following items appsettings.json documents inside the database connection string in order to restore to the library, and if not, then just go to the configured copy over appsettings.json project.
The application layer is divided into two items:
xxx.BookStore.Application.Contracts
Include your mainDTO
and application services interfaces.xxx.BookStore.Application
It contains your application service implementation.
DTO class for data transmission of the presentation layer and the data layer.
You need to be mapped after addition. Plus go after the expiry of the interface mapping.
After finished interface map, ABP frame automatically generated into a corresponding API interface.
After an interface, xxx.Web layer to create pages, to make the call interface for data transmission.
Specific steps, please refer to the official tutorial. (Official website tutorial on a)