Search code examples
ef-core-5.0ef-core-6.0

Sqlite Collation with EF Core


I can define a text column collation on Sql Server as follows as shown here in the Ms Doc

modelBuilder.Entity<Customer>().Property(c => c.Name)
    .UseCollation("SQL_Latin1_General_CP1_CI_AS");

The string here SQL_Latin1_General_CP1_CI_AS is specific to Sql Server.

But what if I want the same with Sqlite or some other database for that matter.

Where do I get that info from?

What is the equivalent of SQL_Latin1_General_CP1_CI_AS in Sqlite for example?


Solution

  • For SQLite there are only a few collations to choose from.

    • BINARY
    • NOCASE
    • RTRIM

    see for details https://www.sqlite.org/datatype3.html#collation