Getting Linq Expression error while getting Enum values. I followed different google tricks but not helpful. I'm new to Ef Core
I'm returning Enum Type userRoles to var roles by this line. But I got null.
var roles = await _context.Roles.Where(r => userRoles.Any(ur => ur.ToString() == r.Name)).ToListAsync();
System.InvalidOperationException: The LINQ expression 'DbSet .Where(r => __userRoles_0 .Any(ur => ur.ToString() == r.Name ))' could not be translated. Either rewrite the query in a form that can be translated, or switch to client evaluation explicitly by inserting a call to either AsEnumerable(), AsAsyncEnumerable(), ToList(), or ToListAsync().
ToString()is not translatable to sql. Doesn't a user role have a property (column!) likeur.Name?