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

LinqKit fails with Entity Framework Core 5 #116

Closed
btihanyi opened this issue Apr 29, 2020 · 6 comments
Closed

LinqKit fails with Entity Framework Core 5 #116

btihanyi opened this issue Apr 29, 2020 · 6 comments
Assignees
Labels

Comments

@btihanyi
Copy link

LinqKit's query expansion functionality does not work with Entity Framework Core 5, well, since the 5.0.0-preview.2.20159.4 to be exact. It throws an exception: 'Unhandled expression type: 'Extension''

I don't know what could be that Extension expression, but it's been there since .NET Framework 4.0.

Of course, you could handle it in your code, but I suggest you to use the official ExpressionVisitor class, at least for the newer target frameworks, so it would be future-proof.

@StefH
Copy link
Collaborator

StefH commented Jul 16, 2020

@StefH StefH self-assigned this Jul 21, 2020
@StefH
Copy link
Collaborator

StefH commented Jul 21, 2020

@btihanyi
Did you have time to test this preview version?

@btihanyi
Copy link
Author

@StefH
Sorry, I'm currently on my vacation. I will check it next week.

@btihanyi
Copy link
Author

I've checked it and now it works fine. But I still wonder why don't you just use the official ExpressionVisitor class if the target framework is not .NET 3.5? They are doing basically the same. Like I said, it would be future-proof and I haven't found any performance difference between the two.

@StefH
Copy link
Collaborator

StefH commented Jul 31, 2020

@btihanyi
Thanks for testing.

Actually I don't know why a custom ExpressionVisitor is used in LinqKit, but for now I keep it like it is.
Maybe add a new issue/PR to just use this custom ExpressionVisitor for .NET 3.5 and use the normal one for all other frameworks.

Other question:
What version should I give to LinqKit.Microsoft.EntityFrameworkCore?
Just 5.0.0?
Or keep in line with Microsoft.EntityFrameworkCore, so version 5.0.0-preview.7?

@btihanyi
Copy link
Author

From the comment of the class, the custom ExpressionVisitor class comes from the this old blog post. It's from 2007, even before .NET 3.5 was released, when there was no built-in ExpressionVisitor class. I'm going to write a PR and check if there is any real difference in their implementations, but don't think so.

On the second question: I think while you use a preview (alpha, beta, etc.) package, yours should be too. But you don't have to follow their release numbers (apart from the major part), so 5.0.0-preview1, 5.0.0-preview2 is the proper way to go I believe. Then, when it's officially released, try to target that 5.0.0 version as long as possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants