Dapper Plus - Bulk Update
Description
UPDATE entities using Bulk Operation.
Example - Update Single
UPDATE a single entity with Bulk Operation.
DapperPlusManager.Entity<Customer>().Table("Customers"); using (var connection = new SqlConnection(FiddleHelper.GetConnectionStringSqlServerW3Schools())) { connection.BulkUpdate(customers); }
Example - Update Many
UPDATE many entities with Bulk Operation.
DapperPlusManager.Entity<Customer>().Table("Customers"); using (var connection = new SqlConnection(FiddleHelper.GetConnectionStringSqlServerW3Schools())) { connection.BulkUpdate(customers); }
Example - Update with relation (One to One)
UPDATE entities with a one to one relation with Bulk Operation.
DapperPlusManager.Entity<Supplier>().Table("Suppliers").Identity(x => x.SupplierID); DapperPlusManager.Entity<Product>().Table("Products").Identity(x => x.ProductID); using (var connection = new SqlConnection(FiddleHelper.GetConnectionStringSqlServerW3Schools())) { connection.BulkUpdate(suppliers, x => x.Product); }
Example - Update with relation (One to Many)
UPDATE entities with a one to many relation with Bulk Operation.
DapperPlusManager.Entity<Supplier>().Table("Suppliers").Identity(x => x.SupplierID); DapperPlusManager.Entity<Product>().Table("Products").Identity(x => x.ProductID); using (var connection = new SqlConnection(FiddleHelper.GetConnectionStringSqlServerW3Schools())) { connection.BulkUpdate(suppliers, x => x.Products); }