Minor documentation bug with anonymous types & parameters

Open Beginner friendly
#1,775 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
78/100
Issue type
Documentation
Clarity
Clearly specified
Activity status
Stale
Tech stack
csharp
Domain
documentation

Research direction

Open the parameters page at https://www.learndapper.com/parameters and inspect the anonymous-type example. Correct the constructor call so the example uses the syntax shown in the issue, then verify that the documented snippet compiles as written.

Written by the indexing model from the issue text.

Description

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!

Dominant language
C#
Stars
18.4k
Forks
3.7k
Avg merge
5h 8m
Merged PRs (30d)
1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from DapperLib/Dapper

All issues in DapperLib/Dapper

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.