Skip to content

Enum ICollection Contains => TRUE = FALSE #23059

Closed
@kevinvenclovas

Description

@kevinvenclovas

Hello,

i have a bug or need some help with my code.

await context.Users.Where(x => !x.IsSoftDeleted && (x.MessageGroups.Contains(group) || x.MessageGroups.Contains(MessageGroup.ALL))).ToListAsync();

With this code EfCore generate this SQL:

SELECT ... FROM .. AS a
      WHERE NOT (a."IsSoftDeleted") AND ((TRUE = FALSE) OR (TRUE = FALSE))

So why the Contains generate TRUE = FALSE ?

Databasefield has this Conversion:
entity.Property(e => e.MessageGroups).HasConversion(v => string.Join(',', v), v => v.Split(',', StringSplitOptions.RemoveEmptyEntries).Select(x => x.ToEnum<MessageGroup>()).ToList());

Can someone help me. Thanks!

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions