Dapper Plus - Bulk Delete

DELETE entities using Bulk Operation.

Example - Delete Single

DELETE a single entity with Bulk Operation.

using (var connection = My.ConnectionFactory())
{
    connection.Open();

    connection.BulkDelete(invoice);
}

Example - Delete Many

DELETE many entities with Bulk Operation.

using (var connection = My.ConnectionFactory())
{
    connection.Open();

    connection.BulkDelete(invoices);
}

Example - Delete with relation (One to One)

DELETE entities with a one to one relation with Bulk Operation.

using (var connection = My.ConnectionFactory())
{
    connection.Open();

	connection.BulkDelete(invoices.Select(x => x.Detail))
		.BulkDelete(invoices);
}

Example - Delete with relation (One to Many)

DELETE entities with a one to many relation with Bulk Operation.

using (var connection = My.ConnectionFactory())
{
    connection.Open();

	connection.BulkDelete(invoices.SelectMany(x => x.Items))
		.BulkDelete(invoices);
}