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

Get by key value is broken, must use Get by object #315

Open
kspdrgn opened this issue Feb 20, 2023 · 0 comments
Open

Get by key value is broken, must use Get by object #315

kspdrgn opened this issue Feb 20, 2023 · 0 comments

Comments

@kspdrgn
Copy link

kspdrgn commented Feb 20, 2023

Sorry if this is a duplicate. Maybe this will help other developers running into this issue.

Using Get as the documentation suggests Get(id) doesn't work, it doesn't generate any predicate. Must use Get(new { id }) syntax.

This bug may affect all providers, I have only tested SQL Server.

The predicate is not filled out when using Get(value) but they work when using Get(object). I noticed that in DapperImplementor.GetMapAndPredicate, GetKeyPredicate is only called for Update and Delete, not Get.

Workaround for developers is to use Get(new {}) syntax.

Workaround for Dapper-Extensions may be to fix the documentation to say Get(new { id }) instead of Get(id).

See pull request with a corrected test case that shows Get is failing

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

No branches or pull requests

1 participant