App: NuGet and AppSettings

This chapter assumes that MySQL is installed locally.

Adding MySQL Library to the Application via NuGet

  1. Please start with marking “UnicornStore” project as a Startup Project in Visual Studio.
  2. Open “Package Manager Console” by selecting it from the “View | Other Windows” menu.
  3. Install Pomelo.EntityFrameworkCore.MySql version 3.0 package by running following command in Visual Studio “Package Manager Console”:

    Install-Package Pomelo.EntityFrameworkCore.MySql -Version 3.0.0

Adding Default Connection String to “appSettings.json”

Open “appSettings.json” file of the “UnicornStore” project and add following entry to the “ConnectionStrings” section.

"UnicornStoreMySQL": "Server=localhost;Database=UnicornStore;Uid=root;Pwd=NeverEVERsavePasswordInConfigFiles;"

Don’t forget the comma before or after the “UnicornStoreMySQL” property.