April 2017
Intermediate to advanced
564 pages
24h 7m
English
To define connection strings, add the Application Configuration file known as appsettings.json and specify the SQL server connection string, as follows:
{ "ConnectionStrings": { "DefaultConnection": "Data Source=.; Initial Catalog=ERPDB; Integrated Security=True;" } }
In the Startup class, we can now add this appsettings.json file to read all the key values defined and build a dictionary object that can be used to refer the connection string. Add the following code snippet in the Startup constructor:
public Startup(IHostingEnvironment env) { var builder = new ConfigurationBuilder() ...Read now
Unlock full access