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

Return a table value parameter as a IQueryable #17885

Closed
AndersMalmgren opened this issue Sep 17, 2019 · 3 comments
Closed

Return a table value parameter as a IQueryable #17885

AndersMalmgren opened this issue Sep 17, 2019 · 3 comments

Comments

@AndersMalmgren
Copy link

AndersMalmgren commented Sep 17, 2019

Sometimes you have a large number of id's from a UI or from an external system. You want to query against these id's. The classic Where(entity => ids.Contains(entity.Id)) is very slow.

I would love to see a mechanic for getting data using table value parameters. A syntax like this or similar

db.ExecuteTableValueQuery(ids)

Since it returns a IQueryable it could be used like this with good performance

db.ExecuteTableValueQuery(ids)
   .Join(db.Set<MyEntity>(), id => id, e => e.Id, (id, e) => e);

The table value parameter type could be fixed by convention, if ids is a IEnumerable<int> it will try to use a sql type called ef__core_int_tvp or similar convention.

@smitpatel
Copy link
Member

@divega to dedupe.

@divega
Copy link
Contributor

divega commented Sep 18, 2019

This is similar enough to #13239 to close as duplicate.

@AndersMalmgren it would be great if you could take a look at that issue and elaborate on any additional aspects you see missing, e.g. the convention for naming of tables types.

@AndersMalmgren
Copy link
Author

@divega I added some of my own ideas to that issue

@ajcvickers ajcvickers reopened this Oct 16, 2022
@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants