-
-
Notifications
You must be signed in to change notification settings - Fork 72
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
EF Core 3.1: New Overrides #25
Comments
@JakenVeina thank you for the feedback. |
Basically, I was doing var query = _context.Set<MyEntity>()
.AsQueryable();
if(...)
query = query.Where(...); in a method under test. The The change is that in 3.0, Easily worked around on my end, once I realized what the issue is, but this seems like a good candidate to be added to the |
The issue fixed in release 3.1.1 |
Is that also fixed for NSubstitute? |
@likemike91 could you open a new issue if you still facing with the error |
@likemike91 Created a new ticket and PR. Hopefully we can get this fixed 👍 |
Protip: When supporting EF Core 3.1, mocked
DbSet<>
objects need to additionally override the newly-added methods.AsQueryable()
and.AsAsyncEnumerable()
(which simplyreturn this;
) withinBuildMockDbSet()
calls.Anyone who (like me) was using the
.AsQueryable()
extension method upon aDbSet<>
in production code will, after upgrade to 3.1, be calling the methods uponDbSet<>
instead. In my case, this meant that instead of getting a cast of theDbSet<>
toIQueryable<>
I was getting an auto-generated default implementation from Moq'sDefaultValueProvider
, which is basicallyArray.Empty<T>.AsQueryable()
.The text was updated successfully, but these errors were encountered: