Using ASP.Net core and Identity 3.1, I have a web app and using Pomelo package to connect to mysql/MariaDB as my databsae.
I can alter my tables and columns after database is created to change my collation and charset but looking for a way to set my favorite collation and char set on model creating (I mean at the same time the update-database
is running from my web-app and during the creation of my database, I need to set the correct charset and collation).
I can set my collation/charset for a column like this but doing like this for all columns and tables is frustrating and also I have tables of Identity which shoud be set for collation/charset too.
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.Entity<Table1>().Property(obj => obj.Column1).HasCharSet("utf8mb4").HasCollation("utf8mb4_unicode_ci");
. . .
I need a code to have all my databse, tables and columns be set for an specific charset and collation.
I searched around and tried something like this :
MySqlPropertyBuilderExtensions.HasCharSet(CharSet.???,"utf8mb4").HasCollation("utf8mb4_unicode_ci");
modelBuilder.HasCharSet(CharSet.???).UseCollation("utf8mb4_general_ci");
But I can't manage it.