Dapper Plus – Introduction

Library Under Construction (Available at the end of April)

Bulk Actions

The Dapper Plus Bulk[Action] method allow to [Action] entities in a database table or a view

Example

connection.BulkInsert(orders, order => order.Items)
          .BulkInsert(invoices, invoice => invoice.Items)
          .BulkMerge(shippingAddresses);

Also Bulk Actions

The Dapper Plus AlsoBulk[Action] method allow to [Action] entities in a database table or a view using a lambda expression.

The lambda expression use the entity or the IEnumerable from the last Bulk[Action] or ThenBulk[Action] chained method. (The action can be an insert, update, delete or merge operation).

Example

connection.BulkInsert(orders)
          .AlsoInsert(order => order.Items)
          .AlsoInsert(order => order.Invoice)
          .AlsoInsert(order => order.Invoice.Items);

Then Bulk Actions

The Dapper Plus ThenBulk[Action] method allow to [Action] entities in a database table or a view using a lambda expression.

The lambda expression use the entity or the IEnumerable from the last Bulk[Action] or ThenBulk[Action] chained method. (The action can be an insert, update, delete or merge operation).

connection.BulkInsert(orders)
          .AlsoInsert(order => order.Items)
          .ThenInsert(order => order.Invoice)
          .ThenInsert(invoice => invoice.Items);

Include Actions

The Dapper Plus Include method allow resolving issues with multiple “ThenBulk[Action]” method.

connection.BulkInsert(orders)
          .Include(x => x.ThenInsert(order => order.Items)
                         .ThenInsert(orderItem => orderItem.Metas))
          .Include(x => x.ThenInsert(order => order.Invoice)
                         .ThenInsert(Invoice => invoice.Items));