2

I’m using SQLite v3 database with EF Core.

My database contains entries with diacritics, like this:

  1. Bratislava
  2. Leopoldov
  3. Lučenec
  4. Ľuboriečka
  5. 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:

  1. Bratislava
  2. Leopoldov
  3. Lučenec
  4. Veľký Krtíš
  5. Ľ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);
Draex_
  • 2,205
  • 3
  • 21
  • 42

0 Answers0