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

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

主站蜘蛛池模板: 兴山县| 平江县| 新巴尔虎右旗| 泽普县| 长顺县| 开封市| 沙雅县| 资溪县| 图片| 寿光市| 澳门| 泸定县| 盐城市| 马尔康县| 常山县| 巍山| 锦州市| 沁阳市| 陕西省| 建德市| 南溪县| 扶风县| 永年县| 清水河县| 林州市| 遵化市| 延长县| 惠水县| 泸西县| 襄樊市| 富蕴县| 清镇市| 驻马店市| 江门市| 海门市| 新竹县| 屏东市| 巫山县| 新乡县| 台南市| 老河口市|