I tried these :
public async Task<bool> NameExists(string name)
{
    var productCategories = await this._dbContext.ProductCategories
        .Where(c => String.Compare(c.Name, name, StringComparison.InvariantCultureIgnoreCase) > 0).ToListAsync();
    return productCategories.Count > 0;
}
public async Task<bool> NameExists(string name)
{
    int count = await this._dbContext.ProductCategories
        .CountAsync(c => String.Compare(c.Name, name, StringComparison.InvariantCultureIgnoreCase) > 0).t
    return count != 0;
}
but in both cases I get this error message :
System.InvalidOperationException: 'The LINQ expression 'DbSet<ProductCategory>()
    .Where(p => string.Compare(
        strA: p.Name, 
        strB: __name_0, 
        comparisonType: InvariantCultureIgnoreCase) > 0)' could not be translated
I searched around the web but don't find any solution.
As temp "solution" I use this :
public async Task<bool> NameExists(string name)
{
    return await this._dbContext.ProductCategories.AnyAsync(x => x.Name.Trim().ToLower() == name.Trim().ToLower());
Do you have an idea how solve this ?
Thanks, }