ConnectionString in appsettings.json: Use in Entity Framework Core for SQL Server

Published: 09 October 2022
on channel: Round The Code
12,983
119

A connection string can be set in appsettings.json so a .NET application can integrate with SQL Server.

We'll show you how to set up a connection string in appsettings.json so it can be read in an ASP.NET Core web app.

The ConnectionString section can also be used with Entity Framework Core to communicate with a database.

As a result, it allows Entity Framework to be used in different parts of an application, such as a controller in a Web API, or in an MVC application.

We'll show you how to integrate EF Core with appsettings.json so it can communicate with SQL Server through a connection string. Our example will read data from the database, which will be shown with the output of a query from the DbContext.

This is part 2 of our appsettings.json course. The full playlist is here:
   • AppSettings.json course  

💻 Download the code example for this demo 💻
https://www.roundthecode.com/dotnet-c...

📖 Learn .NET and C# with our online courses 📖
https://www.roundthecode.com/dotnet-c...

► Chapters
0:00 How ConnectionString is used in AppSettings.json
0:25 Learn .NET with our online courses
0:35 Add ConnectionString to AppSettings.json
0:55 SQL Server database used for example
1:11 Entity Framework DbContext setup
1:49 Add DbContext to Program.cs
2:55 Read the DbContext in an ASP.NET Core Web API
4:39 Preview of next part

#appsettings #connectionstring #entityframework


On this page of the site you can watch the video online ConnectionString in appsettings.json: Use in Entity Framework Core for SQL Server with a duration of hours minute second in good quality, which was uploaded by the user Round The Code 09 October 2022, share the link with friends and acquaintances, this video has already been watched 12,983 times on youtube and it was liked by 119 viewers. Enjoy your viewing!