Dapper Tutorial 더퍼 플러스
Dapper Plus는 무엇입니까?
Dapper Plus는 대량 작업 메소드로 IDbConnection 인터페이스를 확장합니다.
- 대량 삽입
- 대량 업데이트
- 대량 삭제
- 대량 병합
이 라이브러리는 데이터베이스에서 저장 작업을 수행하는 가장 빠른 방법 입니다.
공식 웹 사이트 : http://dapper-plus.net/
설치
Dapper Plus는 NuGet을 통해 설치됩니다. https://www.nuget.org/packages/Z.Dapper.Plus/
이 도서관은 무료 는 아니지만 매월 초에 매월 시행 할 수 있습니다.
요구 사항
Dapper Plus는 모든 주요 데이터베이스 제공 업체와 호환됩니다.
- SQL Server 2008 이상
- SQL Azure
- SQL Compact
- 신탁
- MySQL
- SQLite
- PostgreSQL
행동 양식
Dapper Plus는 여러 가지 방법으로 IDbConnection 인터페이스를 확장합니다.
// STEP MAPPING DapperPlusManager.Entity<Supplier>().Table("Suppliers").Identity(x => x.SupplierID); DapperPlusManager.Entity<Product>().Table("Products").Identity(x => x.ProductID); // STEP BULKINSERT using (var connection = new SqlConnection(FiddleHelper.GetConnectionStringSqlServerW3Schools())) { connection.BulkInsert(suppliers).ThenForEach(x => x.Products.ForEach(y => y.SupplierID = x.SupplierID)).ThenBulkInsert(x => x.Products); } // STEP BULKUPDATE using (var connection = new SqlConnection(FiddleHelper.GetConnectionStringSqlServerW3Schools())) { connection.BulkUpdate(suppliers, x => x.Products); } // STEP BULKMERGE using (var connection = new SqlConnection(FiddleHelper.GetConnectionStringSqlServerW3Schools())) { connection.BulkMerge(suppliers).ThenForEach(x => x.Products.ForEach(y => y.SupplierID = x.SupplierID)).ThenBulkMerge(x => x.Products); } // STEP BULKDELETE using (var connection = new SqlConnection(FiddleHelper.GetConnectionStringSqlServerW3Schools())) { connection.BulkDelete(suppliers.SelectMany(x => x.Products)).BulkDelete(suppliers); }
include component-try-it.html href = 'https : //dotnetfiddle.net/dbMVfr'%}