Dapper - Buffered

Description

  • Default: True

A buffered query return the entire reader at once. That is ideal in most scenario.

A non-buffered query is equivalent as streaming. You only load objects on demand. That can be useful for a very large query to reduce memory usage.

  1. string sql = "SELECT * FROM OrderDetails;";
  2. using (var connection = new SqlConnection(FiddleHelper.GetConnectionStringSqlServerW3Schools()))
  3. {
  4. var orderDetails = connection.Query<OrderDetail>(sql, buffered: false).ToList();
  5. FiddleHelper.WriteTable(orderDetails.Take(10));
  6. }

Try it: .NET Core | .NET Framework