From 991e4cf655f4ffacfa4b94e85a96a7ffbeeb8de7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=81AS?= Date: Tue, 26 Mar 2024 03:24:42 +0000 Subject: [PATCH] =?UTF-8?q?update=20tools/cli.ps1.=20=E5=8E=9F=E6=AD=A3?= =?UTF-8?q?=E5=88=99=E8=A1=A8=E8=BE=BE=E5=BC=8F=E5=86=8D=E5=8C=B9=E9=85=8D?= =?UTF-8?q?entity=3D>{}=E4=B8=AD=E5=AD=98=E5=9C=A8{}=E6=97=B6=E4=BC=9A?= =?UTF-8?q?=E5=8C=B9=E9=85=8D=E9=94=99=E8=AF=AF=EF=BC=8C=E5=BB=BA=E8=AE=AE?= =?UTF-8?q?=E6=94=B9=E6=88=90=E8=BF=99=E4=B8=AAmodelBuilder.Entity\<(=3F\w+)\>\(entity\s=3D\>\n*[\s\S]*=3F\{(=3F(=3F:[^{}?= =?UTF-8?q?]|(=3F{)|(=3F<-open>}))+(=3F(open)(=3F!)))\}\);=20?= =?UTF-8?q?=E7=AC=AC=E4=BA=8C=E4=B8=AA=E5=9C=B0=E6=96=B9=E5=BD=93=E5=AD=98?= =?UTF-8?q?=E5=9C=A8entity=20.HasNoKey()=E8=BF=99=E7=A7=8D=E6=9C=89?= =?UTF-8?q?=E6=8D=A2=E8=A1=8C=E5=BE=97=E6=83=85=E5=86=B5=E4=B8=8B=E6=9F=A5?= =?UTF-8?q?=E6=89=BE=E6=9B=BF=E6=8D=A2=E5=A4=B1=E8=B4=A5=EF=BC=8C=E5=BB=BA?= =?UTF-8?q?=E8=AE=AE=E6=94=B9=E6=88=90=E6=AD=A3=E5=88=99=E5=8C=B9=E9=85=8D?= =?UTF-8?q?'(=3Fms)(entity\s*\.\s*)'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 丁AS --- tools/cli.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/cli.ps1 b/tools/cli.ps1 index a823cf1763..2757227935 100644 --- a/tools/cli.ps1 +++ b/tools/cli.ps1 @@ -1,4 +1,4 @@ -# 定义参数 +# 定义参数 Param( # 需要生成的表,不填则生成所有表 [string[]] $Tables, @@ -442,7 +442,7 @@ Write-Output "$FurTools 开始生成实体文件......"; # 获取 DbContext 生成的配置内容 $dbContextContent = Get-Content "$TempOutputDir\$Context.cs" -raw; -$entityConfigures = [regex]::Matches($dbContextContent, "modelBuilder.Entity\<(?\w+)\>\(entity\s=\>\n*[\s\S]*?\{(?[\s\S]*?)\s*\n+\s*\}\);"); +$entityConfigures = [regex]::Matches($dbContextContent, "modelBuilder.Entity\<(?
\w+)\>\(entity\s=\>\n*[\s\S]*?\{(?(?:[^{}]|(?{)|(?<-open>}))+(?(open)(?!)))\}\);"); # 定义字典集合 $dic = New-Object -TypeName 'System.Collections.Generic.Dictionary[System.String, System.String]'; @@ -451,7 +451,7 @@ $dic = New-Object -TypeName 'System.Collections.Generic.Dictionary[System.String for ($i = 0; $i -le $entityConfigures.Count - 1; $i++){ $groups = $entityConfigures[$i].Groups; $tableName = $groups.Value[1]; - $configure = $groups.Value[2].Replace("entity.", "entityBuilder."); + $configure = $groups.Value[2] -replace '(?ms)(entity\s*\.\s*)', 'entityBuilder.' $dic.Add($tableName, $configure); } -- Gitee