EF

Entity Framework 常用命令

Code First

初始化

1
> Add-Migration InitialCreate

更新

1
Update-Database

Db First

Sql Server

1
Scaffold-DbContext "Data Source=(IP,Port);Initial Catalog=Yt;User ID=sa;Password=(密码)" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models1

MySql

1
> Scaffold-DbContext "Data Source=(IP);port=3316;Initial Catalog=YT;user id=root;password=(密码)" Pomelo.EntityFrameworkCore.MySql