This article is a mirror article of machine translation, please click here to jump to the original article.

View: 18757|Reply: 0

[.NET Core] .NET Core Entity uses Entity Framework Core to link databases

[Copy link]
Posted on 5/7/2019 1:21:33 PM | | |
Start by installing the Nuget package


Micorsoft.EntityFrameworkCore: The core package of the EF framework
Micorsoft.EntityFrameworkCore.SqlServer:针对SqlServer数据库的扩展

Second, set the data connection string for the (appsettings.json) profile

Create an entity (province)

Method 1: Link the database through configuration

1. Create an Entity Framework Core configuration

2. Startup Startup Registration Link

3. Index.cshtml.cs call data

Method 2: Customize the configuration link database

1. Create an Entity Framework Core configuration

2. Startup to get the configuration link

3. Index.cshtml.cs call data







Previous:The vscode search icon is missing
Next:ASP.NET Core dependency injection uses the IOC container that comes with it
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com