EF Core Update-Database failed with MySQL

When trying to use the code first approach of Entity Framework Core to generate database and tables using MySQL. When running Update-Database in the package console manager, it shows an error saying table __efmigrationhistory doesn’t exists.

After digging in Stackoverflow, it seems that it’s a bug with the official MySQL connector. And at the time of this writing with this version 8.0.20 and .NET Core 3.1, this bug hasn’t been fixed. The connector is supposed to create this table for migration.

https://stackoverflow.com/a/46090571/9191495

In order to solve this problem there are two solutions

-Don’t use the official connector, use Pomelo.EntityFramework.MySql

https://www.nuget.org/packages/Pomelo.EntityFrameworkCore.MySql

-Alternatively create, the table yourself

CREATE TABLE `__EFMigrationsHistory` 
( 
    `MigrationId` nvarchar(150) NOT NULL, 
    `ProductVersion` nvarchar(32) NOT NULL, 
     PRIMARY KEY (`MigrationId`) 
);

It’s a waste of time, but what can one do.

No Configuration values in ASP.NET Core app when debugging in Visual Studio Code

This is a stupid mistake.

Make sure that in launch.json, the value for cwd is correct and is pointing to the same folder as the DLL of the .NET Core app.

By default current working directory is set to the workspace directory, the appsettings.json file is not there, thus when running the app, it doesn’t have any settings.

Change DNS server in Ubuntu 18.04

In Ubuntu desktop 18.04, it seems that in order to change the DNS server, you need to open Network Manager in the UI and set the DNS server IP Address.

However it doesn’t work until you restart or run sudo netplan apply.

If you use Ubuntu server, you need to modify a yaml file within yaml file, then run netplan apply.

Not sure why doing so in Ubuntu desktop doesn’t work, though.