SqlAlias applies alias definitions from the registry to the server portion of a Microsoft SQL Server connection string. Unlike full framework applications, .NET Core apps and websites do not do this by default.
The code is based on user2771704's StackOverflow answer.
Install the SqlAlias package from NuGet
using SqlAlias;
Aliases.Map(myConnectionString)
Changes are only made to the connection string if the OS is Windows and if it is running on the .NET Core runtime.