Dapper Contrib DeleteAll Discover How to Delete All Data From a Table
Description
The Dapper.Contrib library also provides the DeleteAll<T>() extension method that allows you to delete all records from a database table.
Parameters
The syntax of the DeleteAll<T> method is given below:
public static bool DeleteAll<T>(IDbTransaction transaction = null, int? commandTimeout = null)
The following table shows the different parameters of a DeleteAll method.
In the following example, we will use the DeleteAll method to delete all the records from the database table.
// @nuget: Dapper.Contrib using Dapper.Contrib.Extensions; using (var connection = My.ConnectionFactory()) { connection.Open(); var isSuccess = connection.DeleteAll<Invoice>(); }
Related Articles
ZZZ Projects
