Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to create and use ABP to introduce Dapper framework

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)05/31 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report