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

How to do a SELECT ... IN? #164

Closed
k3davis opened this issue Aug 15, 2017 · 1 comment
Closed

How to do a SELECT ... IN? #164

k3davis opened this issue Aug 15, 2017 · 1 comment

Comments

@k3davis
Copy link

k3davis commented Aug 15, 2017

Is there a way to do a SELECT ... IN statement and pass an array of values? This is possible in Dapper proper but I haven't found an example using Dapper-Extensions.

The workaround I've attempted thus far is to create a predicate group of "Or"s for each possible value, but this has seemed to have unreliable results when added to an existing "And" predicate group.

Please forgive if this is mentioned somewhere else - "IN" is a vague term to search by.

@tmsmith
Copy link
Owner

tmsmith commented Aug 15, 2017

if you use a FieldPredicate, set to Equal and pass in an array it will translate to IN.

https://github.com/tmsmith/Dapper-Extensions/blob/master/DapperExtensions/Predicates.cs#L203

@tmsmith tmsmith closed this as completed Aug 15, 2017
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

2 participants