Update working-with-sql.md
parent
16255dfe17
commit
fea3ca8c7f
|
@ -18,11 +18,11 @@ By [Rick Anderson](https://twitter.com/RickAndMSFT)
|
|||
|
||||
The `MvcMovieContext` object handles the task of connecting to the database and mapping `Movie` objects to database records. The database context is registered with the [Dependency Injection](xref:fundamentals/dependency-injection) container in the `ConfigureServices` method in the *Startup.cs* file:
|
||||
|
||||
[!code-csharp[Main](start-mvc/sample/MvcMovie/Startup.cs?name=snippet_cs&highlight=6-8)]
|
||||
[!code-csharp[Main](start-mvc/sample/MvcMovie/Startup.cs?name=snippet_cs&highlight=7)]
|
||||
|
||||
The ASP.NET Core [Configuration](xref:fundamentals/configuration) system reads the `ConnectionString`. For local development, it gets the connection string from the *appsettings.json* file:
|
||||
|
||||
[!code-javascript[Main](start-mvc/sample/MvcMovie/appsettings.json?highlight=3&range=8-10)]
|
||||
[!code-javascript[Main](start-mvc/sample/MvcMovie/appsettings.json?highlight=2&range=8-10)]
|
||||
|
||||
When you deploy the app to a test or production server, you can use an environment variable or another approach to set the connection string to a real SQL Server. See [Configuration](xref:fundamentals/configuration) for more information.
|
||||
|
||||
|
|
Loading…
Reference in New Issue