/// <summary> /// An IQueryable<T> extension method that deletes all rows from the query without /// retrieving entities. /// </summary> /// <typeparam name="T">The type of elements of the query.</typeparam> /// <param name="query">The query to delete rows from without retrieving entities.</param> /// <param name="batchDeleteBuilder">The batch builder action to change default configuration.</param> /// <returns>The number of rows affected.</returns> public static int Delete <T>(this IQueryable <T> query, Action <BatchDelete> batchDeleteBuilder) where T : class { var batchDelete = new BatchDelete(); BatchDeleteManager.BatchDeleteBuilder?.Invoke(batchDelete); batchDeleteBuilder?.Invoke(batchDelete); return(batchDelete.Execute(query)); }
/// <summary> /// An IQueryable<T> extension method that deletes all rows from the query without /// retrieving entities. /// </summary> /// <typeparam name="T">The type of elements of the query.</typeparam> /// <param name="query">The query to delete rows from without retrieving entities.</param> /// <param name="batchDeleteBuilder">The batch builder action to change default configuration.</param> /// <returns>The number of rows affected.</returns> public static int Delete <T>(this IQueryable <T> query, Action <BatchDelete> batchDeleteBuilder) where T : class { var batchDelete = new BatchDelete(); if (BatchDeleteManager.BatchDeleteBuilder != null) { BatchDeleteManager.BatchDeleteBuilder(batchDelete); } if (batchDeleteBuilder != null) { batchDeleteBuilder(batchDelete); } return(batchDelete.Execute(query)); }