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

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

主站蜘蛛池模板: 莱西市| 三门峡市| 永州市| 翁牛特旗| 双江| 通山县| 松江区| 满洲里市| 甘谷县| 常宁市| 双辽市| 永宁县| 建瓯市| 宁强县| 邵武市| 剑河县| 五河县| 荆州市| 盐池县| 克什克腾旗| 修武县| 道真| 扬中市| 武夷山市| 华蓥市| 桐乡市| 宜君县| 呼和浩特市| 黄冈市| 洪湖市| 茂名市| 堆龙德庆县| 双江| 保亭| 元氏县| 化州市| 双桥区| 柞水县| 榆中县| 简阳市| 日喀则市|