Skip to content

Conversation

@asherber
Copy link
Collaborator

@asherber asherber commented Sep 3, 2021

We can currently pass in POCOs that hold parameter values (for queries and stored procs) and PP will turn them into arrays of parameters. This PR lets us pass in Dictionaries as well.

db.Query(sql, new { Foo = 5, Bar = "apple" });

// same as 
var dict = new Dictionary<string, object>()
{
    ["Foo"] = 5,
    ["Bar"] = "apple"
}
db.Query(sql, dict);

The reason for this is that it lets you build up a collection of arbitrarily named parameters.

@asherber asherber requested a review from pleb September 3, 2021 21:54
@pleb pleb merged commit bd7953a into CollaboratingPlatypus:development Sep 3, 2021
@iadaz
Copy link
Collaborator

iadaz commented Sep 6, 2021

I thought this was useful enough to document. I've added the missing Wiki "Querying" page just by cobbling together examples from elsewhere, and added this at the bottom under "future dev". Hope that's OK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants