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 寮鍙戣匬owerShell || 绋嬪簭鍖呯鐞嗘帶鍒跺彴鍛戒护琛 浣跨敤锛 閫氳繃Liquid妯℃澘鐢熸垚鍩虹瑙嗗浘妯″瀷銆佹湇鍔℃帴鍙c佹湇鍔″疄鐜板熀鏈柟娉曪紙蹇呴』鍏堟湁鏁版嵁搴撳疄浣撴ā鍨嬶紝鍚﹀垯瑙嗗浘妯″瀷鏃犳硶鐢熸垚锛 - 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