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

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).

主站蜘蛛池模板: 调兵山市| 佛学| 宿州市| 清河县| 洪洞县| 辽源市| 曲阜市| 土默特右旗| 内黄县| 宁武县| 通州市| 弋阳县| 茂名市| 福建省| 崇阳县| 威海市| 手机| 谢通门县| 大理市| 东源县| 稷山县| 金阳县| 安丘市| 盱眙县| 溧水县| 黔东| 那坡县| 车险| 龙岩市| 邢台县| 赤壁市| 庆城县| 扶绥县| 奎屯市| 兴国县| 安新县| 安徽省| 茌平县| 石屏县| 高州市| 营山县|