Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IQueryable doesn't implement IDbAsync Query Provider

I have a repository into the repository I have a method that returns a bool(true) if exists in a table an user by an Email or (false) if it does not exist, my method is like this:

public async Task<bool> existsUserByEmail(string email)
    {
        try
        {
            return await _context.Usuarios
                .AnyAsync(u => u.Email == email);
        }
        catch (Exception e)
        {
            throw e;
        }            
    }

but it returns an error and in the message is exactly this:

The provider for the source IQueryable doesn't implement IDbAsyncQueryProvider. Only providers that implement IDbAsyncQueryProvider can be used for Entity Framework asynchronous operations. For more details see http://go.microsoft.com/fwlink/?LinkId=287068.

I have searched but I have not found anything, I am new in .NET Core so I don't know if I have to config something in my startUp class.

like image 434
Andres Guillen Hernandez Avatar asked Nov 26 '25 06:11

Andres Guillen Hernandez


1 Answers

The error message is from EF6. It's because I'm referencing both EF6 and EF Core, so I removed: System.Data.Entity; (EF6) in my code, but only using Microsoft.EntityFrameworkCore; (EF Core).

like image 107
Andres Guillen Hernandez Avatar answered Nov 27 '25 19:11

Andres Guillen Hernandez



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!