### Install Dapper via Package Manager Console Source: https://learndapper.com Command to install the Dapper NuGet package using the Visual Studio Package Manager Console. ```csharp 1. PM> Install-Package Dapper ``` -------------------------------- ### Install Dapper via .NET CLI Source: https://learndapper.com Command to add the Dapper NuGet package to a project using the .NET CLI. ```cmd 1. dotnet add package Dapper ``` -------------------------------- ### Clone Dapper repository Source: https://learndapper.com Command to clone the Dapper source code from GitHub using Git. ```csharp 1. git clone https://github.com/StackExchange/Dapper.git ``` -------------------------------- ### Retrieve data with ADO.NET Source: https://learndapper.com Standard ADO.NET approach for executing a query and manually mapping reader results to a list of objects. ```csharp 1. var sql = "SELECT * FROM products"; 2. var products = new List(); 3. using (var connection = new SqlConnection(connString)) 4. { 5. connection.Open(); 6. using (var command = new SqlCommand(sql, connection)) 7. { 8. using (var reader = command.ExecuteReader()) 9. { 10. var product = new Product 11. { 12. ProductID = reader.GetInt32(reader.GetOrdinal("ProductID")), 13. ProductName = reader.GetString(reader.GetOrdinal("ProductName")), 14. SupplierID = reader.GetInt32(reader.GetOrdinal("SupplierID")), 15. CategoryID = reader.GetInt32(reader.GetOrdinal("CategoryID")), 16. UnitPrice = reader.GetDecimal(reader.GetOrdinal("UnitPrice")), 17. UnitsInStock = reader.GetInt32(reader.GetOrdinal("UnitsInStock")), 18. UnitsOnOrder = reader.GetInt32(reader.GetOrdinal("UnitsOnOrder")), 19. Discontinued = reader.GetBoolean(reader.GetOrdinal("Discontinued")), 20. DiscontinuedDate = reader.GetDateTime(reader.GetOrdinal("DiscontinuedDate")) 21. }; 22. products.Add(product); 23. } 24. } 25. } ``` -------------------------------- ### Retrieve data with Dapper Source: https://learndapper.com Simplified data retrieval using Dapper's Query extension method to map results directly to a list. ```csharp 1. products = connection.Query(sql).ToList(); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.