-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Query: AsNoTracking/AsTracking methods on Non-EF Queryable providers throws InvalidOperationException #7937
Comments
@smitpatel to investigate, checking with @anpete who did some related changes in this area previously. |
This piece of code suggests there's no special handling https://github.com/aspnet/EntityFramework/blob/f386095005e46ea3aa4d677e4439cdac113dbfb1/src/EFCore/EntityFrameworkQueryableExtensions.cs#L2451 |
I came across this same issue today and ended up writing my own gated version of AsNoTracking() as a workaround. |
Looks like Include/ThenInclude has the special handling, but AsNoTracking does not. Changing from "investigate" to bug. We should also make sure that there aren't other extension methods that need similar changes. (AsTracking is the obvious one. 😄) |
@cdwaddell Would you be willing to share your workaround? |
@bassebaba sure. Basically, I did the same thing that the other IQueryable extensions did in a custom IQueryable extension.
To use this, you change -- Daniel |
We've created an abstraction on top of EF that will be our main data access. When we try to moq it in order to retrieve test data to test business logic, this exception is thrown when returning a list as queryable.
Note that it doesn't throw any exception in EF6 (same code with EF6 just works well)
Note also that .Include() doesn't throw anything
Steps to reproduce
Here's code to reproduce the issue
Further technical details
EF Core version: 1.1.1
Database Provider: (e.g. Microsoft.EntityFrameworkCore.SqlServer)
Operating system: Winodws 10
IDE: VS 2017 RTW
The text was updated successfully, but these errors were encountered: