• 00
  • :
  • 00
  • :
  • 00

EFCore Database-first 批处理生成表结构

===数据库优先===
https://docs.microsoft.com/en-us/ef/core/miscellaneous/cli/powershell
https://docs.microsoft.com/zh-cn/ef/core/managing-schemas/scaffolding?tabs=dotnet-core-cli

 

生成迁移 bat_Migrations.bat  

@echo off
setlocal enabledelayedexpansion
set gztmp=register
set gzcontext=RegisterEntitiesContext
set gzproject=../GZSales.API.Register
echo 请输入迁移名称
set /p gzname=
echo 迁移生成中,请稍后...
dotnet ef migrations add %gzname%%gztmp% --context %gzcontext% --project "%gzproject%" --startup-project "../GZSales.API.Start"
pause

刷新模型:bat_refreshModel

dotnet ef dbcontext scaffold Name=ConnectionStrings.GZNETCore.Developer Microsoft.EntityFrameworkCore.SqlServer --output-dir "Tables" --table "data_register_product" --table "data_register_EzCadTools" --use-database-names --force --data-annotations --context "_RegisterEntitiesContext" --project "../GZSales.API.Register" --startup-project "../GZSales.API.Start" 

pause

 

posted @ 2020-11-08 00:35  Garson_Zhang  阅读(129)  评论(0编辑  收藏  举报