Dapper icon indicating copy to clipboard operation
Dapper copied to clipboard

Minor documentation bug with anonymous types & parameters

Open kkostrzewa-coupa opened this issue 3 years ago • 0 comments

Super minor documentation bug, but on https://www.learndapper.com/parameters it says

Or you can pass an anonymous type:

var parameters = new DynamicParameters({ ProductId = 1 });
var sql = "select * from products where ProductId = @ProductId";
using (var connection = new SqlConnection(connString))
{
    var product = connection.QuerySingle<Product>(sql, parameters);
}

when I think it should say

var parameters = new DynamicParameters(new { ProductId = 1 });

to get it to compile.

Thanks for the hard work with Dapper!

kkostrzewa-coupa avatar Apr 20 '22 15:04 kkostrzewa-coupa