Getting to know .Net Core EF (query)

Step 1: Create a project (in terms of console )

 

 

The second step is to install EF ( four steps )

(1)install-package microsoft.entityframeworkcore.sqlserver
(2)install-package microsoft.entityframeworkcore.tools
(3)install-package microsoft.entityframeworkcore.sqlserver.design
(4)Scaffold-DbContext "Server=.;Database=users;Uid=sa;Pwd=123456;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models

 

 

 

 

 

 Start to do a simple query function

 Such a simple demo is over. There is no difference between .net core ef and .net ef in this example code, that is, .net core ef needs to be installed and connected to the database manually, while .net ef uses Model First, For DBFirst and Code First , the connection is automatically generated in web.config.

 

Little Baiyuan, who was studying silently, passed by, and the eldest man saw what was lacking, so he could give advice. . . . . . . . . . .

Guess you like

Origin blog.csdn.net/weixin_48175309/article/details/109288767