Skip to content

The default behavior of translate boolean on SQLite #30709

@Cologler

Description

@Cologler

By default, .Where(x => x.BoolProperty) will translate to SQL WHERE BoolProperty, which prevents the SQLite database to use the index.

Using .HasConversion(new BoolToZeroOneConverter<int>()) can help us translate .Where(x => x.BoolProperty) to WHERE BoolProperty = 1, and it will use index correct;

Is there any document for this? Or just make this the default behavior.

Include provider and version information

EF Core version: 7.0.5
Database provider: Microsoft.EntityFrameworkCore.Sqlite
Target framework: .NET 7.0

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions