Read Many Rows
What this page covers#
This page explains ListAsync<T>.
Basic example#
var users = await db.ListAsync<User>("dbo.usp_User_ListActive");
Custom mapper example#
var users = await db.ListAsync( "dbo.usp_User_ListActive", static reader => new User { UserId = reader.GetInt32(reader.GetOrdinal("UserId")), Name = reader.GetString(reader.GetOrdinal("Name")) });
Notes#
- auto-mapping is the shortest path when names line up
- custom mapping is useful for irregular shapes or reusable materialisation