EF Core 3.1: New Overrides
See original GitHub issueProtip: When supporting EF Core 3.1, mocked DbSet<>
objects need to additionally override the newly-added methods .AsQueryable()
and .AsAsyncEnumerable()
(which simply return this;
) within BuildMockDbSet()
calls.
Anyone who (like me) was using the .AsQueryable()
extension method upon a DbSet<>
in production code will, after upgrade to 3.1, be calling the methods upon DbSet<>
instead. In my case, this meant that instead of getting a cast of the DbSet<>
to IQueryable<>
I was getting an auto-generated default implementation from Moq’s DefaultValueProvider
, which is basically Array.Empty<T>.AsQueryable()
.
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Breaking changes included in EF Core 3.x
Complete list of breaking changes introduced in Entity Framework Core 3.x.
Read more >Creating and Configuring a Model - EF Core
Overview of creating and configuring a Entity Framework Core model via ... the latest call will override previously specified configuration.
Read more >EF Core - Overriding conventions - YouTube
Entity Framework Core is all about conventions. That's how the entire EF Core magic happens out of the box. However, there are a...
Read more >OnModelCreating code refactoring from EF6 to EF core 3.1
According to your code, it seems that you want to change the Table Name and set the Column Name, if that is the...
Read more >Override EF Core DbContext in ASP.NET ...
It replaces the EF Core DbContext with a DbContext using the InMemoryProvider. After migrating to 3.0 it isn't replaced anymore. I always ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@likemike91 Created a new ticket and PR. Hopefully we can get this fixed 👍
Is that also fixed for NSubstitute? Unfortunately I get the same error when using NSubstitute and I didn’t see the fix in the code of the NSubstitute extension?