I’m using SQLite v3 database with EF Core.
My database contains entries with diacritics, like this:
- Bratislava
- Leopoldov
- Lučenec
- Ľuboriečka
- Veľký Krtíš
I need to sort these entries alphabetically I.e. get them ordered as above.
The problem is that by default, SQLite sorts strings in BINARY collation, which results in the following order:
- Bratislava
- Leopoldov
- Lučenec
- Veľký Krtíš
- Ľuboriečka
How can I ensure that database results are ordered properly?
UPDATE
I've found this function for adding collation to SQLite. However, I don't know how to apply the collation to a schema (using code first approach).
var connection = new SqliteConnection(connectionString);
connection.CreateCollation("SLOVAK_COLLATION", localComparer);
options.UseSqlite(connection);