How to create and use ABP to introduce Dapper framework
This article mainly explains "how to create and use ABP to introduce Dapper framework", interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn "ABP introduces how to create and use Dapper framework"!
one。 First, prepare a database to build a table.
two。 Create an entity table [Table ("BasBloodLevel")] public class BasBloodLevel:Entity {public string Code {get; set;}} III. Then install the Abp.Dapper package on the EF layer of the ABP framework
Abp.Dapper package
And add the following code to the xxxEntityFrameworkModule of the EF layer
This is done referencing the Dapper framework, and the next step is to use the
Use the first DbContext to introduce the corresponding DbSet
Finally, it is directly used in the application layer.
Warehousing using IDapperRepository can use Dapper's ORM framework.
Public class BasBloodLevelAppService: IApplicationService {private readonly IDapperRepository _ basBloodLevelRepository; public BasBloodLevelAppService (IDapperRepository basBloodLevelRepository) {_ basBloodLevelRepository = basBloodLevelRepository;} public List GetBasAllMessage2 () {var entity = _ basBloodLevelRepository.Query ("select * from BasBloodLevel") .ToList (); return entity;}}
Call the following to prove that I am successful
At this point, I believe you have a deeper understanding of "how to create and use the Dapper framework introduced by ABP". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!