dbContext.Users.Where(x => !excludeEmails.Any(email => email.StartsWith("*")
? email.EndsWith("*") ? x.Email.Contains(email) : x.Email.StartsWith(email)
: email.EndsWith("*") ? x.Email.EndsWith(email) : x.Email == email));
An exception of type 'System.InvalidOperationException' occurred in Microsoft.EntityFrameworkCore.Relational.dll but was not handled in user code: 'Store type 'nvarchar(max)' was inferred for a primitive collection, but that primitive collection was previously inferred to have store type 'nvarchar(max)'.'
Reproduction repository: https://github.com/alienwareone/EfCorePrimitiveCollection/tree/master