Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for adding named parameters using dictionaries. #157

Merged

Conversation

elexisvenator
Copy link
Contributor

@elexisvenator elexisvenator commented Dec 18, 2024

New methods:

void ICommandBuilder.AddParameters(IDictionary<string, object?> parameters);
void ICommandBuilder.AddParameters<T>(IDictionary<string, T> parameters);

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 an IDictionary with a key type of string, 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)

@jeremydmiller
Copy link
Member

@elexisvenator I'll process this one today. CI stopped working with Weasel and we don't understand why yet. Tests are behaving perfectly hunky dory locally, and Marten/Wolverine as well.

@jeremydmiller jeremydmiller merged commit 54e84e0 into JasperFx:master Dec 19, 2024
0 of 4 checks passed
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.

2 participants