Dapper Contrib - Delete

Description

DELETE a single or many entities.

Example - Delete Single

DELETE a single entitiy.

  1. using (var connection = My.ConnectionFactory())
  2. {
  3. connection.Open();
  4. var isSuccess = connection.Delete(new Invoice {InvoiceID = 1});
  5. }

Example - Delete Many

DELETE many entities.

  1. using (var connection = My.ConnectionFactory())
  2. {
  3. connection.Open();
  4. var list = new List<Invoice>()
  5. {
  6. new Invoice {InvoiceID = 1},
  7. new Invoice {InvoiceID = 2},
  8. new Invoice {InvoiceID = 3}
  9. };
  10. var isSuccess = connection.Delete(list);
  11. }