官术网_书友最值得收藏!

The appsettings.json setting

The application settings, as we explored earlier, are based on JSON, and in order to include a setting, we need to add a JSON key-value pair. In our case, ConnectionStrings is the key and the value is again a JSON object that defines DefaultConnection:

    {
"ConnectionStrings": {
"DefaultConnection": "Server=
(localdb)\\mssqllocaldb;Database=MasteringEFCoreDbFirst;
Trusted_Connection=True;MultipleActiveResultSets=true"

},
"Logging": {
"IncludeScopes": false,
"LogLevel": {
"Default": "Warning"
}
}
}

In this section, we have configured the database context in the ConfigureServices() method and also leveraged appsettings.json to make the connection configurable. At this point, all the configuration necessary is completed and EF is ready to consume the database for further implementation. Let's see how the CRUD operations could be performed using EF (we have already seen them in Chapter 1Kickstart - Introduction to Entity Framework Core, but still, we will explore a few parts with respect to rendering that which were not covered earlier).

主站蜘蛛池模板: 汾西县| 潼南县| 永福县| 四子王旗| 顺义区| 古浪县| 阳江市| 蒙阴县| 体育| 丁青县| 岳池县| 德兴市| 临西县| 长沙市| 双鸭山市| 山丹县| 五河县| 富蕴县| 郴州市| 黄骅市| 怀集县| 专栏| 眉山市| 出国| 安丘市| 贵州省| 平陆县| 霍邱县| 深泽县| 连南| 徐水县| 乌兰浩特市| 基隆市| 彩票| 轮台县| 新平| 临泽县| 永顺县| 义马市| 古丈县| 临颍县|