From e2dd4b24667f1ed95ff0d93aab8b650550d9411a Mon Sep 17 00:00:00 2001 From: hang <87227557@qq.com> Date: Mon, 9 Sep 2024 00:37:20 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E7=94=9F=E6=88=90=E6=9C=80?= =?UTF-8?q?=E7=BB=88=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.Test/AutoPowershell.ps1 | 30 +++++++++++++++++++++++++++++ IRaCIS.Core.Test/模板使用说明 | 7 ++++++- 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 IRaCIS.Core.Test/AutoPowershell.ps1 diff --git a/IRaCIS.Core.Test/AutoPowershell.ps1 b/IRaCIS.Core.Test/AutoPowershell.ps1 new file mode 100644 index 000000000..2dd9c1823 --- /dev/null +++ b/IRaCIS.Core.Test/AutoPowershell.ps1 @@ -0,0 +1,30 @@ + + +# б Scaffold +param ( + [string[]]$Tables +) + + +# б +$tablesForScaffold = "" +foreach ($table in $Tables) { + $tablesForScaffold += "-t $table " +} + +$tablesForRun = $Tables -join " " + +Write-Host $tablesForScaffold + +Write-Host "ִ Scaffold-DbContext..." + +#dotnet ef dbcontext scaffold "Server=106.14.89.110,1435;Database=Test_IRC;User ID=sa;Password=xc@123456;TrustServerCertificate=true" Microsoft.EntityFrameworkCore.SqlServer -p IRaCIS.Core.Test -d -o GenerateFolder -c "TempContext" $tablesForScaffold +$scaffoldCommand = "dotnet ef dbcontext scaffold `"Server=106.14.89.110,1435;Database=Test_IRC;User ID=sa;Password=xc@123456;TrustServerCertificate=true`" Microsoft.EntityFrameworkCore.SqlServer -p IRaCIS.Core.Test -d -o GenerateFolder -c `"TempContext`" $tablesForScaffold" +Invoke-Expression $scaffoldCommand + + +Write-Host "ִ dotnet run..." +#dotnet run --project IRaCIS.Core.Test -- $tablesForRun +# ʹ Invoke-Expression ֱִйõ +$runCommand = "dotnet run --project IRaCIS.Core.Test -- $tablesForRun" +Invoke-Expression $runCommand \ No newline at end of file diff --git a/IRaCIS.Core.Test/模板使用说明 b/IRaCIS.Core.Test/模板使用说明 index 7117a6510..599a537ba 100644 --- a/IRaCIS.Core.Test/模板使用说明 +++ b/IRaCIS.Core.Test/模板使用说明 @@ -34,4 +34,9 @@ dotnet ef dbcontext scaffold "Server=106.14.89.110,1435;Database=Test_IRC;User I 开发者PowerShell || 程序包管理控制台命令行 使用: 通过Liquid模板生成基础视图模型、服务接口、服务实现基本方法(必须先有数据库实体模型,否则视图模型无法生成) - dotnet run --project IRaCIS.Core.Test -- Dictionary Site \ No newline at end of file + dotnet run --project IRaCIS.Core.Test -- Dictionary Site + + +自动脚本方便执行两句脚本: + +./IRaCIS.Core.Test/AutoPowershell.ps1 -Tables Dictionary, Site \ No newline at end of file