Andres Guillen Hernandez
Andres Guillen Hernandez

Reputation: 1133

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.

Upvotes: 17

Views: 8963

Answers (1)

Andres Guillen Hernandez
Andres Guillen Hernandez

Reputation: 1133

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).

Upvotes: 41

Related Questions