linq-To-Sql: filter with enum(flags)
int emailType = (int)EmailType.PasswordRecovery;
return Database.EmailSettings.FirstOrDefault(es => (es.EmailType & emailType) == emailType);
Edit: I added a cast since es.EmailType
is and int
.
Database.EmailSettings.FirstOrDefault(
es => es.EmailType.HasFlag(EmailType.PasswordRecovery));