Alternative approach to build query based on key list, before executing it.
var keys = string.IsNullOrEmpty(keywords) ? Array.Empty<string>() : keywords.Split(' ');
var query = db.ProductCollections.Where(p => p.Children.Any() == false);
foreach (var key in keys)
{
query = query.Where(p => p.Name.Contains(key));
}
var collections = await query.ToListAsync();
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…