Add support for adding named parameters using dictionaries. #157
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New methods:
These will take the passed in dictionary and parse it as a set of named parameters. Additionally,
ICommandBuilder.AddParameters(object)
will now detect if the passed in object is anIDictionary
with a key type ofstring
, and if so will pass to the new methods to handle.This does result in a change of behaviour for the existing
AddParameters
method, but the old behaviour when passing a dictionary in would have been for npgsql to throw an error, so not seeing this as a downside.Testing - added/updated tests to cover both the new methods and new behaviour in existing methods (in both the command builder and batch builder)
Next steps: update marten to support this, document named params in marten (both via anon objects and via dictionaries)