diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 39aa5df43..cb3855bc6 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -2,7 +2,7 @@ name: "Publish" on: push: - branches: [ rel-8.2.2 ] + branches: [ rel-8.3.0 ] env: DOTNET_VERSION: "8.0.200" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a145049b0..a7794b528 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,7 +2,7 @@ name: "Tagged Release" on: push: - branches: [ rel-8.2.2 ] + branches: [ rel-8.3.0 ] jobs: tagged-release: @@ -14,4 +14,4 @@ jobs: with: repo_token: "${{ secrets.GITHUB_TOKEN }}" prerelease: false - automatic_release_tag: "8.2.2" + automatic_release_tag: "8.3.0" diff --git a/Directory.Packages.props b/Directory.Packages.props index ca0339a4c..e1ac25e84 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -2,8 +2,8 @@ 8.2.0 2.14.1 - 8.2.2 - 8.2.2 + 8.3.0 + 8.3.0 8.0.0 8.0.0 8.0.0 @@ -225,7 +225,9 @@ + + @@ -246,7 +248,7 @@ - + diff --git a/apps/vue/docker/nginx/default.conf b/apps/vue/docker/nginx/default.conf index db8e757a6..0956b8c9c 100644 --- a/apps/vue/docker/nginx/default.conf +++ b/apps/vue/docker/nginx/default.conf @@ -42,6 +42,9 @@ server { proxy_pass http://www.nmc.cn/; proxy_set_header Host www.nmc.cn; proxy_set_header Referer http://www.nmc.cn; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header REMOTE-HOST $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } location /signalr-hubs/ { diff --git a/apps/vue/src/utils/http/axios/index.ts b/apps/vue/src/utils/http/axios/index.ts index 56bf43550..c49e6ecb3 100644 --- a/apps/vue/src/utils/http/axios/index.ts +++ b/apps/vue/src/utils/http/axios/index.ts @@ -186,7 +186,11 @@ function createAxios(opt?: Partial) { // 基础接口地址 // baseURL: globSetting.apiUrl, - headers: { 'Content-Type': ContentTypeEnum.JSON }, + headers: { + 'Content-Type': ContentTypeEnum.JSON, + // 取消后端cookie重定向 + 'X-Request-From': 'vben', + }, // 如果是form-data格式 // headers: { 'Content-Type': ContentTypeEnum.FORM_URLENCODED }, // 数据处理方式 diff --git a/apps/vue/src/views/oss-management/objects/components/OssUploadModal.vue b/apps/vue/src/views/oss-management/objects/components/OssUploadModal.vue index f2eb4f42d..47590c23e 100644 --- a/apps/vue/src/views/oss-management/objects/components/OssUploadModal.vue +++ b/apps/vue/src/views/oss-management/objects/components/OssUploadModal.vue @@ -60,6 +60,7 @@ import { BasicTable, TableAction, useTable } from '/@/components/Table'; import { uploadUrl } from '/@/api/oss-management/objects'; import { useUserStoreWithOut } from '/@/store/modules/user'; + import { Result } from '/#/axios'; import Uploader from 'simple-uploader.js'; const emits = defineEmits(['file:uploaded', 'register']); @@ -172,7 +173,20 @@ fileList.value.push(...files); } - function _fileProgress(_, file) { + function _fileProgress(_, file, chunk) { + // 2024-09-29 处理上传失败的包装错误 + if (chunk.processedState?.res) { + try { + const result = JSON.parse(chunk.processedState.res) as Result; + if (result.code !== '0') { + file.error = true; + file.errorMsg = result.message; + file.pause(); + } + } catch (error) { + console.log('upload error ---> ', error); + } + } if (file._prevUploadedSize) { file.progress = `${Math.floor((file._prevUploadedSize / file.size) * 100)} %`; } diff --git a/aspnet-core/LINGYUN.MicroService.SingleProject.sln b/aspnet-core/LINGYUN.MicroService.SingleProject.sln index 03a4f861b..09f561a76 100644 --- a/aspnet-core/LINGYUN.MicroService.SingleProject.sln +++ b/aspnet-core/LINGYUN.MicroService.SingleProject.sln @@ -425,6 +425,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution ..\Directory.Build.props = ..\Directory.Build.props ..\Directory.Packages.props = ..\Directory.Packages.props ..\NuGet.Config = ..\NuGet.Config + ..\README.en.md = ..\README.en.md + ..\README.md = ..\README.md EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "dapr", "dapr", "{FD9F5933-FDE5-4504-99BF-9050E0435C6D}" @@ -539,13 +541,61 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.WeChat.Work.Han EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.MultiTenancy.Saas", "modules\saas\LINGYUN.Abp.MultiTenancy.Saas\LINGYUN.Abp.MultiTenancy.Saas.csproj", "{E3C07A77-EAF9-4A3F-8814-7D2F116C8E26}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.IP2Region", "framework\common\LINGYUN.Abp.IP2Region\LINGYUN.Abp.IP2Region.csproj", "{DA54E88E-C43E-4E31-92D0-08A753F2C08D}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.IP2Region", "framework\common\LINGYUN.Abp.IP2Region\LINGYUN.Abp.IP2Region.csproj", "{DA54E88E-C43E-4E31-92D0-08A753F2C08D}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.TestsBase", "tests\LINGYUN.Abp.TestBase\LINGYUN.Abp.TestsBase.csproj", "{A7417E7F-DB97-48DB-B849-AFC15854A6E7}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Aliyun.Tests", "tests\LINGYUN.Abp.Aliyun.Tests\LINGYUN.Abp.Aliyun.Tests.csproj", "{8DDE4291-BC57-4C56-9871-B982462F4C3D}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.IP2Region.Tests", "tests\LINGYUN.Abp.IP2Region.Tests\LINGYUN.Abp.IP2Region.Tests.csproj", "{C5D64A2B-7E7E-4509-9F31-425D59712E6F}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.IP2Region.Tests", "tests\LINGYUN.Abp.IP2Region.Tests\LINGYUN.Abp.IP2Region.Tests.csproj", "{C5D64A2B-7E7E-4509-9F31-425D59712E6F}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "data-protection", "data-protection", "{07C2FB08-985C-42FE-85AF-38E40A301668}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.DataProtection.Abstractions", "framework\data-protection\LINGYUN.Abp.DataProtection.Abstractions\LINGYUN.Abp.DataProtection.Abstractions.csproj", "{A52C54FB-C96D-4032-8588-AFC2CD158D23}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.DataProtection", "framework\data-protection\LINGYUN.Abp.DataProtection\LINGYUN.Abp.DataProtection.csproj", "{B05ED61E-9A36-4E90-B876-F48559E018A6}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.DataProtection.EntityFrameworkCore", "framework\data-protection\LINGYUN.Abp.DataProtection.EntityFrameworkCore\LINGYUN.Abp.DataProtection.EntityFrameworkCore.csproj", "{1E8DE890-F27F-4A1A-B356-0B6B9D3B1EF7}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "data-protection", "data-protection", "{4FCD7337-4320-412D-9BC8-A0B243BC27B3}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.DataProtectionManagement.Domain.Shared", "modules\data-protection\LINGYUN.Abp.DataProtectionManagement.Domain.Shared\LINGYUN.Abp.DataProtectionManagement.Domain.Shared.csproj", "{9D2C789C-8241-4F53-AFEF-F2AB15BAA823}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.DataProtectionManagement.Domain", "modules\data-protection\LINGYUN.Abp.DataProtectionManagement.Domain\LINGYUN.Abp.DataProtectionManagement.Domain.csproj", "{36AEA095-E34D-43F5-8000-9FA3A696C312}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.DataProtectionManagement.Application.Contracts", "modules\data-protection\LINGYUN.Abp.DataProtectionManagement.Application.Contracts\LINGYUN.Abp.DataProtectionManagement.Application.Contracts.csproj", "{2D5A9AB0-9F32-4784-8972-814F86C0239D}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.DataProtectionManagement.Application", "modules\data-protection\LINGYUN.Abp.DataProtectionManagement.Application\LINGYUN.Abp.DataProtectionManagement.Application.csproj", "{A4ECDDC4-1115-48A2-AC74-3B75B58F8FFB}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.DataProtectionManagement.EntityFrameworkCore", "modules\data-protection\LINGYUN.Abp.DataProtectionManagement.EntityFrameworkCore\LINGYUN.Abp.DataProtectionManagement.EntityFrameworkCore.csproj", "{AF15C829-9288-4D7F-95A0-4EA8DF909929}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.DataProtectionManagement.HttpApi", "modules\data-protection\LINGYUN.Abp.DataProtectionManagement.HttpApi\LINGYUN.Abp.DataProtectionManagement.HttpApi.csproj", "{616652A5-A420-475C-AC9F-FC687E3C768B}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "demo", "demo", "{E29EC2A4-A2DE-442F-8616-DAFD69F128B8}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Demo.Domain.Shared", "modules\demo\LINGYUN.Abp.Demo.Domain.Shared\LINGYUN.Abp.Demo.Domain.Shared.csproj", "{D736C433-C230-46B7-9D43-17D0282EBBDF}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Demo.Domain", "modules\demo\LINGYUN.Abp.Demo.Domain\LINGYUN.Abp.Demo.Domain.csproj", "{FA525A71-C0BF-49FB-BAB7-547944618587}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Demo.Application.Contracts", "modules\demo\LINGYUN.Abp.Demo.Application.Contracts\LINGYUN.Abp.Demo.Application.Contracts.csproj", "{532D5703-0090-4F2E-B725-5786D53506C9}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Demo.Application", "modules\demo\LINGYUN.Abp.Demo.Application\LINGYUN.Abp.Demo.Application.csproj", "{E538580B-A21F-4B3B-9CB4-741FE8C1C6EF}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Demo.EntityFrameworkCore", "modules\demo\LINGYUN.Abp.Demo.EntityFrameworkCore\LINGYUN.Abp.Demo.EntityFrameworkCore.csproj", "{71CF0E82-FA07-472A-B32A-AC25EDA82BB0}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Demo.HttpApi", "modules\demo\LINGYUN.Abp.Demo.HttpApi\LINGYUN.Abp.Demo.HttpApi.csproj", "{77965572-373C-4319-9EF9-73D6E660044B}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "exporter", "exporter", "{4A2CF141-F32D-45A0-8665-B3705667A6D2}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.Exporter.Application.Contracts", "framework\exporter\LINGYUN.Abp.Exporter.Application.Contracts\LINGYUN.Abp.Exporter.Application.Contracts.csproj", "{A3924A79-1ADC-458D-8764-3958297BDEB0}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.Exporter.Application", "framework\exporter\LINGYUN.Abp.Exporter.Application\LINGYUN.Abp.Exporter.Application.csproj", "{38A933EB-82F1-42A6-ABF3-F55975B4078E}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.Exporter.Core", "framework\exporter\LINGYUN.Abp.Exporter.Core\LINGYUN.Abp.Exporter.Core.csproj", "{03C9FFB2-E9A3-4CCC-A6B1-8B248BFBCB65}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.Exporter.MiniExcel", "framework\exporter\LINGYUN.Abp.Exporter.MiniExcel\LINGYUN.Abp.Exporter.MiniExcel.csproj", "{CBC64BD6-297B-48F6-A3BA-0DBB4B0F5A69}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.Exporter.MagicodesIE.Excel", "framework\exporter\LINGYUN.Abp.Exporter.MagicodesIE.Excel\LINGYUN.Abp.Exporter.MagicodesIE.Excel.csproj", "{319428B9-CE7F-4027-92FA-6311C4CE95FB}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -1445,6 +1495,86 @@ Global {C5D64A2B-7E7E-4509-9F31-425D59712E6F}.Debug|Any CPU.Build.0 = Debug|Any CPU {C5D64A2B-7E7E-4509-9F31-425D59712E6F}.Release|Any CPU.ActiveCfg = Release|Any CPU {C5D64A2B-7E7E-4509-9F31-425D59712E6F}.Release|Any CPU.Build.0 = Release|Any CPU + {A52C54FB-C96D-4032-8588-AFC2CD158D23}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A52C54FB-C96D-4032-8588-AFC2CD158D23}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A52C54FB-C96D-4032-8588-AFC2CD158D23}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A52C54FB-C96D-4032-8588-AFC2CD158D23}.Release|Any CPU.Build.0 = Release|Any CPU + {B05ED61E-9A36-4E90-B876-F48559E018A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B05ED61E-9A36-4E90-B876-F48559E018A6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B05ED61E-9A36-4E90-B876-F48559E018A6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B05ED61E-9A36-4E90-B876-F48559E018A6}.Release|Any CPU.Build.0 = Release|Any CPU + {1E8DE890-F27F-4A1A-B356-0B6B9D3B1EF7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1E8DE890-F27F-4A1A-B356-0B6B9D3B1EF7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1E8DE890-F27F-4A1A-B356-0B6B9D3B1EF7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1E8DE890-F27F-4A1A-B356-0B6B9D3B1EF7}.Release|Any CPU.Build.0 = Release|Any CPU + {9D2C789C-8241-4F53-AFEF-F2AB15BAA823}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9D2C789C-8241-4F53-AFEF-F2AB15BAA823}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9D2C789C-8241-4F53-AFEF-F2AB15BAA823}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9D2C789C-8241-4F53-AFEF-F2AB15BAA823}.Release|Any CPU.Build.0 = Release|Any CPU + {36AEA095-E34D-43F5-8000-9FA3A696C312}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {36AEA095-E34D-43F5-8000-9FA3A696C312}.Debug|Any CPU.Build.0 = Debug|Any CPU + {36AEA095-E34D-43F5-8000-9FA3A696C312}.Release|Any CPU.ActiveCfg = Release|Any CPU + {36AEA095-E34D-43F5-8000-9FA3A696C312}.Release|Any CPU.Build.0 = Release|Any CPU + {2D5A9AB0-9F32-4784-8972-814F86C0239D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2D5A9AB0-9F32-4784-8972-814F86C0239D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2D5A9AB0-9F32-4784-8972-814F86C0239D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2D5A9AB0-9F32-4784-8972-814F86C0239D}.Release|Any CPU.Build.0 = Release|Any CPU + {A4ECDDC4-1115-48A2-AC74-3B75B58F8FFB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A4ECDDC4-1115-48A2-AC74-3B75B58F8FFB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A4ECDDC4-1115-48A2-AC74-3B75B58F8FFB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A4ECDDC4-1115-48A2-AC74-3B75B58F8FFB}.Release|Any CPU.Build.0 = Release|Any CPU + {AF15C829-9288-4D7F-95A0-4EA8DF909929}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AF15C829-9288-4D7F-95A0-4EA8DF909929}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AF15C829-9288-4D7F-95A0-4EA8DF909929}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AF15C829-9288-4D7F-95A0-4EA8DF909929}.Release|Any CPU.Build.0 = Release|Any CPU + {616652A5-A420-475C-AC9F-FC687E3C768B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {616652A5-A420-475C-AC9F-FC687E3C768B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {616652A5-A420-475C-AC9F-FC687E3C768B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {616652A5-A420-475C-AC9F-FC687E3C768B}.Release|Any CPU.Build.0 = Release|Any CPU + {D736C433-C230-46B7-9D43-17D0282EBBDF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D736C433-C230-46B7-9D43-17D0282EBBDF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D736C433-C230-46B7-9D43-17D0282EBBDF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D736C433-C230-46B7-9D43-17D0282EBBDF}.Release|Any CPU.Build.0 = Release|Any CPU + {FA525A71-C0BF-49FB-BAB7-547944618587}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FA525A71-C0BF-49FB-BAB7-547944618587}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FA525A71-C0BF-49FB-BAB7-547944618587}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FA525A71-C0BF-49FB-BAB7-547944618587}.Release|Any CPU.Build.0 = Release|Any CPU + {532D5703-0090-4F2E-B725-5786D53506C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {532D5703-0090-4F2E-B725-5786D53506C9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {532D5703-0090-4F2E-B725-5786D53506C9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {532D5703-0090-4F2E-B725-5786D53506C9}.Release|Any CPU.Build.0 = Release|Any CPU + {E538580B-A21F-4B3B-9CB4-741FE8C1C6EF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E538580B-A21F-4B3B-9CB4-741FE8C1C6EF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E538580B-A21F-4B3B-9CB4-741FE8C1C6EF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E538580B-A21F-4B3B-9CB4-741FE8C1C6EF}.Release|Any CPU.Build.0 = Release|Any CPU + {71CF0E82-FA07-472A-B32A-AC25EDA82BB0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {71CF0E82-FA07-472A-B32A-AC25EDA82BB0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {71CF0E82-FA07-472A-B32A-AC25EDA82BB0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {71CF0E82-FA07-472A-B32A-AC25EDA82BB0}.Release|Any CPU.Build.0 = Release|Any CPU + {77965572-373C-4319-9EF9-73D6E660044B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {77965572-373C-4319-9EF9-73D6E660044B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {77965572-373C-4319-9EF9-73D6E660044B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {77965572-373C-4319-9EF9-73D6E660044B}.Release|Any CPU.Build.0 = Release|Any CPU + {A3924A79-1ADC-458D-8764-3958297BDEB0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A3924A79-1ADC-458D-8764-3958297BDEB0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A3924A79-1ADC-458D-8764-3958297BDEB0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A3924A79-1ADC-458D-8764-3958297BDEB0}.Release|Any CPU.Build.0 = Release|Any CPU + {38A933EB-82F1-42A6-ABF3-F55975B4078E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {38A933EB-82F1-42A6-ABF3-F55975B4078E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {38A933EB-82F1-42A6-ABF3-F55975B4078E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {38A933EB-82F1-42A6-ABF3-F55975B4078E}.Release|Any CPU.Build.0 = Release|Any CPU + {03C9FFB2-E9A3-4CCC-A6B1-8B248BFBCB65}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {03C9FFB2-E9A3-4CCC-A6B1-8B248BFBCB65}.Debug|Any CPU.Build.0 = Debug|Any CPU + {03C9FFB2-E9A3-4CCC-A6B1-8B248BFBCB65}.Release|Any CPU.ActiveCfg = Release|Any CPU + {03C9FFB2-E9A3-4CCC-A6B1-8B248BFBCB65}.Release|Any CPU.Build.0 = Release|Any CPU + {CBC64BD6-297B-48F6-A3BA-0DBB4B0F5A69}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CBC64BD6-297B-48F6-A3BA-0DBB4B0F5A69}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CBC64BD6-297B-48F6-A3BA-0DBB4B0F5A69}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CBC64BD6-297B-48F6-A3BA-0DBB4B0F5A69}.Release|Any CPU.Build.0 = Release|Any CPU + {319428B9-CE7F-4027-92FA-6311C4CE95FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {319428B9-CE7F-4027-92FA-6311C4CE95FB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {319428B9-CE7F-4027-92FA-6311C4CE95FB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {319428B9-CE7F-4027-92FA-6311C4CE95FB}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -1712,6 +1842,30 @@ Global {A7417E7F-DB97-48DB-B849-AFC15854A6E7} = {37E2CAFE-0024-452E-BF81-E15F937E08EF} {8DDE4291-BC57-4C56-9871-B982462F4C3D} = {37E2CAFE-0024-452E-BF81-E15F937E08EF} {C5D64A2B-7E7E-4509-9F31-425D59712E6F} = {37E2CAFE-0024-452E-BF81-E15F937E08EF} + {07C2FB08-985C-42FE-85AF-38E40A301668} = {99B7CBDE-A251-4738-97F0-DB1DB484BEE1} + {A52C54FB-C96D-4032-8588-AFC2CD158D23} = {07C2FB08-985C-42FE-85AF-38E40A301668} + {B05ED61E-9A36-4E90-B876-F48559E018A6} = {07C2FB08-985C-42FE-85AF-38E40A301668} + {1E8DE890-F27F-4A1A-B356-0B6B9D3B1EF7} = {07C2FB08-985C-42FE-85AF-38E40A301668} + {4FCD7337-4320-412D-9BC8-A0B243BC27B3} = {0B58AA48-665A-443F-A6A8-751FB9629DAF} + {9D2C789C-8241-4F53-AFEF-F2AB15BAA823} = {4FCD7337-4320-412D-9BC8-A0B243BC27B3} + {36AEA095-E34D-43F5-8000-9FA3A696C312} = {4FCD7337-4320-412D-9BC8-A0B243BC27B3} + {2D5A9AB0-9F32-4784-8972-814F86C0239D} = {4FCD7337-4320-412D-9BC8-A0B243BC27B3} + {A4ECDDC4-1115-48A2-AC74-3B75B58F8FFB} = {4FCD7337-4320-412D-9BC8-A0B243BC27B3} + {AF15C829-9288-4D7F-95A0-4EA8DF909929} = {4FCD7337-4320-412D-9BC8-A0B243BC27B3} + {616652A5-A420-475C-AC9F-FC687E3C768B} = {4FCD7337-4320-412D-9BC8-A0B243BC27B3} + {E29EC2A4-A2DE-442F-8616-DAFD69F128B8} = {0B58AA48-665A-443F-A6A8-751FB9629DAF} + {D736C433-C230-46B7-9D43-17D0282EBBDF} = {E29EC2A4-A2DE-442F-8616-DAFD69F128B8} + {FA525A71-C0BF-49FB-BAB7-547944618587} = {E29EC2A4-A2DE-442F-8616-DAFD69F128B8} + {532D5703-0090-4F2E-B725-5786D53506C9} = {E29EC2A4-A2DE-442F-8616-DAFD69F128B8} + {E538580B-A21F-4B3B-9CB4-741FE8C1C6EF} = {E29EC2A4-A2DE-442F-8616-DAFD69F128B8} + {71CF0E82-FA07-472A-B32A-AC25EDA82BB0} = {E29EC2A4-A2DE-442F-8616-DAFD69F128B8} + {77965572-373C-4319-9EF9-73D6E660044B} = {E29EC2A4-A2DE-442F-8616-DAFD69F128B8} + {4A2CF141-F32D-45A0-8665-B3705667A6D2} = {99B7CBDE-A251-4738-97F0-DB1DB484BEE1} + {A3924A79-1ADC-458D-8764-3958297BDEB0} = {4A2CF141-F32D-45A0-8665-B3705667A6D2} + {38A933EB-82F1-42A6-ABF3-F55975B4078E} = {4A2CF141-F32D-45A0-8665-B3705667A6D2} + {03C9FFB2-E9A3-4CCC-A6B1-8B248BFBCB65} = {4A2CF141-F32D-45A0-8665-B3705667A6D2} + {CBC64BD6-297B-48F6-A3BA-0DBB4B0F5A69} = {4A2CF141-F32D-45A0-8665-B3705667A6D2} + {319428B9-CE7F-4027-92FA-6311C4CE95FB} = {4A2CF141-F32D-45A0-8665-B3705667A6D2} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {711A43C0-A2F8-4E5C-9B9F-F2551E4B3FF1} diff --git a/aspnet-core/framework/cli/LINGYUN.Abp.Cli/LINGYUN.Abp.Cli.csproj b/aspnet-core/framework/cli/LINGYUN.Abp.Cli/LINGYUN.Abp.Cli.csproj index dda8b1d80..1982a6cf6 100644 --- a/aspnet-core/framework/cli/LINGYUN.Abp.Cli/LINGYUN.Abp.Cli.csproj +++ b/aspnet-core/framework/cli/LINGYUN.Abp.Cli/LINGYUN.Abp.Cli.csproj @@ -5,7 +5,7 @@ Exe net8.0 - 8.2.1 + 8.3.0 colin Use LINGYUN.MicroService.Templates command line true diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN.Abp.DataProtection.Abstractions.csproj b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN.Abp.DataProtection.Abstractions.csproj index 6370f425a..1a4ba4ee6 100644 --- a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN.Abp.DataProtection.Abstractions.csproj +++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN.Abp.DataProtection.Abstractions.csproj @@ -13,8 +13,19 @@ + + + + + + + + + + + diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN/Abp/DataProtection/AbpDataProtectionAbstractionsModule.cs b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN/Abp/DataProtection/AbpDataProtectionAbstractionsModule.cs index dad08b9da..e698f6b06 100644 --- a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN/Abp/DataProtection/AbpDataProtectionAbstractionsModule.cs +++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN/Abp/DataProtection/AbpDataProtectionAbstractionsModule.cs @@ -1,9 +1,27 @@ -using Volo.Abp.Modularity; +using LINGYUN.Abp.DataProtection.Localization; +using Volo.Abp.Localization; +using Volo.Abp.Modularity; using Volo.Abp.ObjectExtending; +using Volo.Abp.VirtualFileSystem; namespace LINGYUN.Abp.DataProtection; +[DependsOn(typeof(AbpLocalizationModule))] [DependsOn(typeof(AbpObjectExtendingModule))] public class AbpDataProtectionAbstractionsModule : AbpModule { + public override void ConfigureServices(ServiceConfigurationContext context) + { + Configure(options => + { + options.FileSets.AddEmbedded(); + }); + + Configure(options => + { + options.Resources + .Add() + .AddVirtualJson("/LINGYUN/Abp/DataProtection/Localization/Resources"); + }); + } } diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN/Abp/DataProtection/DataAccessFilterOperate.cs b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN/Abp/DataProtection/DataAccessFilterOperate.cs index 844f4e424..c3064bdf9 100644 --- a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN/Abp/DataProtection/DataAccessFilterOperate.cs +++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN/Abp/DataProtection/DataAccessFilterOperate.cs @@ -6,64 +6,54 @@ namespace LINGYUN.Abp.DataProtection; /// public enum DataAccessFilterOperate { - /// - /// 且 - /// - [Description("且")] - And = 1, - /// - /// 或 - /// - [Description("或")] - Or = 2, /// /// 等于 /// [Description("等于")] - Equal = 3, + Equal = 1, /// /// 不等于 /// [Description("不等于")] - NotEqual = 4, + NotEqual = 2, /// /// 小于 /// [Description("小于")] - Less = 5, + Less = 3, /// /// 小于或等于 /// [Description("小于等于")] - LessOrEqual = 6, + LessOrEqual = 4, /// /// 大于 /// [Description("大于")] - Greater = 7, + Greater = 5, /// /// 大于或等于 /// [Description("大于等于")] - GreaterOrEqual = 8, + GreaterOrEqual = 6, /// /// 左包含 /// [Description("左包含")] - StartsWith = 9, + StartsWith = 7, /// /// 右包含 /// [Description("右包含")] - EndsWith = 10, + EndsWith = 8, /// /// 包含 /// [Description("包含")] - Contains = 11, + Contains = 9, /// /// 不包含 /// [Description("不包含")] - NotContains = 12, + NotContains = 10, } \ No newline at end of file diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN/Abp/DataProtection/Localization/Resources/en.json b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN/Abp/DataProtection/Localization/Resources/en.json new file mode 100644 index 000000000..ff637aac0 --- /dev/null +++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN/Abp/DataProtection/Localization/Resources/en.json @@ -0,0 +1,6 @@ +{ + "culture": "en", + "texts": { + "DataProtection:010001": "Data access permission not granted to protected resources!" + } +} \ No newline at end of file diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN/Abp/DataProtection/Localization/Resources/zh-Hans.json b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN/Abp/DataProtection/Localization/Resources/zh-Hans.json new file mode 100644 index 000000000..964c7ab93 --- /dev/null +++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.Abstractions/LINGYUN/Abp/DataProtection/Localization/Resources/zh-Hans.json @@ -0,0 +1,6 @@ +{ + "culture": "zh-Hans", + "texts": { + "DataProtection:010001": "未授予受保护资源的数据访问权限!" + } +} \ No newline at end of file diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.EntityFrameworkCore/LINGYUN/Abp/DataProtection/EntityFrameworkCore/AbpDataProtectedWriteEntityInterceptor.cs b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.EntityFrameworkCore/LINGYUN/Abp/DataProtection/EntityFrameworkCore/AbpDataProtectedWriteEntityInterceptor.cs index 59b497734..03e0e1f48 100644 --- a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.EntityFrameworkCore/LINGYUN/Abp/DataProtection/EntityFrameworkCore/AbpDataProtectedWriteEntityInterceptor.cs +++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.EntityFrameworkCore/LINGYUN/Abp/DataProtection/EntityFrameworkCore/AbpDataProtectedWriteEntityInterceptor.cs @@ -7,7 +7,6 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; using Volo.Abp; -using Volo.Abp.Authorization; using Volo.Abp.Data; using Volo.Abp.DependencyInjection; using Volo.Abp.Domain.Entities; @@ -40,7 +39,7 @@ public class AbpDataProtectedWriteEntityInterceptor : SaveChangesInterceptor, IT var entityKeys = updateEntites .Select(entity => (entity is IEntity abpEntity ? abpEntity.GetKeys() : new string[1] { entity.ToString() }).ToString()) .JoinAsString(";"); - throw new AbpAuthorizationException( + throw new AbpDataAccessDeniedException( $"Delete data permission not granted to entity {updateEntites.First().GetType()} for data {entityKeys}!"); } } @@ -56,7 +55,7 @@ public class AbpDataProtectedWriteEntityInterceptor : SaveChangesInterceptor, IT var entityKeys = deleteEntites .Select(entity => (entity is IEntity abpEntity ? abpEntity.GetKeys() : new string[1] { entity.ToString() }).ToString()) .JoinAsString(";"); - throw new AbpAuthorizationException( + throw new AbpDataAccessDeniedException( $"Delete data permission not granted to entity {deleteEntites.First().GetType()} for data {entityKeys}!"); } } diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.EntityFrameworkCore/LINGYUN/Abp/DataProtection/EntityFrameworkCore/AbpDataProtectionDbContext.cs b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.EntityFrameworkCore/LINGYUN/Abp/DataProtection/EntityFrameworkCore/AbpDataProtectionDbContext.cs index 09b24b506..5f792f1ee 100644 --- a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.EntityFrameworkCore/LINGYUN/Abp/DataProtection/EntityFrameworkCore/AbpDataProtectionDbContext.cs +++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection.EntityFrameworkCore/LINGYUN/Abp/DataProtection/EntityFrameworkCore/AbpDataProtectionDbContext.cs @@ -16,8 +16,7 @@ public abstract class AbpDataProtectionDbContext : AbpDbContext DataProtectionOptions => LazyServiceProvider.LazyGetRequiredService>(); public ICurrentUser CurrentUser => LazyServiceProvider.LazyGetRequiredService(); - public AbpDataProtectionDbContext( - DbContextOptions options) : base(options) + protected AbpDataProtectionDbContext(DbContextOptions options) : base(options) { } diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/AbpDataAccessDeniedException.cs b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/AbpDataAccessDeniedException.cs new file mode 100644 index 000000000..41265fc74 --- /dev/null +++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/AbpDataAccessDeniedException.cs @@ -0,0 +1,14 @@ +using Volo.Abp; + +namespace LINGYUN.Abp.DataProtection; +public class AbpDataAccessDeniedException : BusinessException +{ + public AbpDataAccessDeniedException() + { + } + + public AbpDataAccessDeniedException(string message) + : base("DataProtection:010001", message) + { + } +} diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/AbpDataProtectionModule.cs b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/AbpDataProtectionModule.cs index a1b59af62..982b7757a 100644 --- a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/AbpDataProtectionModule.cs +++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/AbpDataProtectionModule.cs @@ -4,7 +4,7 @@ using LINGYUN.Abp.DataProtection.Operations; using LINGYUN.Abp.DataProtection.Subjects; using Microsoft.Extensions.DependencyInjection; using Volo.Abp.Domain; -using Volo.Abp.Localization; +using Volo.Abp.Localization.ExceptionHandling; using Volo.Abp.Modularity; namespace LINGYUN.Abp.DataProtection; @@ -37,13 +37,14 @@ public class AbpDataProtectionModule : AbpModule options.OperateContributors.Add(DataAccessFilterOperate.NotContains, new DataAccessNotContainsContributor()); options.SubjectContributors.Add(new DataAccessUserIdContributor()); + options.SubjectContributors.Add(new DataAccessClientIdContributor()); options.SubjectContributors.Add(new DataAccessRoleNameContributor()); options.SubjectContributors.Add(new DataAccessOrganizationUnitContributor()); }); - Configure(options => + Configure(options => { - options.Resources.Add(); + options.MapCodeNamespace("DataProtection", typeof(DataProtectionResource)); }); } } diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/DataAccessKeywordContributorContext.cs b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/DataAccessKeywordContributorContext.cs index 2cb849833..5237a1b62 100644 --- a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/DataAccessKeywordContributorContext.cs +++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/DataAccessKeywordContributorContext.cs @@ -4,8 +4,12 @@ namespace LINGYUN.Abp.DataProtection; public class DataAccessKeywordContributorContext { public IServiceProvider ServiceProvider { get; } - public DataAccessKeywordContributorContext(IServiceProvider serviceProvider) + public Type ConversionType { get; } + public DataAccessKeywordContributorContext( + IServiceProvider serviceProvider, + Type conversionType) { ServiceProvider = serviceProvider; + ConversionType = conversionType; } } diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/EntityTypeFilterBuilder.cs b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/EntityTypeFilterBuilder.cs index 2e17bf9a1..f5f3cd4f9 100644 --- a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/EntityTypeFilterBuilder.cs +++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/EntityTypeFilterBuilder.cs @@ -240,10 +240,8 @@ public class EntityTypeFilterBuilder : IEntityTypeFilterBuilder, ITransientDepen { if (_options.KeywordContributors.TryGetValue(rule.Value?.ToString() ?? "", out var contributor)) { - var context = new DataAccessKeywordContributorContext(_serviceProvider); - var keyValue = contributor.Contribute(context); - var value = CastTo(keyValue, conversionType); - return Expression.Constant(value, conversionType); + var context = new DataAccessKeywordContributorContext(_serviceProvider, conversionType); + return contributor.Contribute(context); } else { diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/IDataAccessKeywordContributor.cs b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/IDataAccessKeywordContributor.cs index be985d265..aec82e52c 100644 --- a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/IDataAccessKeywordContributor.cs +++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/IDataAccessKeywordContributor.cs @@ -1,6 +1,8 @@ -namespace LINGYUN.Abp.DataProtection; +using System.Linq.Expressions; + +namespace LINGYUN.Abp.DataProtection; public interface IDataAccessKeywordContributor { string Keyword { get; } - object Contribute(DataAccessKeywordContributorContext context); + Expression Contribute(DataAccessKeywordContributorContext context); } diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/IDataAuthorizationServiceExtensions.cs b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/IDataAuthorizationServiceExtensions.cs index 6c415fec7..365969624 100644 --- a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/IDataAuthorizationServiceExtensions.cs +++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/IDataAuthorizationServiceExtensions.cs @@ -1,7 +1,6 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -using Volo.Abp.Authorization; using Volo.Abp.Domain.Entities; namespace LINGYUN.Abp.DataProtection; @@ -13,7 +12,7 @@ public static class IDataAuthorizationServiceExtensions if (!result.Succeeded) { var entityKeys = entities.Select(x => x.ToString()).JoinAsString(";"); - throw new AbpAuthorizationException( + throw new AbpDataAccessDeniedException( $"The {operation} operation with entity type {typeof(Entity)} identified as {entityKeys} is not allowed!"); } } diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/Keywords/DataAccessCurrentUserContributor.cs b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/Keywords/DataAccessCurrentUserContributor.cs index 50afda82e..296310ff1 100644 --- a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/Keywords/DataAccessCurrentUserContributor.cs +++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/Keywords/DataAccessCurrentUserContributor.cs @@ -1,4 +1,8 @@ using Microsoft.Extensions.DependencyInjection; +using System; +using System.ComponentModel; +using System.Globalization; +using System.Linq.Expressions; using Volo.Abp.Users; namespace LINGYUN.Abp.DataProtection.Keywords; @@ -7,9 +11,22 @@ public class DataAccessCurrentUserContributor : IDataAccessKeywordContributor public const string Name = "@CurrentUser"; public string Keyword => Name; - public object Contribute(DataAccessKeywordContributorContext context) + public Expression Contribute(DataAccessKeywordContributorContext context) { var currentUser = context.ServiceProvider.GetRequiredService(); - return currentUser.Id; + + var userId = CastTo(currentUser.Id, context.ConversionType); + + // entity.Where(x => x.CreatorId == CurrentUser.Id); + return Expression.Constant(userId, context.ConversionType); + } + + private static object CastTo(object value, Type conversionType) + { + if (conversionType == typeof(Guid) || conversionType == typeof(Guid?)) + { + return TypeDescriptor.GetConverter(conversionType).ConvertFromInvariantString(value.ToString()!)!; + } + return Convert.ChangeType(value, conversionType, CultureInfo.InvariantCulture); } } diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/Subjects/DataAccessClientIdContributor.cs b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/Subjects/DataAccessClientIdContributor.cs new file mode 100644 index 000000000..2c566076d --- /dev/null +++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/LINGYUN/Abp/DataProtection/Subjects/DataAccessClientIdContributor.cs @@ -0,0 +1,43 @@ +using Microsoft.Extensions.DependencyInjection; +using System.Collections.Generic; +using System.Linq; +using Volo.Abp.Authorization.Permissions; +using Volo.Abp.Clients; + +namespace LINGYUN.Abp.DataProtection.Subjects; +public class DataAccessClientIdContributor : IDataAccessSubjectContributor +{ + public string Name => ClientPermissionValueProvider.ProviderName; + + public virtual List GetAllowProperties(DataAccessSubjectContributorContext context) + { + var allowProperties = new List(); + var currentClient = context.ServiceProvider.GetRequiredService(); + if (currentClient.IsAuthenticated) + { + var resourceStore = context.ServiceProvider.GetRequiredService(); + var resource = resourceStore.Get(Name, currentClient.Id, context.EntityTypeFullName, context.Operation); + if (resource?.AllowProperties.Any() == true) + { + allowProperties.AddIfNotContains(resource.AllowProperties); + } + } + return allowProperties; + } + + public virtual List GetFilterGroups(DataAccessSubjectContributorContext context) + { + var groups = new List(); + var currentClient = context.ServiceProvider.GetRequiredService(); + if (currentClient.IsAuthenticated) + { + var resourceStore = context.ServiceProvider.GetRequiredService(); + var resource = resourceStore.Get(Name, currentClient.Id, context.EntityTypeFullName, context.Operation); + if (resource?.FilterGroup != null) + { + groups.Add(resource.FilterGroup); + } + } + return groups; + } +} diff --git a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/System/Reflection/NullableTypeExtensions.cs b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/System/Reflection/NullableTypeExtensions.cs index 66f89f104..59066b21f 100644 --- a/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/System/Reflection/NullableTypeExtensions.cs +++ b/aspnet-core/framework/data-protection/LINGYUN.Abp.DataProtection/System/Reflection/NullableTypeExtensions.cs @@ -1,6 +1,4 @@ -using System; - -namespace System.Reflection; +namespace System.Reflection; internal static class NullableTypeExtensions { diff --git a/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Application.Contracts/FodyWeavers.xml b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Application.Contracts/FodyWeavers.xml new file mode 100644 index 000000000..1715698cc --- /dev/null +++ b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Application.Contracts/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Application.Contracts/FodyWeavers.xsd b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Application.Contracts/FodyWeavers.xsd new file mode 100644 index 000000000..3f3946e28 --- /dev/null +++ b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Application.Contracts/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Application.Contracts/LINGYUN.Abp.Exporter.Application.Contracts.csproj b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Application.Contracts/LINGYUN.Abp.Exporter.Application.Contracts.csproj new file mode 100644 index 000000000..bc998ef75 --- /dev/null +++ b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Application.Contracts/LINGYUN.Abp.Exporter.Application.Contracts.csproj @@ -0,0 +1,20 @@ + + + + + + + netstandard2.0;netstandard2.1;net8.0 + LINGYUN.Abp.Exporter.Application.Contracts + LINGYUN.Abp.Exporter.Application.Contracts + false + false + false + + + + + + + + diff --git a/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Application.Contracts/LINGYUN/Abp/Exporter/AbpExporterApplicationContractsModule.cs b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Application.Contracts/LINGYUN/Abp/Exporter/AbpExporterApplicationContractsModule.cs new file mode 100644 index 000000000..49523b1fb --- /dev/null +++ b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Application.Contracts/LINGYUN/Abp/Exporter/AbpExporterApplicationContractsModule.cs @@ -0,0 +1,9 @@ +using Volo.Abp.Application; +using Volo.Abp.Modularity; + +namespace LINGYUN.Abp.Exporter; + +[DependsOn(typeof(AbpDddApplicationContractsModule))] +public class AbpExporterApplicationContractsModule : AbpModule +{ +} diff --git a/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Application.Contracts/LINGYUN/Abp/Exporter/IExporterAppService.cs b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Application.Contracts/LINGYUN/Abp/Exporter/IExporterAppService.cs new file mode 100644 index 000000000..34e3177b6 --- /dev/null +++ b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Application.Contracts/LINGYUN/Abp/Exporter/IExporterAppService.cs @@ -0,0 +1,19 @@ +using System.Threading.Tasks; +using Volo.Abp.Content; + +namespace LINGYUN.Abp.Exporter; +/// +/// 数据导出服务接口 +/// +/// 导出的实体数据传输对象 +/// 实体数据过滤数据对象 +public interface IExporterAppService + where TEntityExportDto : class, new() +{ + /// + /// 导出数据(默认实现Excel) + /// + /// 数据过滤条件 + /// + Task ExportAsync(TEntityListGetInput input); +} diff --git a/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Application.Contracts/LINGYUN/Abp/Exporter/IImporterAppService.cs b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Application.Contracts/LINGYUN/Abp/Exporter/IImporterAppService.cs new file mode 100644 index 000000000..d2a6f30c3 --- /dev/null +++ b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Application.Contracts/LINGYUN/Abp/Exporter/IImporterAppService.cs @@ -0,0 +1,17 @@ +using System.Threading.Tasks; + +namespace LINGYUN.Abp.Exporter; +/// +/// 数据导入服务接口 +/// +/// +public interface IImporterAppService + where TEntityImportDto: class, new() +{ + /// + /// 导入数据(默认从Excel) + /// + /// 导入的数据文件流 + /// + Task ImportAsync(TEntityImportDto input); +} diff --git a/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Application.Contracts/README.md b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Application.Contracts/README.md new file mode 100644 index 000000000..aac0f9666 --- /dev/null +++ b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Application.Contracts/README.md @@ -0,0 +1,103 @@ +# LINGYUN.Abp.Exporter.Application.Contracts + +数据导出/导入接口契约层,定义通用的数据导入/导入服务接口 + +## 配置使用 + + +> 配置模块依赖 +```csharp + +[DependsOn( + typeof(AbpExporterApplicationContractsModule) + )] +public class YouProjectModule : AbpModule +{ + +} +``` + +> 定义导出类型 +```csharp +public class DemoClassDto +{ + public string Name { get; set; } + public string Remarks { get; set; } + + public DemoClassDto() + { + } +} +``` + +> 定义导入类型 +```csharp +public class DemoClassImportInput +{ + [Required] + public IRemoteStreamContent Content { get; set; } + + public DemoClassImportInput() + { + } +} +``` + +> 定义数据过滤类型 +```csharp +public class DemoClassExportListInput +{ + public string Filter { get; set; } + + [Required] + public string FileName { get; set; } + + public DemoClassExportListInput() + { + } +} +``` + +> 导出数据 +```csharp + public class ExportDemoClassExportAppService : IExporterAppService + { + private readonly IExporterProvider _exporterProvider; + + public ExportDemoClassExportAppService(IExporterProvider exporterProvider) + { + _exporterProvider = exporterProvider; + } + + public async virtual Task ExportAsync(DemoClassExportListInput input) + { + var dtos = 通过仓储接口查询数据列表; + + var stream = await _exporterProvider.ExportAsync(dtos); + + return new RemoteStreamContent(stream, input.FileName); + } + } +``` + +> 导入数据 +```csharp + public class ExportDemoClassImportAppService : IImporterAppService + { + private readonly IImporterProvider _importerProvider; + + public ExportDemoClassImportAppService(IImporterProvider importerProvider) + { + _importerProvider = importerProvider; + } + + public async virtual Task ImportAsync(DemoClassImportInput input) + { + var stream = input.Content.GetStream(); + + var demos = await _importerProvider.ImportAsync(stream); + + // 其他操作 + } + } +``` diff --git a/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Application/FodyWeavers.xml b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Application/FodyWeavers.xml new file mode 100644 index 000000000..1715698cc --- /dev/null +++ b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Application/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Application/FodyWeavers.xsd b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Application/FodyWeavers.xsd new file mode 100644 index 000000000..3f3946e28 --- /dev/null +++ b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Application/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Application/LINGYUN.Abp.Exporter.Application.csproj b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Application/LINGYUN.Abp.Exporter.Application.csproj new file mode 100644 index 000000000..33ae7de47 --- /dev/null +++ b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Application/LINGYUN.Abp.Exporter.Application.csproj @@ -0,0 +1,25 @@ + + + + + + + netstandard2.0;netstandard2.1;net8.0 + LINGYUN.Abp.Exporter.Application + LINGYUN.Abp.Exporter.Application + false + false + false + + + + + + + + + + + + + diff --git a/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Application/LINGYUN/Abp/Exporter/AbpExporterApplicationModule.cs b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Application/LINGYUN/Abp/Exporter/AbpExporterApplicationModule.cs new file mode 100644 index 000000000..022b0a7d5 --- /dev/null +++ b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Application/LINGYUN/Abp/Exporter/AbpExporterApplicationModule.cs @@ -0,0 +1,12 @@ +using Volo.Abp.Application; +using Volo.Abp.Modularity; + +namespace LINGYUN.Abp.Exporter; + +[DependsOn( + typeof(AbpDddApplicationModule), + typeof(AbpExporterCoreModule), + typeof(AbpExporterApplicationContractsModule))] +public class AbpExporterApplicationModule : AbpModule +{ +} diff --git a/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Application/LINGYUN/Abp/Exporter/ExporterAppService.cs b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Application/LINGYUN/Abp/Exporter/ExporterAppService.cs new file mode 100644 index 000000000..2ccc95eb8 --- /dev/null +++ b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Application/LINGYUN/Abp/Exporter/ExporterAppService.cs @@ -0,0 +1,50 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using Volo.Abp.Application.Services; +using Volo.Abp.Content; + +namespace LINGYUN.Abp.Exporter; + +public abstract class ExporterAppService : ApplicationService, IExporterAppService + where TEntityExportDto : class, new() +{ + private readonly IExporterProvider _exporterProvider; + + protected ExporterAppService(IExporterProvider exporterProvider) + { + _exporterProvider = exporterProvider; + } + + public async virtual Task ExportAsync(TEntityListGetInput input) + { + var fileName = GetExportFileName(input); + + var entities = await GetListAsync(input); + var entitieDtoList = MapEntitiesToDto(entities); + + var stream = await _exporterProvider.ExportAsync(entitieDtoList); + + return new RemoteStreamContent(stream, fileName); + } + /// + /// 实现方法用以返回导出文件名 + /// + /// + /// + protected abstract string GetExportFileName(TEntityListGetInput input); + /// + /// 实现方法用以查询需要导出的实体列表 + /// + /// + /// + protected abstract Task> GetListAsync(TEntityListGetInput input); + /// + /// 实现方法用以实体数据传输对象映射 + /// + /// + /// + protected virtual List MapEntitiesToDto(List entities) + { + return ObjectMapper.Map, List>(entities); + } +} diff --git a/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Application/LINGYUN/Abp/Exporter/ImporterAppService.cs b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Application/LINGYUN/Abp/Exporter/ImporterAppService.cs new file mode 100644 index 000000000..0e6735029 --- /dev/null +++ b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Application/LINGYUN/Abp/Exporter/ImporterAppService.cs @@ -0,0 +1,47 @@ +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using Volo.Abp.Application.Services; + +namespace LINGYUN.Abp.Exporter; + +public abstract class ImporterAppService : ApplicationService, IImporterAppService + where TEntityImportDto : class, new() +{ + private readonly IImporterProvider _importerProvider; + protected ImporterAppService(IImporterProvider importerProvider) + { + _importerProvider = importerProvider; + } + + public async virtual Task ImportAsync(TEntityImportDto input) + { + var stream = await GetImportStream(input); + var entitieDtoList = await _importerProvider.ImportAsync(stream); + + var entities = MapDtoToEntities([.. entitieDtoList]); + + await SaveManyEntities(entities); + } + /// + /// 实现方法用以从导入数据中提取文件流 + /// + /// + /// + protected abstract Task GetImportStream(TEntityImportDto input); + /// + /// 实现方法用以保存实体列表到持久化设施 + /// + /// + /// + protected abstract Task SaveManyEntities(ICollection entities); + /// + /// 实现方法用以实体数据传输对象映射 + /// + /// + /// + protected virtual List MapDtoToEntities(List entitieDtoList) + { + return ObjectMapper.Map, List>(entitieDtoList); + } +} diff --git a/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Core/FodyWeavers.xml b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Core/FodyWeavers.xml new file mode 100644 index 000000000..00e1d9a1c --- /dev/null +++ b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Core/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Core/FodyWeavers.xsd b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Core/FodyWeavers.xsd new file mode 100644 index 000000000..3f3946e28 --- /dev/null +++ b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Core/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Core/LINGYUN.Abp.Exporter.Core.csproj b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Core/LINGYUN.Abp.Exporter.Core.csproj new file mode 100644 index 000000000..aa94a35e8 --- /dev/null +++ b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Core/LINGYUN.Abp.Exporter.Core.csproj @@ -0,0 +1,30 @@ + + + + + + + netstandard2.0;netstandard2.1;net8.0 + LINGYUN.Abp.Exporter.Core + LINGYUN.Abp.Exporter.Core + false + false + false + enable + + + + + + + + + + + + + + + + + diff --git a/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Core/LINGYUN/Abp/Exporter/AbpExporterCoreModule.cs b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Core/LINGYUN/Abp/Exporter/AbpExporterCoreModule.cs new file mode 100644 index 000000000..5ba31e424 --- /dev/null +++ b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Core/LINGYUN/Abp/Exporter/AbpExporterCoreModule.cs @@ -0,0 +1,31 @@ +using LINGYUN.Abp.Exporter.Localization; +using Volo.Abp.Localization; +using Volo.Abp.Localization.ExceptionHandling; +using Volo.Abp.Modularity; +using Volo.Abp.VirtualFileSystem; + +namespace LINGYUN.Abp.Exporter; + +[DependsOn(typeof(AbpLocalizationModule))] +public class AbpExporterCoreModule : AbpModule +{ + public override void ConfigureServices(ServiceConfigurationContext context) + { + Configure(options => + { + options.FileSets.AddEmbedded(); + }); + + Configure(options => + { + options.Resources + .Add("en") + .AddVirtualJson("/LINGYUN/Abp/Exporter/Localization/Resources"); + }); + + Configure(options => + { + options.MapCodeNamespace(ExporterErrorCodes.Namespace, typeof(AbpExporterResource)); + }); + } +} \ No newline at end of file diff --git a/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Core/LINGYUN/Abp/Exporter/ExporterErrorCodes.cs b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Core/LINGYUN/Abp/Exporter/ExporterErrorCodes.cs new file mode 100644 index 000000000..9ad0cc137 --- /dev/null +++ b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Core/LINGYUN/Abp/Exporter/ExporterErrorCodes.cs @@ -0,0 +1,9 @@ +namespace LINGYUN.Abp.Exporter; +public static class ExporterErrorCodes +{ + public const string Namespace = "AbpExporter"; + /// + /// 导入数据过程中出现一些错误,请检查数据有效性! + /// + public const string ImportDataError = Namespace + ":010001"; +} diff --git a/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Core/LINGYUN/Abp/Exporter/IExporterProvider.cs b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Core/LINGYUN/Abp/Exporter/IExporterProvider.cs new file mode 100644 index 000000000..0f31c7b70 --- /dev/null +++ b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Core/LINGYUN/Abp/Exporter/IExporterProvider.cs @@ -0,0 +1,20 @@ +using System.Collections.Generic; +using System.IO; +using System.Threading; +using System.Threading.Tasks; + +namespace LINGYUN.Abp.Exporter; +/// +/// 数据导出提供者 +/// +public interface IExporterProvider +{ + /// + /// 数据导出 + /// + /// 导出数据 + /// + /// + Task ExportAsync(ICollection data, CancellationToken cancellationToken = default) + where T : class, new(); +} diff --git a/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Core/LINGYUN/Abp/Exporter/IImporterProvider.cs b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Core/LINGYUN/Abp/Exporter/IImporterProvider.cs new file mode 100644 index 000000000..f1b0673dd --- /dev/null +++ b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Core/LINGYUN/Abp/Exporter/IImporterProvider.cs @@ -0,0 +1,19 @@ +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; + +namespace LINGYUN.Abp.Exporter; +/// +/// 数据导入提供者 +/// +public interface IImporterProvider +{ + /// + /// 数据导入 + /// + /// + /// + /// + Task> ImportAsync(Stream stream) + where T : class, new(); +} diff --git a/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Core/LINGYUN/Abp/Exporter/Localization/AbpExporterResource.cs b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Core/LINGYUN/Abp/Exporter/Localization/AbpExporterResource.cs new file mode 100644 index 000000000..e80ccb5f3 --- /dev/null +++ b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Core/LINGYUN/Abp/Exporter/Localization/AbpExporterResource.cs @@ -0,0 +1,8 @@ +using Volo.Abp.Localization; + +namespace LINGYUN.Abp.Exporter.Localization; + +[LocalizationResourceName("AbpExporter")] +public class AbpExporterResource +{ +} diff --git a/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Core/LINGYUN/Abp/Exporter/Localization/Resources/en.json b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Core/LINGYUN/Abp/Exporter/Localization/Resources/en.json new file mode 100644 index 000000000..ff6718836 --- /dev/null +++ b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Core/LINGYUN/Abp/Exporter/Localization/Resources/en.json @@ -0,0 +1,6 @@ +{ + "culture": "en", + "texts": { + "AbpExporter:010001": "There were some errors during the data import process. Please check the validity of the data!" + } +} \ No newline at end of file diff --git a/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Core/LINGYUN/Abp/Exporter/Localization/Resources/zh-Hans.json b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Core/LINGYUN/Abp/Exporter/Localization/Resources/zh-Hans.json new file mode 100644 index 000000000..e867e5cdb --- /dev/null +++ b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Core/LINGYUN/Abp/Exporter/Localization/Resources/zh-Hans.json @@ -0,0 +1,6 @@ +{ + "culture": "zh-Hans", + "texts": { + "AbpExporter:010001": "导入数据过程中出现一些错误,请检查数据有效性!" + } +} \ No newline at end of file diff --git a/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Core/LINGYUN/Abp/Exporter/NullExporterProvider.cs b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Core/LINGYUN/Abp/Exporter/NullExporterProvider.cs new file mode 100644 index 000000000..89457daf4 --- /dev/null +++ b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Core/LINGYUN/Abp/Exporter/NullExporterProvider.cs @@ -0,0 +1,17 @@ +using System.Collections.Generic; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Volo.Abp.DependencyInjection; + +namespace LINGYUN.Abp.Exporter; + +[Dependency(TryRegister = true)] +public class NullExporterProvider : IExporterProvider, ISingletonDependency +{ + private readonly static Stream _nullStreamCache = Stream.Null; + public Task ExportAsync(ICollection data, CancellationToken cancellationToken = default) where T : class, new() + { + return Task.FromResult(_nullStreamCache); + } +} diff --git a/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Core/LINGYUN/Abp/Exporter/NullImporterProvider.cs b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Core/LINGYUN/Abp/Exporter/NullImporterProvider.cs new file mode 100644 index 000000000..032428a4a --- /dev/null +++ b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Core/LINGYUN/Abp/Exporter/NullImporterProvider.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using Volo.Abp.DependencyInjection; + +namespace LINGYUN.Abp.Exporter; + +[Dependency(TryRegister = true)] +public class NullImporterProvider : IImporterProvider, ISingletonDependency +{ + public Task> ImportAsync(Stream stream) where T : class, new() + { + IReadOnlyCollection empty = Array.Empty(); + + return Task.FromResult(empty); + } +} diff --git a/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Core/README.md b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Core/README.md new file mode 100644 index 000000000..4993d9489 --- /dev/null +++ b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.Core/README.md @@ -0,0 +1,76 @@ +# LINGYUN.Abp.Exporter.Core + +数据导出/导入核心层 + +## 配置使用 + + +```csharp + + [DependsOn( + typeof(AbpExporterCoreModule) + )] + public class YouProjectModule : AbpModule + { + + } +``` + +> 导出数据 +```csharp + public class ExportDemoClass + { + private readonly IExporterProvider _exporterProvider; + + public ExportDemoClass(IExporterProvider exporterProvider) + { + _exporterProvider = exporterProvider; + } + + public async virtual Task ExportAsync() + { + var dataItems = new object[] + { + new + { + Name = "name1", + Remakrs = "remarks1" + } + }; + + var stream = await _exporterProvider.ExportAsync(dataItems); + + return new RemoteStreamContent(stream, "demo.xlsx"); + } + } +``` + +> 导入数据 +```csharp + public class ImportDemoClass + { + private readonly IImporterProvider _importerProvider; + + public ImportDemoClass(IImporterProvider importerProvider) + { + _importerProvider = importerProvider; + } + + public async virtual Task ImportAsync(Stream stream) + { + var demos = await _importerProvider.ImportAsync(stream); + + // 其他操作 + } + } + + public class DemoClass + { + public string Name { get; set; } + public string Remarks { get; set; } + + public DemoClass() + { + } + } +``` diff --git a/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.HttpApi/FodyWeavers.xml b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.HttpApi/FodyWeavers.xml new file mode 100644 index 000000000..1715698cc --- /dev/null +++ b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.HttpApi/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.HttpApi/LINGYUN.Abp.Exporter.HttpApi.csproj b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.HttpApi/LINGYUN.Abp.Exporter.HttpApi.csproj new file mode 100644 index 000000000..93bd013ba --- /dev/null +++ b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.HttpApi/LINGYUN.Abp.Exporter.HttpApi.csproj @@ -0,0 +1,24 @@ + + + + + + + net8.0 + LINGYUN.Abp.Exporter.HttpApi + LINGYUN.Abp.Exporter.HttpApi + false + false + false + + + + + + + + + + + + diff --git a/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.HttpApi/LINGYUN/Abp/Exporter/AbpExporterHttpApiModule.cs b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.HttpApi/LINGYUN/Abp/Exporter/AbpExporterHttpApiModule.cs new file mode 100644 index 000000000..01313663a --- /dev/null +++ b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.HttpApi/LINGYUN/Abp/Exporter/AbpExporterHttpApiModule.cs @@ -0,0 +1,12 @@ +using Volo.Abp.Application; +using Volo.Abp.Modularity; + +namespace LINGYUN.Abp.Exporter; + +[DependsOn( + typeof(AbpDddApplicationModule), + typeof(AbpExporterApplicationContractsModule))] +public class AbpExporterHttpApiModule : AbpModule +{ + +} diff --git a/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.HttpApi/LINGYUN/Abp/Exporter/ExporterController.cs b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.HttpApi/LINGYUN/Abp/Exporter/ExporterController.cs new file mode 100644 index 000000000..189363efa --- /dev/null +++ b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.HttpApi/LINGYUN/Abp/Exporter/ExporterController.cs @@ -0,0 +1,22 @@ +using Microsoft.AspNetCore.Mvc; +using System.Threading.Tasks; +using Volo.Abp.AspNetCore.Mvc; +using Volo.Abp.Content; + +namespace LINGYUN.Abp.Exporter; +public abstract class ExporterController : AbpControllerBase, IExporterAppService + where TEntityExportDto : class, new() +{ + private readonly IExporterAppService _exportService; + protected ExporterController(IExporterAppService exportService) + { + _exportService = exportService; + } + + [HttpGet] + [Route("export")] + public virtual Task ExportAsync(TEntityListGetInput input) + { + return _exportService.ExportAsync(input); + } +} diff --git a/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.HttpApi/LINGYUN/Abp/Exporter/ImporterController.cs b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.HttpApi/LINGYUN/Abp/Exporter/ImporterController.cs new file mode 100644 index 000000000..42212ba56 --- /dev/null +++ b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.HttpApi/LINGYUN/Abp/Exporter/ImporterController.cs @@ -0,0 +1,24 @@ +using Microsoft.AspNetCore.Mvc; +using System.Threading.Tasks; +using Volo.Abp.AspNetCore.Mvc; +using Volo.Abp.Content; + +namespace LINGYUN.Abp.Exporter; + +public abstract class ImporterController : AbpControllerBase, IImporterAppService + where TEntityImportDto : class, new() +{ + private readonly IImporterAppService _importService; + + protected ImporterController(IImporterAppService importService) + { + _importService = importService; + } + + [HttpPost] + [Route("import")] + public virtual Task ImportAsync(IRemoteStreamContent input) + { + return _importService.ImportAsync(input); + } +} diff --git a/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.MagicodesIE.Excel/FodyWeavers.xml b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.MagicodesIE.Excel/FodyWeavers.xml new file mode 100644 index 000000000..1715698cc --- /dev/null +++ b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.MagicodesIE.Excel/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.MagicodesIE.Excel/LINGYUN.Abp.Exporter.MagicodesIE.Excel.csproj b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.MagicodesIE.Excel/LINGYUN.Abp.Exporter.MagicodesIE.Excel.csproj new file mode 100644 index 000000000..092ee9876 --- /dev/null +++ b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.MagicodesIE.Excel/LINGYUN.Abp.Exporter.MagicodesIE.Excel.csproj @@ -0,0 +1,26 @@ + + + + + + + netstandard2.0;netstandard2.1;net8.0 + LINGYUN.Abp.Exporter.MagicodesIE.Excel + LINGYUN.Abp.Exporter.MagicodesIE.Excel + false + false + false + enable + + + + + + + + + + + + + diff --git a/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.MagicodesIE.Excel/LINGYUN/Abp/Exporter/AbpExporterMagicodesIEExcelModule.cs b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.MagicodesIE.Excel/LINGYUN/Abp/Exporter/AbpExporterMagicodesIEExcelModule.cs new file mode 100644 index 000000000..534b82df1 --- /dev/null +++ b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.MagicodesIE.Excel/LINGYUN/Abp/Exporter/AbpExporterMagicodesIEExcelModule.cs @@ -0,0 +1,30 @@ +using Magicodes.ExporterAndImporter.Core; +using Magicodes.ExporterAndImporter.Excel; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection.Extensions; +using Volo.Abp.Modularity; + +namespace LINGYUN.Abp.Exporter.MagicodesIE.Excel; + +[DependsOn(typeof(AbpExporterCoreModule))] +public class AbpExporterMagicodesIEExcelModule : AbpModule +{ + public override void ConfigureServices(ServiceConfigurationContext context) + { + context.Services.AddScoped(); + + context.Services.AddScoped(); + + context.Services.AddScoped(); + + context.Services.Replace( + ServiceDescriptor.Transient( + typeof(IExporterProvider), + typeof(MagicodesIEExcelExporterProvider))); + + context.Services.Replace( + ServiceDescriptor.Transient( + typeof(IImporterProvider), + typeof(MagicodesIEExcelImporterProvider))); + } +} \ No newline at end of file diff --git a/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.MagicodesIE.Excel/LINGYUN/Abp/Exporter/AbpExporterMagicodesIEExcelOptions.cs b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.MagicodesIE.Excel/LINGYUN/Abp/Exporter/AbpExporterMagicodesIEExcelOptions.cs new file mode 100644 index 000000000..4e72b5b95 --- /dev/null +++ b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.MagicodesIE.Excel/LINGYUN/Abp/Exporter/AbpExporterMagicodesIEExcelOptions.cs @@ -0,0 +1,31 @@ +using Magicodes.ExporterAndImporter.Excel; +using System; +using System.Collections.Generic; + +namespace LINGYUN.Abp.Exporter.MagicodesIE.Excel; +public class AbpExporterMagicodesIEExcelOptions +{ + /// + /// 数据导出设置 + /// + public IDictionary> ExportSettingMapping { get; } + /// + /// 数据导入设置 + /// + public IDictionary> ImportSettingMapping { get; } + public AbpExporterMagicodesIEExcelOptions() + { + ExportSettingMapping = new Dictionary>(); + ImportSettingMapping = new Dictionary>(); + } + + public void MapExportSetting(Type dataType, Action exportSettingsSetup) + { + ExportSettingMapping[dataType] = exportSettingsSetup; + } + + public void MapImportSetting(Type dataType, Action importSettingsSetup) + { + ImportSettingMapping[dataType] = importSettingsSetup; + } +} diff --git a/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.MagicodesIE.Excel/LINGYUN/Abp/Exporter/AbpImportHelper.cs b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.MagicodesIE.Excel/LINGYUN/Abp/Exporter/AbpImportHelper.cs new file mode 100644 index 000000000..a39afeb5d --- /dev/null +++ b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.MagicodesIE.Excel/LINGYUN/Abp/Exporter/AbpImportHelper.cs @@ -0,0 +1,23 @@ +using Magicodes.ExporterAndImporter.Excel; +using Magicodes.ExporterAndImporter.Excel.Utility; +using System; +using System.IO; + +namespace LINGYUN.Abp.Exporter.MagicodesIE.Excel; +public class AbpImportHelper : ImportHelper where T : class, new() +{ + public AbpImportHelper(string? filePath = null, string? labelingFilePath = null) + : base(filePath, labelingFilePath) + { + } + + public AbpImportHelper(Stream stream, Stream? labelingFileStream) + : base(stream, labelingFileStream) + { + } + + internal void ConfigureExcelImportSettings(Action? excelImportSettingsConfig) + { + excelImportSettingsConfig?.Invoke(ExcelImporterSettings); + } +} diff --git a/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.MagicodesIE.Excel/LINGYUN/Abp/Exporter/MagicodesIEExcelExporterProvider.cs b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.MagicodesIE.Excel/LINGYUN/Abp/Exporter/MagicodesIEExcelExporterProvider.cs new file mode 100644 index 000000000..7ce8fefa2 --- /dev/null +++ b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.MagicodesIE.Excel/LINGYUN/Abp/Exporter/MagicodesIEExcelExporterProvider.cs @@ -0,0 +1,62 @@ +using Magicodes.ExporterAndImporter.Excel; +using Magicodes.ExporterAndImporter.Excel.Utility; +using Microsoft.Extensions.Options; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Volo.Abp.DependencyInjection; + +namespace LINGYUN.Abp.Exporter.MagicodesIE.Excel; +public class MagicodesIEExcelExporterProvider : IExporterProvider, ITransientDependency +{ + private readonly AbpExporterMagicodesIEExcelOptions _options; + private readonly IExcelExporter _excelExporter; + + public MagicodesIEExcelExporterProvider(IOptions options) + { + _options = options.Value; + } + + public async virtual Task ExportAsync(ICollection data, CancellationToken cancellationToken = default) + where T : class, new() + { + var fileBytes = new List(); + + var exportHelper = new ExportHelper(); + + // 由于Microsoft.IE.Excel官方此接口未暴露用户配置,做一次转换 + if (_options.ExportSettingMapping.TryGetValue(typeof(T), out var exportSetting)) + { + exportSetting?.Invoke(exportHelper.ExcelExporterSettings); + } + + if (exportHelper.ExcelExporterSettings.MaxRowNumberOnASheet > 0 && data.Count > exportHelper.ExcelExporterSettings.MaxRowNumberOnASheet) + { + using (exportHelper.CurrentExcelPackage) + { + var num = data.Count / exportHelper.ExcelExporterSettings.MaxRowNumberOnASheet + ((data.Count % exportHelper.ExcelExporterSettings.MaxRowNumberOnASheet > 0) ? 1 : 0); + for (var i = 0; i < num; i++) + { + var dataItems2 = data.Skip(i * exportHelper.ExcelExporterSettings.MaxRowNumberOnASheet).Take(exportHelper.ExcelExporterSettings.MaxRowNumberOnASheet).ToList(); + exportHelper.AddExcelWorksheet(); + exportHelper.Export(dataItems2); + } + + fileBytes.AddRange(await exportHelper.CurrentExcelPackage.GetAsByteArrayAsync()); + } + } + else + { + using var excelPackage2 = exportHelper.Export(data); + fileBytes.AddRange(await excelPackage2.GetAsByteArrayAsync()); + } + + var memoryStream = new MemoryStream([.. fileBytes]); + + memoryStream.Seek(0, SeekOrigin.Begin); + + return memoryStream; + } +} diff --git a/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.MagicodesIE.Excel/LINGYUN/Abp/Exporter/MagicodesIEExcelImporterProvider.cs b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.MagicodesIE.Excel/LINGYUN/Abp/Exporter/MagicodesIEExcelImporterProvider.cs new file mode 100644 index 000000000..e3b0e63d9 --- /dev/null +++ b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.MagicodesIE.Excel/LINGYUN/Abp/Exporter/MagicodesIEExcelImporterProvider.cs @@ -0,0 +1,74 @@ +using Magicodes.ExporterAndImporter.Core.Models; +using Magicodes.ExporterAndImporter.Excel; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging.Abstractions; +using Microsoft.Extensions.Options; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.IO; +using System.Threading.Tasks; +using Volo.Abp; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Json; + +namespace LINGYUN.Abp.Exporter.MagicodesIE.Excel; + +public class MagicodesIEExcelImporterProvider : IImporterProvider, ITransientDependency +{ + public ILogger Logger { protected get; set; } + + private readonly AbpExporterMagicodesIEExcelOptions _options; + private readonly IJsonSerializer _jsonSerializer; + private readonly IExcelImporter _excelImporter; + + public MagicodesIEExcelImporterProvider( + IJsonSerializer jsonSerializer, + IExcelImporter excelImporter, + IOptions options) + { + _jsonSerializer = jsonSerializer; + _excelImporter = excelImporter; + _options = options.Value; + + Logger = NullLogger.Instance; + } + + public async virtual Task> ImportAsync(Stream stream) where T : class, new() + { + using var importHelper = new AbpImportHelper(stream, null); + + // 由于Microsoft.IE.Excel官方此接口未暴露用户配置,做一次转换 + if (_options.ImportSettingMapping.TryGetValue(typeof(T), out var importSetting)) + { + importHelper.ConfigureExcelImportSettings(importSetting); + } + + var importResult = await importHelper.Import(null, null); + + ThrowImportException(importResult); + + return importResult.Data.ToImmutableList(); + } + + protected virtual void ThrowImportException(ImportResult importResult) where T : class, new() + { + if (importResult.HasError) + { + if (importResult.RowErrors.Count > 0) + { + var errorJson = _jsonSerializer.Serialize(importResult.RowErrors); + Logger.LogWarning("Row validation error occurred during data import process, details: {errorJson}", errorJson); + } + + if (importResult.TemplateErrors.Count > 0) + { + var errorJson = _jsonSerializer.Serialize(importResult.TemplateErrors); + Logger.LogWarning("Template validation error occurred during data import process, details: {errorJson}", errorJson); + } + + throw new BusinessException( + code: ExporterErrorCodes.ImportDataError, + innerException: importResult.Exception); + } + } +} diff --git a/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.MagicodesIE.Excel/README.md b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.MagicodesIE.Excel/README.md new file mode 100644 index 000000000..ed9fc65f9 --- /dev/null +++ b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.MagicodesIE.Excel/README.md @@ -0,0 +1,41 @@ +# LINGYUN.Abp.Exporter.MagicodesIE.Excel + +数据导出接口的 [Magicodes.IE.Excel](https://github.com/dotnetcore/Magicodes.IE) 实现 + +Import and export general library, support Dto import and export, template export, fancy export and dynamic export, support Excel, Csv, Word, Pdf and Html. + +详情请参考 [Magicodes.IE.Excel 文档](https://github.com/dotnetcore/Magicodes.IE/blob/master/docs/2.%E5%9F%BA%E7%A1%80%E6%95%99%E7%A8%8B%E4%B9%8B%E5%AF%BC%E5%87%BAExcel.md) + +## 配置使用 + + +```csharp + + [DependsOn( + typeof(AbpExporterMagicodesIEExcelModule) + )] + public class YouProjectModule : AbpModule + { + Configure(options => + { + // 配置类型数据导出 + options.MapExportSetting(typeof(DemoClass), config => + { + // 表头位置从第二行开始 + config.HeaderRowIndex = 2; + // 其他配置 + }); + }); + } + + public class DemoClass + { + public string Name { get; set; } + public string Remarks { get; set; } + + public DemoClass() + { + } + } +``` + diff --git a/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.MiniExcel/FodyWeavers.xml b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.MiniExcel/FodyWeavers.xml new file mode 100644 index 000000000..1715698cc --- /dev/null +++ b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.MiniExcel/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.MiniExcel/FodyWeavers.xsd b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.MiniExcel/FodyWeavers.xsd new file mode 100644 index 000000000..3f3946e28 --- /dev/null +++ b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.MiniExcel/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.MiniExcel/LINGYUN.Abp.Exporter.MiniExcel.csproj b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.MiniExcel/LINGYUN.Abp.Exporter.MiniExcel.csproj new file mode 100644 index 000000000..2efc4c367 --- /dev/null +++ b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.MiniExcel/LINGYUN.Abp.Exporter.MiniExcel.csproj @@ -0,0 +1,25 @@ + + + + + + + netstandard2.0;netstandard2.1;net8.0 + LINGYUN.Abp.Exporter.MiniExcel + LINGYUN.Abp.Exporter.MiniExcel + false + false + false + enable + + + + + + + + + + + + diff --git a/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.MiniExcel/LINGYUN/Abp/Exporter/AbpExporterMiniExcelModule.cs b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.MiniExcel/LINGYUN/Abp/Exporter/AbpExporterMiniExcelModule.cs new file mode 100644 index 000000000..000e26636 --- /dev/null +++ b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.MiniExcel/LINGYUN/Abp/Exporter/AbpExporterMiniExcelModule.cs @@ -0,0 +1,22 @@ +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection.Extensions; +using Volo.Abp.Modularity; + +namespace LINGYUN.Abp.Exporter.MiniExcel; + +[DependsOn(typeof(AbpExporterCoreModule))] +public class AbpExporterMiniExcelModule : AbpModule +{ + public override void ConfigureServices(ServiceConfigurationContext context) + { + context.Services.Replace( + ServiceDescriptor.Transient( + typeof(IExporterProvider), + typeof(MiniExcelExporterProvider))); + + context.Services.Replace( + ServiceDescriptor.Transient( + typeof(IImporterProvider), + typeof(MiniExcelImporterProvider))); + } +} \ No newline at end of file diff --git a/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.MiniExcel/LINGYUN/Abp/Exporter/AbpExporterMiniExcelOptions.cs b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.MiniExcel/LINGYUN/Abp/Exporter/AbpExporterMiniExcelOptions.cs new file mode 100644 index 000000000..06fe23fa5 --- /dev/null +++ b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.MiniExcel/LINGYUN/Abp/Exporter/AbpExporterMiniExcelOptions.cs @@ -0,0 +1,25 @@ +using MiniExcelLibs.OpenXml; +using System; +using System.Collections.Generic; + +namespace LINGYUN.Abp.Exporter.MiniExcel; +public class AbpExporterMiniExcelOptions +{ + public IDictionary> ExportSettingMapping { get; } + public IDictionary> ImportSettingMapping { get; } + public AbpExporterMiniExcelOptions() + { + ExportSettingMapping = new Dictionary>(); + ImportSettingMapping = new Dictionary>(); + } + + public void MapExportSetting(Type dataType, Action settingMapping) + { + ExportSettingMapping[dataType] = settingMapping; + } + + public void MapImportSetting(Type dataType, Action settingMapping) + { + ImportSettingMapping[dataType] = settingMapping; + } +} diff --git a/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.MiniExcel/LINGYUN/Abp/Exporter/MiniExcelExporterProvider.cs b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.MiniExcel/LINGYUN/Abp/Exporter/MiniExcelExporterProvider.cs new file mode 100644 index 000000000..3d0c0f473 --- /dev/null +++ b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.MiniExcel/LINGYUN/Abp/Exporter/MiniExcelExporterProvider.cs @@ -0,0 +1,41 @@ +using Microsoft.Extensions.Options; +using MiniExcelLibs; +using MiniExcelLibs.OpenXml; +using System.Collections.Generic; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Volo.Abp.DependencyInjection; + +namespace LINGYUN.Abp.Exporter.MiniExcel; +public class MiniExcelExporterProvider : IExporterProvider, ITransientDependency +{ + private readonly AbpExporterMiniExcelOptions _options; + + public MiniExcelExporterProvider(IOptions options) + { + _options = options.Value; + } + + public async virtual Task ExportAsync(ICollection data, CancellationToken cancellationToken = default) + where T : class, new() + { + var memoryStream = new MemoryStream(); + var xmlConfig = new OpenXmlConfiguration(); + + if (_options.ExportSettingMapping.TryGetValue(typeof(T), out var exportSetting)) + { + exportSetting?.Invoke(xmlConfig); + } + + await memoryStream.SaveAsAsync( + value: data, + excelType: ExcelType.XLSX, + configuration: xmlConfig, + cancellationToken: cancellationToken); + + memoryStream.Seek(0, SeekOrigin.Begin); + + return memoryStream; + } +} diff --git a/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.MiniExcel/LINGYUN/Abp/Exporter/MiniExcelImporterProvider.cs b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.MiniExcel/LINGYUN/Abp/Exporter/MiniExcelImporterProvider.cs new file mode 100644 index 000000000..f655dc333 --- /dev/null +++ b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.MiniExcel/LINGYUN/Abp/Exporter/MiniExcelImporterProvider.cs @@ -0,0 +1,35 @@ +using Microsoft.Extensions.Options; +using MiniExcelLibs; +using MiniExcelLibs.OpenXml; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.IO; +using System.Threading.Tasks; +using Volo.Abp.DependencyInjection; + +namespace LINGYUN.Abp.Exporter.MiniExcel; +public class MiniExcelImporterProvider : IImporterProvider, ITransientDependency +{ + private readonly AbpExporterMiniExcelOptions _options; + + public MiniExcelImporterProvider(IOptions options) + { + _options = options.Value; + } + + public async virtual Task> ImportAsync(Stream stream) where T : class, new() + { + var xmlConfig = new OpenXmlConfiguration(); + + if (_options.ExportSettingMapping.TryGetValue(typeof(T), out var exportSetting)) + { + exportSetting?.Invoke(xmlConfig); + } + + var dataList = await stream.QueryAsync( + excelType: ExcelType.XLSX, + configuration: xmlConfig); + + return dataList.ToImmutableList(); + } +} diff --git a/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.MiniExcel/README.md b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.MiniExcel/README.md new file mode 100644 index 000000000..da5ceb973 --- /dev/null +++ b/aspnet-core/framework/exporter/LINGYUN.Abp.Exporter.MiniExcel/README.md @@ -0,0 +1,46 @@ +# LINGYUN.Abp.Exporter.MiniExcel + +数据导出接口的 [MiniExcel](https://github.com/mini-software/MiniExcel) 实现 + +MiniExcel简单、高效避免OOM的.NET处理Excel查、写、填充数据工具。 + +目前主流框架大多需要将数据全载入到内存方便操作,但这会导致内存消耗问题,MiniExcel 尝试以 Stream 角度写底层算法逻辑,能让原本1000多MB占用降低到几MB,避免内存不够情况。 + +详情请参考 [MiniExcel 文档](https://github.com/mini-software/MiniExcel/blob/master/README.md) + +## 配置使用 + + +```csharp + + [DependsOn( + typeof(AbpExporterMiniExcelModule) + )] + public class YouProjectModule : AbpModule + { + Configure(options => + { + // 配置类型数据导出 + options.MapExportSetting(typeof(DemoClass), config => + { + config.DynamicColumns = new[] + { + // 忽略Name字段 + new DynamicExcelColumn(nameof(DemoClass.Name)){ Ignore = true }, + // 其他配置 + }; + }); + }); + } + + public class DemoClass + { + public string Name { get; set; } + public string Remarks { get; set; } + + public DemoClass() + { + } + } +``` + diff --git a/aspnet-core/migrations/LY.MicroService.Applications.Single.DbMigrator/appsettings.Development.json b/aspnet-core/migrations/LY.MicroService.Applications.Single.DbMigrator/appsettings.Development.json index be10f6150..a379395a0 100644 --- a/aspnet-core/migrations/LY.MicroService.Applications.Single.DbMigrator/appsettings.Development.json +++ b/aspnet-core/migrations/LY.MicroService.Applications.Single.DbMigrator/appsettings.Development.json @@ -52,7 +52,8 @@ "TaskManagement": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456;SslMode=None", "Workflow": "Server=127.0.0.1;Database=Workflow-V70;User Id=root;Password=123456;SslMode=None", "Notifications": "Server=127.0.0.1;Database=Messages-V70;User Id=root;Password=123456;SslMode=None", - "MessageService": "Server=127.0.0.1;Database=Messages-V70;User Id=root;Password=123456;SslMode=None" + "MessageService": "Server=127.0.0.1;Database=Messages-V70;User Id=root;Password=123456;SslMode=None", + "Demo": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456;SslMode=None" }, "DistributedLock": { "IsEnabled": true, diff --git a/aspnet-core/migrations/LY.MicroService.Applications.Single.DbMigrator/appsettings.json b/aspnet-core/migrations/LY.MicroService.Applications.Single.DbMigrator/appsettings.json index cdbc3c08f..584f810ce 100644 --- a/aspnet-core/migrations/LY.MicroService.Applications.Single.DbMigrator/appsettings.json +++ b/aspnet-core/migrations/LY.MicroService.Applications.Single.DbMigrator/appsettings.json @@ -16,7 +16,8 @@ "TaskManagement": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456;SslMode=None", "Workflow": "Server=127.0.0.1;Database=Workflow-V70;User Id=root;Password=123456;SslMode=None", "Notifications": "Server=127.0.0.1;Database=Messages-V70;User Id=root;Password=123456;SslMode=None", - "MessageService": "Server=127.0.0.1;Database=Messages-V70;User Id=root;Password=123456;SslMode=None" + "MessageService": "Server=127.0.0.1;Database=Messages-V70;User Id=root;Password=123456;SslMode=None", + "Demo": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456;SslMode=None" }, "StringEncryption": { "DefaultPassPhrase": "s46c5q55nxpeS8Ra", diff --git a/aspnet-core/migrations/LY.MicroService.Applications.Single.EntityFrameworkCore/LY.MicroService.Applications.Single.EntityFrameworkCore.csproj b/aspnet-core/migrations/LY.MicroService.Applications.Single.EntityFrameworkCore/LY.MicroService.Applications.Single.EntityFrameworkCore.csproj index fa6c94c57..1c3e29125 100644 --- a/aspnet-core/migrations/LY.MicroService.Applications.Single.EntityFrameworkCore/LY.MicroService.Applications.Single.EntityFrameworkCore.csproj +++ b/aspnet-core/migrations/LY.MicroService.Applications.Single.EntityFrameworkCore/LY.MicroService.Applications.Single.EntityFrameworkCore.csproj @@ -25,6 +25,7 @@ + diff --git a/aspnet-core/migrations/LY.MicroService.Applications.Single.EntityFrameworkCore/Migrations/20240929080118_Add-Demo-Module.Designer.cs b/aspnet-core/migrations/LY.MicroService.Applications.Single.EntityFrameworkCore/Migrations/20240929080118_Add-Demo-Module.Designer.cs new file mode 100644 index 000000000..8d64f6a7f --- /dev/null +++ b/aspnet-core/migrations/LY.MicroService.Applications.Single.EntityFrameworkCore/Migrations/20240929080118_Add-Demo-Module.Designer.cs @@ -0,0 +1,5539 @@ +// +using System; +using LY.MicroService.Applications.Single.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Volo.Abp.EntityFrameworkCore; + +#nullable disable + +namespace LY.MicroService.Applications.Single.EntityFrameworkCore.Migrations +{ + [DbContext(typeof(SingleMigrationsDbContext))] + [Migration("20240929080118_Add-Demo-Module")] + partial class AddDemoModule + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.MySql) + .HasAnnotation("ProductVersion", "8.0.4") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); + + modelBuilder.Entity("LINGYUN.Abp.Demo.Authors.Author", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BirthDate") + .HasColumnType("datetime(6)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("char(36)") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime(6)") + .HasColumnName("DeletionTime"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("char(36)") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ShortBio") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("Name"); + + b.ToTable("Demo_Authors", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Abp.Demo.Books.Book", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AuthorId") + .HasColumnType("char(36)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("char(36)") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("Price") + .HasColumnType("float"); + + b.Property("PublishDate") + .HasColumnType("datetime(6)"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("AuthorId"); + + b.ToTable("Demo_Books", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Abp.LocalizationManagement.Language", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("CultureName") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("varchar(20)") + .HasColumnName("CultureName"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)") + .HasColumnName("DisplayName"); + + b.Property("Enable") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(true); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("char(36)") + .HasColumnName("LastModifierId"); + + b.Property("TwoLetterISOLanguageName") + .HasMaxLength(30) + .HasColumnType("varchar(30)") + .HasColumnName("TwoLetterISOLanguageName"); + + b.Property("UiCultureName") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("varchar(20)") + .HasColumnName("UiCultureName"); + + b.HasKey("Id"); + + b.HasIndex("CultureName"); + + b.ToTable("AbpLocalizationLanguages", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Abp.LocalizationManagement.Resource", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("DefaultCultureName") + .HasMaxLength(64) + .HasColumnType("varchar(64)") + .HasColumnName("DefaultCultureName"); + + b.Property("Description") + .HasMaxLength(64) + .HasColumnType("varchar(64)") + .HasColumnName("Description"); + + b.Property("DisplayName") + .HasMaxLength(64) + .HasColumnType("varchar(64)") + .HasColumnName("DisplayName"); + + b.Property("Enable") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(true); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("char(36)") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)") + .HasColumnName("Name"); + + b.HasKey("Id"); + + b.HasIndex("Name"); + + b.ToTable("AbpLocalizationResources", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Abp.LocalizationManagement.Text", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CultureName") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("varchar(20)") + .HasColumnName("CultureName"); + + b.Property("Key") + .IsRequired() + .HasMaxLength(512) + .HasColumnType("varchar(512)") + .HasColumnName("Key"); + + b.Property("ResourceName") + .HasColumnType("longtext"); + + b.Property("Value") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)") + .HasColumnName("Value"); + + b.HasKey("Id"); + + b.HasIndex("Key"); + + b.ToTable("AbpLocalizationTexts", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserChatCard", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Age") + .HasColumnType("int"); + + b.Property("AvatarUrl") + .HasMaxLength(512) + .HasColumnType("varchar(512)"); + + b.Property("Birthday") + .HasColumnType("datetime(6)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("Description") + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("char(36)") + .HasColumnName("LastModifierId"); + + b.Property("LastOnlineTime") + .HasColumnType("datetime(6)"); + + b.Property("NickName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("Sex") + .HasColumnType("int"); + + b.Property("Sign") + .HasMaxLength(30) + .HasColumnType("varchar(30)"); + + b.Property("State") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.Property("UserName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "UserId"); + + b.ToTable("AppUserChatCards", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserChatFriend", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Black") + .HasColumnType("tinyint(1)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("Description") + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("DontDisturb") + .HasColumnType("tinyint(1)"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + + b.Property("FrientId") + .HasColumnType("char(36)"); + + b.Property("IsStatic") + .HasColumnType("tinyint(1)"); + + b.Property("RemarkName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("SpecialFocus") + .HasColumnType("tinyint(1)"); + + b.Property("Status") + .HasColumnType("tinyint unsigned"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "UserId", "FrientId"); + + b.ToTable("AppUserChatFriends", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserChatSetting", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AllowAddFriend") + .HasColumnType("tinyint(1)"); + + b.Property("AllowAnonymous") + .HasColumnType("tinyint(1)"); + + b.Property("AllowReceiveMessage") + .HasColumnType("tinyint(1)"); + + b.Property("AllowSendMessage") + .HasColumnType("tinyint(1)"); + + b.Property("RequireAddFriendValition") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "UserId"); + + b.ToTable("AppUserChatSettings", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Abp.MessageService.Chat.UserMessage", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("Content") + .IsRequired() + .HasMaxLength(1048576) + .HasColumnType("longtext"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + + b.Property("MessageId") + .HasColumnType("bigint"); + + b.Property("ReceiveUserId") + .HasColumnType("char(36)"); + + b.Property("SendUserName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Source") + .HasColumnType("int"); + + b.Property("State") + .HasColumnType("tinyint"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "ReceiveUserId"); + + b.ToTable("AppUserMessages", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Abp.MessageService.Groups.ChatGroup", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Address") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("AdminUserId") + .HasColumnType("char(36)"); + + b.Property("AllowAnonymous") + .HasColumnType("tinyint(1)"); + + b.Property("AllowSendMessage") + .HasColumnType("tinyint(1)"); + + b.Property("AvatarUrl") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("Description") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("GroupId") + .HasColumnType("bigint"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("char(36)") + .HasColumnName("LastModifierId"); + + b.Property("MaxUserCount") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("varchar(20)"); + + b.Property("Notice") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Tag") + .HasMaxLength(512) + .HasColumnType("varchar(512)"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Name"); + + b.ToTable("AppChatGroups", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Abp.MessageService.Groups.GroupChatBlack", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("GroupId") + .HasColumnType("bigint"); + + b.Property("ShieldUserId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "GroupId"); + + b.ToTable("AppGroupChatBlacks", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Abp.MessageService.Groups.GroupMessage", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("Content") + .IsRequired() + .HasMaxLength(1048576) + .HasColumnType("longtext"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + + b.Property("GroupId") + .HasColumnType("bigint"); + + b.Property("MessageId") + .HasColumnType("bigint"); + + b.Property("SendUserName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Source") + .HasColumnType("int"); + + b.Property("State") + .HasColumnType("tinyint"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "GroupId"); + + b.ToTable("AppGroupMessages", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Abp.MessageService.Groups.UserChatGroup", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("GroupId") + .HasColumnType("bigint"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "GroupId", "UserId"); + + b.ToTable("AppUserChatGroups", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Abp.MessageService.Groups.UserGroupCard", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + + b.Property("IsAdmin") + .HasColumnType("tinyint(1)"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("char(36)") + .HasColumnName("LastModifierId"); + + b.Property("NickName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("SilenceEnd") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "UserId"); + + b.ToTable("AppUserGroupCards", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Abp.Notifications.Notification", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ContentType") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(0); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("ExpirationTime") + .HasColumnType("datetime(6)"); + + b.Property("ExtraProperties") + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + + b.Property("NotificationId") + .HasColumnType("bigint"); + + b.Property("NotificationName") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("NotificationTypeName") + .IsRequired() + .HasMaxLength(512) + .HasColumnType("varchar(512)"); + + b.Property("Severity") + .HasColumnType("tinyint"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "NotificationName"); + + b.ToTable("AppNotifications", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Abp.Notifications.NotificationDefinitionGroupRecord", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AllowSubscriptionToClients") + .HasColumnType("tinyint(1)"); + + b.Property("Description") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("DisplayName") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("ExtraProperties") + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.ToTable("AppNotificationDefinitionGroups", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Abp.Notifications.NotificationDefinitionRecord", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AllowSubscriptionToClients") + .HasColumnType("tinyint(1)"); + + b.Property("ContentType") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(0); + + b.Property("Description") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("DisplayName") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("ExtraProperties") + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + + b.Property("GroupName") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("NotificationLifetime") + .HasColumnType("int"); + + b.Property("NotificationType") + .HasColumnType("int"); + + b.Property("Providers") + .HasMaxLength(200) + .HasColumnType("varchar(200)"); + + b.Property("Template") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.HasKey("Id"); + + b.ToTable("AppNotificationDefinitions", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Abp.Notifications.UserNotification", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("NotificationId") + .HasColumnType("bigint"); + + b.Property("ReadStatus") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "UserId", "NotificationId") + .HasDatabaseName("IX_Tenant_User_Notification_Id"); + + b.ToTable("AppUserNotifications", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Abp.Notifications.UserSubscribe", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("NotificationName") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.Property("UserName") + .IsRequired() + .ValueGeneratedOnAdd() + .HasMaxLength(128) + .HasColumnType("varchar(128)") + .HasDefaultValue("/"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "UserId", "NotificationName") + .IsUnique() + .HasDatabaseName("IX_Tenant_User_Notification_Name"); + + b.ToTable("AppUserSubscribes", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Abp.Saas.Editions.Edition", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("char(36)") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime(6)") + .HasColumnName("DeletionTime"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("EntityVersion") + .HasColumnType("int"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("char(36)") + .HasColumnName("LastModifierId"); + + b.HasKey("Id"); + + b.HasIndex("DisplayName"); + + b.ToTable("AbpEditions", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Abp.Saas.Tenants.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("char(36)") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime(6)") + .HasColumnName("DeletionTime"); + + b.Property("DisableTime") + .HasColumnType("datetime(6)"); + + b.Property("EditionId") + .HasColumnType("char(36)"); + + b.Property("EnableTime") + .HasColumnType("datetime(6)"); + + b.Property("EntityVersion") + .HasColumnType("int"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("char(36)") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("NormalizedName") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.HasKey("Id"); + + b.HasIndex("EditionId"); + + b.HasIndex("Name"); + + b.HasIndex("NormalizedName"); + + b.ToTable("AbpTenants", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Abp.Saas.Tenants.TenantConnectionString", b => + { + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("Name") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.HasKey("TenantId", "Name"); + + b.ToTable("AbpTenantConnectionStrings", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Abp.TaskManagement.BackgroundJobAction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("JobId") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("varchar(255)") + .HasColumnName("JobId"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("char(36)") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnName("Name"); + + b.Property("Paramters") + .HasColumnType("longtext") + .HasColumnName("Paramters"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("Name"); + + b.ToTable("TK_BackgroundJobActions", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Abp.TaskManagement.BackgroundJobInfo", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("Args") + .HasColumnType("longtext") + .HasColumnName("Args"); + + b.Property("BeginTime") + .HasColumnType("datetime(6)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("Cron") + .HasMaxLength(50) + .HasColumnType("varchar(50)") + .HasColumnName("Cron"); + + b.Property("Description") + .HasMaxLength(255) + .HasColumnType("varchar(255)") + .HasColumnName("Description"); + + b.Property("EndTime") + .HasColumnType("datetime(6)"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + + b.Property("Group") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnName("Group"); + + b.Property("Interval") + .HasColumnType("int"); + + b.Property("IsAbandoned") + .HasColumnType("tinyint(1)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("JobType") + .HasColumnType("int"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("char(36)") + .HasColumnName("LastModifierId"); + + b.Property("LastRunTime") + .HasColumnType("datetime(6)"); + + b.Property("LockTimeOut") + .HasColumnType("int"); + + b.Property("MaxCount") + .HasColumnType("int"); + + b.Property("MaxTryCount") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnName("Name"); + + b.Property("NextRunTime") + .HasColumnType("datetime(6)"); + + b.Property("NodeName") + .HasMaxLength(128) + .HasColumnType("varchar(128)") + .HasColumnName("NodeName"); + + b.Property("Priority") + .HasColumnType("int"); + + b.Property("Result") + .HasMaxLength(1000) + .HasColumnType("varchar(1000)") + .HasColumnName("Result"); + + b.Property("Source") + .HasColumnType("int"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId"); + + b.Property("TriggerCount") + .HasColumnType("int"); + + b.Property("TryCount") + .HasColumnType("int"); + + b.Property("Type") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("varchar(1000)") + .HasColumnName("Type"); + + b.HasKey("Id"); + + b.HasIndex("Name", "Group"); + + b.ToTable("TK_BackgroundJobs", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Abp.TaskManagement.BackgroundJobLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Exception") + .HasMaxLength(2000) + .HasColumnType("varchar(2000)") + .HasColumnName("Exception"); + + b.Property("JobGroup") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnName("JobGroup"); + + b.Property("JobId") + .HasMaxLength(255) + .HasColumnType("varchar(255)") + .HasColumnName("JobId"); + + b.Property("JobName") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnName("JobName"); + + b.Property("JobType") + .HasMaxLength(1000) + .HasColumnType("varchar(1000)") + .HasColumnName("JobType"); + + b.Property("Message") + .HasMaxLength(1000) + .HasColumnType("varchar(1000)") + .HasColumnName("Message"); + + b.Property("RunTime") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("JobGroup", "JobName"); + + b.ToTable("TK_BackgroundJobLogs", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Abp.TextTemplating.TextTemplate", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Content") + .HasMaxLength(1048576) + .HasColumnType("longtext") + .HasColumnName("Content"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("Culture") + .HasMaxLength(30) + .HasColumnType("varchar(30)") + .HasColumnName("Culture"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnName("DisplayName"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("char(36)") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnName("Name"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .HasDatabaseName("IX_Tenant_Text_Template_Name"); + + b.ToTable("AbpTextTemplates", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Abp.TextTemplating.TextTemplateDefinition", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("DefaultCultureName") + .HasMaxLength(30) + .HasColumnType("varchar(30)") + .HasColumnName("DefaultCultureName"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(512) + .HasColumnType("varchar(512)") + .HasColumnName("DisplayName"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + + b.Property("IsInlineLocalized") + .HasColumnType("tinyint(1)"); + + b.Property("IsLayout") + .HasColumnType("tinyint(1)"); + + b.Property("IsStatic") + .HasColumnType("tinyint(1)"); + + b.Property("Layout") + .HasMaxLength(60) + .HasColumnType("varchar(60)") + .HasColumnName("Layout"); + + b.Property("LocalizationResourceName") + .HasMaxLength(64) + .HasColumnType("varchar(64)") + .HasColumnName("LocalizationResourceName"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)") + .HasColumnName("Name"); + + b.Property("RenderEngine") + .HasMaxLength(30) + .HasColumnType("varchar(30)") + .HasColumnName("RenderEngine"); + + b.HasKey("Id"); + + b.ToTable("AbpTextTemplateDefinitions", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Abp.WebhooksManagement.WebhookDefinitionRecord", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("ExtraProperties") + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + + b.Property("GroupName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("RequiredFeatures") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("GroupName"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("AbpWebhooksWebhooks", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Abp.WebhooksManagement.WebhookEventRecord", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("Data") + .HasMaxLength(2147483647) + .HasColumnType("longtext") + .HasColumnName("Data"); + + b.Property("DeletionTime") + .HasColumnType("datetime(6)") + .HasColumnName("DeletionTime"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WebhookName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnName("WebhookName"); + + b.HasKey("Id"); + + b.ToTable("AbpWebhooksEvents", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Abp.WebhooksManagement.WebhookGroupDefinitionRecord", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("ExtraProperties") + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("AbpWebhooksWebhookGroups", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Abp.WebhooksManagement.WebhookSendRecord", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)") + .HasColumnName("LastModificationTime"); + + b.Property("RequestHeaders") + .HasMaxLength(2147483647) + .HasColumnType("longtext") + .HasColumnName("RequestHeaders"); + + b.Property("Response") + .HasMaxLength(2147483647) + .HasColumnType("longtext") + .HasColumnName("Response"); + + b.Property("ResponseHeaders") + .HasMaxLength(2147483647) + .HasColumnType("longtext") + .HasColumnName("ResponseHeaders"); + + b.Property("ResponseStatusCode") + .HasColumnType("int"); + + b.Property("SendExactSameData") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WebhookEventId") + .HasColumnType("char(36)"); + + b.Property("WebhookSubscriptionId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("WebhookEventId"); + + b.ToTable("AbpWebhooksSendAttempts", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Abp.WebhooksManagement.WebhookSubscription", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("Description") + .HasMaxLength(128) + .HasColumnType("varchar(128)") + .HasColumnName("Description"); + + b.Property("Headers") + .HasMaxLength(2147483647) + .HasColumnType("longtext") + .HasColumnName("Headers"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Secret") + .HasMaxLength(128) + .HasColumnType("varchar(128)") + .HasColumnName("Secret"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TimeoutDuration") + .HasColumnType("int"); + + b.Property("WebhookUri") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("varchar(255)") + .HasColumnName("WebhookUri"); + + b.Property("Webhooks") + .HasMaxLength(2147483647) + .HasColumnType("longtext") + .HasColumnName("Webhooks"); + + b.HasKey("Id"); + + b.ToTable("AbpWebhooksSubscriptions", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Platform.Datas.Data", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Code") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("varchar(1024)") + .HasColumnName("Code"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("char(36)") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime(6)") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasMaxLength(1024) + .HasColumnType("varchar(1024)") + .HasColumnName("Description"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)") + .HasColumnName("DisplayName"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("IsStatic") + .HasColumnType("tinyint(1)"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("char(36)") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(30) + .HasColumnType("varchar(30)") + .HasColumnName("Name"); + + b.Property("ParentId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("Name"); + + b.ToTable("AppPlatformDatas", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Platform.Datas.DataItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AllowBeNull") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(true); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("DataId") + .HasColumnType("char(36)"); + + b.Property("DefaultValue") + .HasMaxLength(128) + .HasColumnType("varchar(128)") + .HasColumnName("DefaultValue"); + + b.Property("DeleterId") + .HasColumnType("char(36)") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime(6)") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasMaxLength(1024) + .HasColumnType("varchar(1024)") + .HasColumnName("Description"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)") + .HasColumnName("DisplayName"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("IsStatic") + .HasColumnType("tinyint(1)"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("char(36)") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(30) + .HasColumnType("varchar(30)") + .HasColumnName("Name"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId"); + + b.Property("ValueType") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("DataId"); + + b.HasIndex("Name"); + + b.ToTable("AppPlatformDataItems", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Platform.Layouts.Layout", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("DataId") + .HasColumnType("char(36)"); + + b.Property("DeleterId") + .HasColumnType("char(36)") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime(6)") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)") + .HasColumnName("DisplayName"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + + b.Property("Framework") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)") + .HasColumnName("Framework"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("char(36)") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)") + .HasColumnName("Name"); + + b.Property("Path") + .HasMaxLength(255) + .HasColumnType("varchar(255)") + .HasColumnName("Path"); + + b.Property("Redirect") + .HasMaxLength(255) + .HasColumnType("varchar(255)") + .HasColumnName("Redirect"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.ToTable("AppPlatformLayouts", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Platform.Menus.Menu", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Code") + .IsRequired() + .HasMaxLength(23) + .HasColumnType("varchar(23)") + .HasColumnName("Code"); + + b.Property("Component") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("varchar(255)") + .HasColumnName("Component"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("char(36)") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime(6)") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)") + .HasColumnName("DisplayName"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + + b.Property("Framework") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)") + .HasColumnName("Framework"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("IsPublic") + .HasColumnType("tinyint(1)"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("char(36)") + .HasColumnName("LastModifierId"); + + b.Property("LayoutId") + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)") + .HasColumnName("Name"); + + b.Property("ParentId") + .HasColumnType("char(36)"); + + b.Property("Path") + .HasMaxLength(255) + .HasColumnType("varchar(255)") + .HasColumnName("Path"); + + b.Property("Redirect") + .HasMaxLength(255) + .HasColumnType("varchar(255)") + .HasColumnName("Redirect"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.ToTable("AppPlatformMenus", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Platform.Menus.RoleMenu", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("char(36)") + .HasColumnName("LastModifierId"); + + b.Property("MenuId") + .HasColumnType("char(36)"); + + b.Property("RoleName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)") + .HasColumnName("RoleName"); + + b.Property("Startup") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("RoleName", "MenuId"); + + b.ToTable("AppPlatformRoleMenus", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Platform.Menus.UserFavoriteMenu", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AliasName") + .HasMaxLength(128) + .HasColumnType("varchar(128)") + .HasColumnName("AliasName"); + + b.Property("Color") + .HasMaxLength(30) + .HasColumnType("varchar(30)") + .HasColumnName("Color"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)") + .HasColumnName("DisplayName"); + + b.Property("Framework") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)") + .HasColumnName("Framework"); + + b.Property("Icon") + .HasMaxLength(512) + .HasColumnType("varchar(512)") + .HasColumnName("Icon"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("char(36)") + .HasColumnName("LastModifierId"); + + b.Property("MenuId") + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)") + .HasColumnName("Name"); + + b.Property("Path") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("varchar(255)") + .HasColumnName("Path"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("UserId", "MenuId"); + + b.ToTable("AppPlatformUserFavoriteMenus", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Platform.Menus.UserMenu", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("char(36)") + .HasColumnName("LastModifierId"); + + b.Property("MenuId") + .HasColumnType("char(36)"); + + b.Property("Startup") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("UserId", "MenuId"); + + b.ToTable("AppPlatformUserMenus", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Platform.Packages.Package", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Authors") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnName("Authors"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("char(36)") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime(6)") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasMaxLength(255) + .HasColumnType("varchar(255)") + .HasColumnName("Description"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + + b.Property("ForceUpdate") + .HasColumnType("tinyint(1)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("char(36)") + .HasColumnName("LastModifierId"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("varchar(255)") + .HasColumnName("Name"); + + b.Property("Note") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("varchar(1024)") + .HasColumnName("Note"); + + b.Property("Version") + .IsRequired() + .HasMaxLength(30) + .HasColumnType("varchar(30)") + .HasColumnName("Version"); + + b.HasKey("Id"); + + b.HasIndex("Name", "Version"); + + b.ToTable("AppPlatformPackages", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Platform.Packages.PackageBlob", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Authors") + .HasMaxLength(100) + .HasColumnType("varchar(100)") + .HasColumnName("Authors"); + + b.Property("ContentType") + .HasMaxLength(256) + .HasColumnType("varchar(256)") + .HasColumnName("ContentType"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("DownloadCount") + .HasColumnType("int"); + + b.Property("ExtraProperties") + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + + b.Property("License") + .HasMaxLength(1024) + .HasColumnType("varchar(1024)") + .HasColumnName("License"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("varchar(255)") + .HasColumnName("Name"); + + b.Property("PackageId") + .HasColumnType("char(36)"); + + b.Property("SHA256") + .HasMaxLength(256) + .HasColumnType("varchar(256)") + .HasColumnName("SHA256"); + + b.Property("Size") + .HasColumnType("bigint"); + + b.Property("Summary") + .HasMaxLength(1024) + .HasColumnType("varchar(1024)") + .HasColumnName("Summary"); + + b.Property("UpdatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Url") + .HasMaxLength(512) + .HasColumnType("varchar(512)") + .HasColumnName("Url"); + + b.HasKey("Id"); + + b.HasIndex("PackageId", "Name"); + + b.ToTable("AppPlatformPackageBlobs", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Platform.Portal.Enterprise", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Address") + .HasMaxLength(255) + .HasColumnType("varchar(255)") + .HasColumnName("Address"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("char(36)") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime(6)") + .HasColumnName("DeletionTime"); + + b.Property("EnglishName") + .HasMaxLength(512) + .HasColumnType("varchar(512)") + .HasColumnName("EnglishName"); + + b.Property("ExpirationDate") + .HasColumnType("datetime(6)"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("char(36)") + .HasColumnName("LastModifierId"); + + b.Property("LegalMan") + .HasMaxLength(60) + .HasColumnType("varchar(60)") + .HasColumnName("LegalMan"); + + b.Property("Logo") + .HasMaxLength(512) + .HasColumnType("varchar(512)") + .HasColumnName("Logo"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("varchar(255)") + .HasColumnName("Name"); + + b.Property("OrganizationCode") + .HasMaxLength(16) + .HasColumnType("varchar(16)") + .HasColumnName("OrganizationCode"); + + b.Property("RegistrationCode") + .HasMaxLength(30) + .HasColumnType("varchar(30)") + .HasColumnName("RegistrationCode"); + + b.Property("RegistrationDate") + .HasColumnType("datetime(6)"); + + b.Property("TaxCode") + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnName("TaxCode"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("AppPlatformEnterprises", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ApplicationName") + .HasMaxLength(96) + .HasColumnType("varchar(96)") + .HasColumnName("ApplicationName"); + + b.Property("BrowserInfo") + .HasMaxLength(512) + .HasColumnType("varchar(512)") + .HasColumnName("BrowserInfo"); + + b.Property("ClientId") + .HasMaxLength(64) + .HasColumnType("varchar(64)") + .HasColumnName("ClientId"); + + b.Property("ClientIpAddress") + .HasMaxLength(64) + .HasColumnType("varchar(64)") + .HasColumnName("ClientIpAddress"); + + b.Property("ClientName") + .HasMaxLength(128) + .HasColumnType("varchar(128)") + .HasColumnName("ClientName"); + + b.Property("Comments") + .HasMaxLength(256) + .HasColumnType("varchar(256)") + .HasColumnName("Comments"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CorrelationId") + .HasMaxLength(64) + .HasColumnType("varchar(64)") + .HasColumnName("CorrelationId"); + + b.Property("Exceptions") + .HasColumnType("longtext"); + + b.Property("ExecutionDuration") + .HasColumnType("int") + .HasColumnName("ExecutionDuration"); + + b.Property("ExecutionTime") + .HasColumnType("datetime(6)"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + + b.Property("HttpMethod") + .HasMaxLength(16) + .HasColumnType("varchar(16)") + .HasColumnName("HttpMethod"); + + b.Property("HttpStatusCode") + .HasColumnType("int") + .HasColumnName("HttpStatusCode"); + + b.Property("ImpersonatorTenantId") + .HasColumnType("char(36)") + .HasColumnName("ImpersonatorTenantId"); + + b.Property("ImpersonatorTenantName") + .HasMaxLength(64) + .HasColumnType("varchar(64)") + .HasColumnName("ImpersonatorTenantName"); + + b.Property("ImpersonatorUserId") + .HasColumnType("char(36)") + .HasColumnName("ImpersonatorUserId"); + + b.Property("ImpersonatorUserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)") + .HasColumnName("ImpersonatorUserName"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId"); + + b.Property("TenantName") + .HasMaxLength(64) + .HasColumnType("varchar(64)") + .HasColumnName("TenantName"); + + b.Property("Url") + .HasMaxLength(256) + .HasColumnType("varchar(256)") + .HasColumnName("Url"); + + b.Property("UserId") + .HasColumnType("char(36)") + .HasColumnName("UserId"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)") + .HasColumnName("UserName"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "ExecutionTime"); + + b.HasIndex("TenantId", "UserId", "ExecutionTime"); + + b.ToTable("AbpAuditLogs", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AuditLogId") + .HasColumnType("char(36)") + .HasColumnName("AuditLogId"); + + b.Property("ExecutionDuration") + .HasColumnType("int") + .HasColumnName("ExecutionDuration"); + + b.Property("ExecutionTime") + .HasColumnType("datetime(6)") + .HasColumnName("ExecutionTime"); + + b.Property("ExtraProperties") + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + + b.Property("MethodName") + .HasMaxLength(128) + .HasColumnType("varchar(128)") + .HasColumnName("MethodName"); + + b.Property("Parameters") + .HasMaxLength(2000) + .HasColumnType("varchar(2000)") + .HasColumnName("Parameters"); + + b.Property("ServiceName") + .HasMaxLength(256) + .HasColumnType("varchar(256)") + .HasColumnName("ServiceName"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("AuditLogId"); + + b.HasIndex("TenantId", "ServiceName", "MethodName", "ExecutionTime"); + + b.ToTable("AbpAuditLogActions", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AuditLogId") + .HasColumnType("char(36)") + .HasColumnName("AuditLogId"); + + b.Property("ChangeTime") + .HasColumnType("datetime(6)") + .HasColumnName("ChangeTime"); + + b.Property("ChangeType") + .HasColumnType("tinyint unsigned") + .HasColumnName("ChangeType"); + + b.Property("EntityId") + .HasMaxLength(128) + .HasColumnType("varchar(128)") + .HasColumnName("EntityId"); + + b.Property("EntityTenantId") + .HasColumnType("char(36)"); + + b.Property("EntityTypeFullName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)") + .HasColumnName("EntityTypeFullName"); + + b.Property("ExtraProperties") + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("AuditLogId"); + + b.HasIndex("TenantId", "EntityTypeFullName", "EntityId"); + + b.ToTable("AbpEntityChanges", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EntityChangeId") + .HasColumnType("char(36)"); + + b.Property("NewValue") + .HasMaxLength(512) + .HasColumnType("varchar(512)") + .HasColumnName("NewValue"); + + b.Property("OriginalValue") + .HasMaxLength(512) + .HasColumnType("varchar(512)") + .HasColumnName("OriginalValue"); + + b.Property("PropertyName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)") + .HasColumnName("PropertyName"); + + b.Property("PropertyTypeFullName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)") + .HasColumnName("PropertyTypeFullName"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("EntityChangeId"); + + b.ToTable("AbpEntityPropertyChanges", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureDefinitionRecord", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AllowedProviders") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("DefaultValue") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("Description") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("ExtraProperties") + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + + b.Property("GroupName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("IsAvailableToHost") + .HasColumnType("tinyint(1)"); + + b.Property("IsVisibleToClients") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("ParentName") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("ValueType") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.HasKey("Id"); + + b.HasIndex("GroupName"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("AbpFeatures", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureGroupDefinitionRecord", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("ExtraProperties") + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("AbpFeatureGroups", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureValue", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("ProviderKey") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ProviderName") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey") + .IsUnique(); + + b.ToTable("AbpFeatureValues", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("Description") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + + b.Property("IsStatic") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("Regex") + .HasMaxLength(512) + .HasColumnType("varchar(512)"); + + b.Property("RegexDescription") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("Required") + .HasColumnType("tinyint(1)"); + + b.Property("ValueType") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("AbpClaimTypes", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityLinkUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("SourceTenantId") + .HasColumnType("char(36)"); + + b.Property("SourceUserId") + .HasColumnType("char(36)"); + + b.Property("TargetTenantId") + .HasColumnType("char(36)"); + + b.Property("TargetUserId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("SourceUserId", "SourceTenantId", "TargetUserId", "TargetTenantId") + .IsUnique(); + + b.ToTable("AbpLinkUsers", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("EntityVersion") + .HasColumnType("int"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)") + .HasColumnName("IsDefault"); + + b.Property("IsPublic") + .HasColumnType("tinyint(1)") + .HasColumnName("IsPublic"); + + b.Property("IsStatic") + .HasColumnType("tinyint(1)") + .HasColumnName("IsStatic"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName"); + + b.ToTable("AbpRoles", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .HasColumnType("char(36)"); + + b.Property("ClaimType") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("ClaimValue") + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AbpRoleClaims", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentitySecurityLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Action") + .HasMaxLength(96) + .HasColumnType("varchar(96)"); + + b.Property("ApplicationName") + .HasMaxLength(96) + .HasColumnType("varchar(96)"); + + b.Property("BrowserInfo") + .HasMaxLength(512) + .HasColumnType("varchar(512)"); + + b.Property("ClientId") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ClientIpAddress") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CorrelationId") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + + b.Property("Identity") + .HasMaxLength(96) + .HasColumnType("varchar(96)"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId"); + + b.Property("TenantName") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Action"); + + b.HasIndex("TenantId", "ApplicationName"); + + b.HasIndex("TenantId", "Identity"); + + b.HasIndex("TenantId", "UserId"); + + b.ToTable("AbpSecurityLogs", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentitySession", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ClientId") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Device") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("DeviceInfo") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("IpAddresses") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("LastAccessed") + .HasColumnType("datetime(6)"); + + b.Property("SessionId") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("SignedIn") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("Device"); + + b.HasIndex("SessionId"); + + b.HasIndex("TenantId", "UserId"); + + b.ToTable("AbpSessions", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AccessFailedCount") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(0) + .HasColumnName("AccessFailedCount"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("char(36)") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime(6)") + .HasColumnName("DeletionTime"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)") + .HasColumnName("Email"); + + b.Property("EmailConfirmed") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(false) + .HasColumnName("EmailConfirmed"); + + b.Property("EntityVersion") + .HasColumnType("int"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)") + .HasColumnName("IsActive"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("IsExternal") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(false) + .HasColumnName("IsExternal"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("char(36)") + .HasColumnName("LastModifierId"); + + b.Property("LastPasswordChangeTime") + .HasColumnType("datetime(6)"); + + b.Property("LockoutEnabled") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(false) + .HasColumnName("LockoutEnabled"); + + b.Property("LockoutEnd") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .HasMaxLength(64) + .HasColumnType("varchar(64)") + .HasColumnName("Name"); + + b.Property("NormalizedEmail") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)") + .HasColumnName("NormalizedEmail"); + + b.Property("NormalizedUserName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)") + .HasColumnName("NormalizedUserName"); + + b.Property("PasswordHash") + .HasMaxLength(256) + .HasColumnType("varchar(256)") + .HasColumnName("PasswordHash"); + + b.Property("PhoneNumber") + .HasMaxLength(16) + .HasColumnType("varchar(16)") + .HasColumnName("PhoneNumber"); + + b.Property("PhoneNumberConfirmed") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(false) + .HasColumnName("PhoneNumberConfirmed"); + + b.Property("SecurityStamp") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)") + .HasColumnName("SecurityStamp"); + + b.Property("ShouldChangePasswordOnNextLogin") + .HasColumnType("tinyint(1)"); + + b.Property("Surname") + .HasMaxLength(64) + .HasColumnType("varchar(64)") + .HasColumnName("Surname"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId"); + + b.Property("TwoFactorEnabled") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(false) + .HasColumnName("TwoFactorEnabled"); + + b.Property("UserName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)") + .HasColumnName("UserName"); + + b.HasKey("Id"); + + b.HasIndex("Email"); + + b.HasIndex("NormalizedEmail"); + + b.HasIndex("NormalizedUserName"); + + b.HasIndex("UserName"); + + b.ToTable("AbpUsers", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .HasColumnType("char(36)"); + + b.Property("ClaimType") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("ClaimValue") + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AbpUserClaims", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserDelegation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EndTime") + .HasColumnType("datetime(6)"); + + b.Property("SourceUserId") + .HasColumnType("char(36)"); + + b.Property("StartTime") + .HasColumnType("datetime(6)"); + + b.Property("TargetUserId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.ToTable("AbpUserDelegations", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => + { + b.Property("UserId") + .HasColumnType("char(36)"); + + b.Property("LoginProvider") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ProviderDisplayName") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("ProviderKey") + .IsRequired() + .HasMaxLength(196) + .HasColumnType("varchar(196)"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId"); + + b.HasKey("UserId", "LoginProvider"); + + b.HasIndex("LoginProvider", "ProviderKey"); + + b.ToTable("AbpUserLogins", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserOrganizationUnit", b => + { + b.Property("OrganizationUnitId") + .HasColumnType("char(36)"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId"); + + b.HasKey("OrganizationUnitId", "UserId"); + + b.HasIndex("UserId", "OrganizationUnitId"); + + b.ToTable("AbpUserOrganizationUnits", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("char(36)"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId", "UserId"); + + b.ToTable("AbpUserRoles", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("char(36)"); + + b.Property("LoginProvider") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Name") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId"); + + b.Property("Value") + .HasColumnType("longtext"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AbpUserTokens", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Code") + .IsRequired() + .HasMaxLength(95) + .HasColumnType("varchar(95)") + .HasColumnName("Code"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("char(36)") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime(6)") + .HasColumnName("DeletionTime"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)") + .HasColumnName("DisplayName"); + + b.Property("EntityVersion") + .HasColumnType("int"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("char(36)") + .HasColumnName("LastModifierId"); + + b.Property("ParentId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("Code"); + + b.HasIndex("ParentId"); + + b.ToTable("AbpOrganizationUnits", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnitRole", b => + { + b.Property("OrganizationUnitId") + .HasColumnType("char(36)"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId"); + + b.HasKey("OrganizationUnitId", "RoleId"); + + b.HasIndex("RoleId", "OrganizationUnitId"); + + b.ToTable("AbpOrganizationUnitRoles", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResource", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AllowedAccessTokenSigningAlgorithms") + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("char(36)") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime(6)") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasMaxLength(1000) + .HasColumnType("varchar(1000)"); + + b.Property("DisplayName") + .HasMaxLength(200) + .HasColumnType("varchar(200)"); + + b.Property("Enabled") + .HasColumnType("tinyint(1)"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("char(36)") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)"); + + b.Property("ShowInDiscoveryDocument") + .HasColumnType("tinyint(1)"); + + b.HasKey("Id"); + + b.ToTable("IdentityServerApiResources", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b => + { + b.Property("ApiResourceId") + .HasColumnType("char(36)"); + + b.Property("Type") + .HasMaxLength(200) + .HasColumnType("varchar(200)"); + + b.HasKey("ApiResourceId", "Type"); + + b.ToTable("IdentityServerApiResourceClaims", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceProperty", b => + { + b.Property("ApiResourceId") + .HasColumnType("char(36)"); + + b.Property("Key") + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.Property("Value") + .HasMaxLength(300) + .HasColumnType("varchar(300)"); + + b.HasKey("ApiResourceId", "Key", "Value"); + + b.ToTable("IdentityServerApiResourceProperties", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceScope", b => + { + b.Property("ApiResourceId") + .HasColumnType("char(36)"); + + b.Property("Scope") + .HasMaxLength(200) + .HasColumnType("varchar(200)"); + + b.HasKey("ApiResourceId", "Scope"); + + b.ToTable("IdentityServerApiResourceScopes", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceSecret", b => + { + b.Property("ApiResourceId") + .HasColumnType("char(36)"); + + b.Property("Type") + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.Property("Value") + .HasMaxLength(300) + .HasColumnType("varchar(300)"); + + b.Property("Description") + .HasMaxLength(1000) + .HasColumnType("varchar(1000)"); + + b.Property("Expiration") + .HasColumnType("datetime(6)"); + + b.HasKey("ApiResourceId", "Type", "Value"); + + b.ToTable("IdentityServerApiResourceSecrets", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiScope", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("char(36)") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime(6)") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasMaxLength(1000) + .HasColumnType("varchar(1000)"); + + b.Property("DisplayName") + .HasMaxLength(200) + .HasColumnType("varchar(200)"); + + b.Property("Emphasize") + .HasColumnType("tinyint(1)"); + + b.Property("Enabled") + .HasColumnType("tinyint(1)"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("char(36)") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)"); + + b.Property("Required") + .HasColumnType("tinyint(1)"); + + b.Property("ShowInDiscoveryDocument") + .HasColumnType("tinyint(1)"); + + b.HasKey("Id"); + + b.ToTable("IdentityServerApiScopes", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiScopeClaim", b => + { + b.Property("ApiScopeId") + .HasColumnType("char(36)"); + + b.Property("Type") + .HasMaxLength(200) + .HasColumnType("varchar(200)"); + + b.HasKey("ApiScopeId", "Type"); + + b.ToTable("IdentityServerApiScopeClaims", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiScopeProperty", b => + { + b.Property("ApiScopeId") + .HasColumnType("char(36)"); + + b.Property("Key") + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.Property("Value") + .HasMaxLength(300) + .HasColumnType("varchar(300)"); + + b.HasKey("ApiScopeId", "Key", "Value"); + + b.ToTable("IdentityServerApiScopeProperties", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.Client", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AbsoluteRefreshTokenLifetime") + .HasColumnType("int"); + + b.Property("AccessTokenLifetime") + .HasColumnType("int"); + + b.Property("AccessTokenType") + .HasColumnType("int"); + + b.Property("AllowAccessTokensViaBrowser") + .HasColumnType("tinyint(1)"); + + b.Property("AllowOfflineAccess") + .HasColumnType("tinyint(1)"); + + b.Property("AllowPlainTextPkce") + .HasColumnType("tinyint(1)"); + + b.Property("AllowRememberConsent") + .HasColumnType("tinyint(1)"); + + b.Property("AllowedIdentityTokenSigningAlgorithms") + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("AlwaysIncludeUserClaimsInIdToken") + .HasColumnType("tinyint(1)"); + + b.Property("AlwaysSendClientClaims") + .HasColumnType("tinyint(1)"); + + b.Property("AuthorizationCodeLifetime") + .HasColumnType("int"); + + b.Property("BackChannelLogoutSessionRequired") + .HasColumnType("tinyint(1)"); + + b.Property("BackChannelLogoutUri") + .HasMaxLength(2000) + .HasColumnType("varchar(2000)"); + + b.Property("ClientClaimsPrefix") + .HasMaxLength(200) + .HasColumnType("varchar(200)"); + + b.Property("ClientId") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)"); + + b.Property("ClientName") + .HasMaxLength(200) + .HasColumnType("varchar(200)"); + + b.Property("ClientUri") + .HasMaxLength(2000) + .HasColumnType("varchar(2000)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("ConsentLifetime") + .HasColumnType("int"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("char(36)") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime(6)") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasMaxLength(1000) + .HasColumnType("varchar(1000)"); + + b.Property("DeviceCodeLifetime") + .HasColumnType("int"); + + b.Property("EnableLocalLogin") + .HasColumnType("tinyint(1)"); + + b.Property("Enabled") + .HasColumnType("tinyint(1)"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + + b.Property("FrontChannelLogoutSessionRequired") + .HasColumnType("tinyint(1)"); + + b.Property("FrontChannelLogoutUri") + .HasMaxLength(2000) + .HasColumnType("varchar(2000)"); + + b.Property("IdentityTokenLifetime") + .HasColumnType("int"); + + b.Property("IncludeJwtId") + .HasColumnType("tinyint(1)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("char(36)") + .HasColumnName("LastModifierId"); + + b.Property("LogoUri") + .HasMaxLength(2000) + .HasColumnType("varchar(2000)"); + + b.Property("PairWiseSubjectSalt") + .HasMaxLength(200) + .HasColumnType("varchar(200)"); + + b.Property("ProtocolType") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)"); + + b.Property("RefreshTokenExpiration") + .HasColumnType("int"); + + b.Property("RefreshTokenUsage") + .HasColumnType("int"); + + b.Property("RequireClientSecret") + .HasColumnType("tinyint(1)"); + + b.Property("RequireConsent") + .HasColumnType("tinyint(1)"); + + b.Property("RequirePkce") + .HasColumnType("tinyint(1)"); + + b.Property("RequireRequestObject") + .HasColumnType("tinyint(1)"); + + b.Property("SlidingRefreshTokenLifetime") + .HasColumnType("int"); + + b.Property("UpdateAccessTokenClaimsOnRefresh") + .HasColumnType("tinyint(1)"); + + b.Property("UserCodeType") + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("UserSsoLifetime") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ClientId"); + + b.ToTable("IdentityServerClients", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientClaim", b => + { + b.Property("ClientId") + .HasColumnType("char(36)"); + + b.Property("Type") + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.Property("Value") + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.HasKey("ClientId", "Type", "Value"); + + b.ToTable("IdentityServerClientClaims", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientCorsOrigin", b => + { + b.Property("ClientId") + .HasColumnType("char(36)"); + + b.Property("Origin") + .HasMaxLength(150) + .HasColumnType("varchar(150)"); + + b.HasKey("ClientId", "Origin"); + + b.ToTable("IdentityServerClientCorsOrigins", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientGrantType", b => + { + b.Property("ClientId") + .HasColumnType("char(36)"); + + b.Property("GrantType") + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.HasKey("ClientId", "GrantType"); + + b.ToTable("IdentityServerClientGrantTypes", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientIdPRestriction", b => + { + b.Property("ClientId") + .HasColumnType("char(36)"); + + b.Property("Provider") + .HasMaxLength(200) + .HasColumnType("varchar(200)"); + + b.HasKey("ClientId", "Provider"); + + b.ToTable("IdentityServerClientIdPRestrictions", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientPostLogoutRedirectUri", b => + { + b.Property("ClientId") + .HasColumnType("char(36)"); + + b.Property("PostLogoutRedirectUri") + .HasMaxLength(300) + .HasColumnType("varchar(300)"); + + b.HasKey("ClientId", "PostLogoutRedirectUri"); + + b.ToTable("IdentityServerClientPostLogoutRedirectUris", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientProperty", b => + { + b.Property("ClientId") + .HasColumnType("char(36)"); + + b.Property("Key") + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.Property("Value") + .HasMaxLength(300) + .HasColumnType("varchar(300)"); + + b.HasKey("ClientId", "Key", "Value"); + + b.ToTable("IdentityServerClientProperties", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientRedirectUri", b => + { + b.Property("ClientId") + .HasColumnType("char(36)"); + + b.Property("RedirectUri") + .HasMaxLength(300) + .HasColumnType("varchar(300)"); + + b.HasKey("ClientId", "RedirectUri"); + + b.ToTable("IdentityServerClientRedirectUris", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientScope", b => + { + b.Property("ClientId") + .HasColumnType("char(36)"); + + b.Property("Scope") + .HasMaxLength(200) + .HasColumnType("varchar(200)"); + + b.HasKey("ClientId", "Scope"); + + b.ToTable("IdentityServerClientScopes", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientSecret", b => + { + b.Property("ClientId") + .HasColumnType("char(36)"); + + b.Property("Type") + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.Property("Value") + .HasMaxLength(300) + .HasColumnType("varchar(300)"); + + b.Property("Description") + .HasMaxLength(2000) + .HasColumnType("varchar(2000)"); + + b.Property("Expiration") + .HasColumnType("datetime(6)"); + + b.HasKey("ClientId", "Type", "Value"); + + b.ToTable("IdentityServerClientSecrets", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Devices.DeviceFlowCodes", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ClientId") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("Data") + .IsRequired() + .HasMaxLength(10000) + .HasColumnType("varchar(10000)"); + + b.Property("Description") + .HasMaxLength(200) + .HasColumnType("varchar(200)"); + + b.Property("DeviceCode") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)"); + + b.Property("Expiration") + .IsRequired() + .HasColumnType("datetime(6)"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + + b.Property("SessionId") + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("SubjectId") + .HasMaxLength(200) + .HasColumnType("varchar(200)"); + + b.Property("UserCode") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)"); + + b.HasKey("Id"); + + b.HasIndex("DeviceCode") + .IsUnique(); + + b.HasIndex("Expiration"); + + b.HasIndex("UserCode"); + + b.ToTable("IdentityServerDeviceFlowCodes", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Grants.PersistedGrant", b => + { + b.Property("Key") + .HasMaxLength(200) + .HasColumnType("varchar(200)"); + + b.Property("ClientId") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("ConsumedTime") + .HasColumnType("datetime(6)"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("Data") + .IsRequired() + .HasMaxLength(10000) + .HasColumnType("varchar(10000)"); + + b.Property("Description") + .HasMaxLength(200) + .HasColumnType("varchar(200)"); + + b.Property("Expiration") + .HasColumnType("datetime(6)"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + + b.Property("Id") + .HasColumnType("char(36)"); + + b.Property("SessionId") + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("SubjectId") + .HasMaxLength(200) + .HasColumnType("varchar(200)"); + + b.Property("Type") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.HasKey("Key"); + + b.HasIndex("Expiration"); + + b.HasIndex("SubjectId", "ClientId", "Type"); + + b.HasIndex("SubjectId", "SessionId", "Type"); + + b.ToTable("IdentityServerPersistedGrants", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("char(36)") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime(6)") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasMaxLength(1000) + .HasColumnType("varchar(1000)"); + + b.Property("DisplayName") + .HasMaxLength(200) + .HasColumnType("varchar(200)"); + + b.Property("Emphasize") + .HasColumnType("tinyint(1)"); + + b.Property("Enabled") + .HasColumnType("tinyint(1)"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("char(36)") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("varchar(200)"); + + b.Property("Required") + .HasColumnType("tinyint(1)"); + + b.Property("ShowInDiscoveryDocument") + .HasColumnType("tinyint(1)"); + + b.HasKey("Id"); + + b.ToTable("IdentityServerIdentityResources", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResourceClaim", b => + { + b.Property("IdentityResourceId") + .HasColumnType("char(36)"); + + b.Property("Type") + .HasMaxLength(200) + .HasColumnType("varchar(200)"); + + b.HasKey("IdentityResourceId", "Type"); + + b.ToTable("IdentityServerIdentityResourceClaims", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResourceProperty", b => + { + b.Property("IdentityResourceId") + .HasColumnType("char(36)"); + + b.Property("Key") + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.Property("Value") + .HasMaxLength(300) + .HasColumnType("varchar(300)"); + + b.HasKey("IdentityResourceId", "Key", "Value"); + + b.ToTable("IdentityServerIdentityResourceProperties", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.OpenIddict.Applications.OpenIddictApplication", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ApplicationType") + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("ClientId") + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("ClientSecret") + .HasColumnType("longtext"); + + b.Property("ClientType") + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("ClientUri") + .HasColumnType("longtext"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("ConsentType") + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("char(36)") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime(6)") + .HasColumnName("DeletionTime"); + + b.Property("DisplayName") + .HasColumnType("longtext"); + + b.Property("DisplayNames") + .HasColumnType("longtext"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("JsonWebKeySet") + .HasColumnType("longtext"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("char(36)") + .HasColumnName("LastModifierId"); + + b.Property("LogoUri") + .HasColumnType("longtext"); + + b.Property("Permissions") + .HasColumnType("longtext"); + + b.Property("PostLogoutRedirectUris") + .HasColumnType("longtext"); + + b.Property("Properties") + .HasColumnType("longtext"); + + b.Property("RedirectUris") + .HasColumnType("longtext"); + + b.Property("Requirements") + .HasColumnType("longtext"); + + b.Property("Settings") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("ClientId"); + + b.ToTable("OpenIddictApplications", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.OpenIddict.Authorizations.OpenIddictAuthorization", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ApplicationId") + .HasColumnType("char(36)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationDate") + .HasColumnType("datetime(6)"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("char(36)") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime(6)") + .HasColumnName("DeletionTime"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("char(36)") + .HasColumnName("LastModifierId"); + + b.Property("Properties") + .HasColumnType("longtext"); + + b.Property("Scopes") + .HasColumnType("longtext"); + + b.Property("Status") + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("Subject") + .HasMaxLength(400) + .HasColumnType("varchar(400)"); + + b.Property("Type") + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationId", "Status", "Subject", "Type"); + + b.ToTable("OpenIddictAuthorizations", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.OpenIddict.Scopes.OpenIddictScope", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("char(36)") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime(6)") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Descriptions") + .HasColumnType("longtext"); + + b.Property("DisplayName") + .HasColumnType("longtext"); + + b.Property("DisplayNames") + .HasColumnType("longtext"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("char(36)") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .HasMaxLength(200) + .HasColumnType("varchar(200)"); + + b.Property("Properties") + .HasColumnType("longtext"); + + b.Property("Resources") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("Name"); + + b.ToTable("OpenIddictScopes", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.OpenIddict.Tokens.OpenIddictToken", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ApplicationId") + .HasColumnType("char(36)"); + + b.Property("AuthorizationId") + .HasColumnType("char(36)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationDate") + .HasColumnType("datetime(6)"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("char(36)") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime(6)") + .HasColumnName("DeletionTime"); + + b.Property("ExpirationDate") + .HasColumnType("datetime(6)"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("char(36)") + .HasColumnName("LastModifierId"); + + b.Property("Payload") + .HasColumnType("longtext"); + + b.Property("Properties") + .HasColumnType("longtext"); + + b.Property("RedemptionDate") + .HasColumnType("datetime(6)"); + + b.Property("ReferenceId") + .HasMaxLength(100) + .HasColumnType("varchar(100)"); + + b.Property("Status") + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("Subject") + .HasMaxLength(400) + .HasColumnType("varchar(400)"); + + b.Property("Type") + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.HasKey("Id"); + + b.HasIndex("AuthorizationId"); + + b.HasIndex("ReferenceId"); + + b.HasIndex("ApplicationId", "Status", "Subject", "Type"); + + b.ToTable("OpenIddictTokens", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionDefinitionRecord", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("ExtraProperties") + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + + b.Property("GroupName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("MultiTenancySide") + .HasColumnType("tinyint unsigned"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("ParentName") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("Providers") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("StateCheckers") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("GroupName"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("AbpPermissions", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("ProviderKey") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ProviderName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Name", "ProviderName", "ProviderKey") + .IsUnique(); + + b.ToTable("AbpPermissionGrants", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGroupDefinitionRecord", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("ExtraProperties") + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("AbpPermissionGroups", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("ProviderKey") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ProviderName") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey") + .IsUnique(); + + b.ToTable("AbpSettings", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.SettingManagement.SettingDefinitionRecord", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("DefaultValue") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("Description") + .HasMaxLength(512) + .HasColumnType("varchar(512)"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("ExtraProperties") + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + + b.Property("IsEncrypted") + .HasColumnType("tinyint(1)"); + + b.Property("IsInherited") + .HasColumnType("tinyint(1)"); + + b.Property("IsVisibleToClients") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("Providers") + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("AbpSettingDefinitions", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Abp.Demo.Books.Book", b => + { + b.HasOne("LINGYUN.Abp.Demo.Authors.Author", null) + .WithMany() + .HasForeignKey("AuthorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("LINGYUN.Abp.Saas.Tenants.Tenant", b => + { + b.HasOne("LINGYUN.Abp.Saas.Editions.Edition", "Edition") + .WithMany() + .HasForeignKey("EditionId"); + + b.Navigation("Edition"); + }); + + modelBuilder.Entity("LINGYUN.Abp.Saas.Tenants.TenantConnectionString", b => + { + b.HasOne("LINGYUN.Abp.Saas.Tenants.Tenant", null) + .WithMany("ConnectionStrings") + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("LINGYUN.Abp.WebhooksManagement.WebhookSendRecord", b => + { + b.HasOne("LINGYUN.Abp.WebhooksManagement.WebhookEventRecord", "WebhookEvent") + .WithOne() + .HasForeignKey("LINGYUN.Abp.WebhooksManagement.WebhookSendRecord", "WebhookEventId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("WebhookEvent"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Datas.DataItem", b => + { + b.HasOne("LINGYUN.Platform.Datas.Data", null) + .WithMany("Items") + .HasForeignKey("DataId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("LINGYUN.Platform.Packages.PackageBlob", b => + { + b.HasOne("LINGYUN.Platform.Packages.Package", "Package") + .WithMany("Blobs") + .HasForeignKey("PackageId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Package"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => + { + b.HasOne("Volo.Abp.AuditLogging.AuditLog", null) + .WithMany("Actions") + .HasForeignKey("AuditLogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => + { + b.HasOne("Volo.Abp.AuditLogging.AuditLog", null) + .WithMany("EntityChanges") + .HasForeignKey("AuditLogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => + { + b.HasOne("Volo.Abp.AuditLogging.EntityChange", null) + .WithMany("PropertyChanges") + .HasForeignKey("EntityChangeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => + { + b.HasOne("Volo.Abp.Identity.IdentityRole", null) + .WithMany("Claims") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Claims") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Logins") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserOrganizationUnit", b => + { + b.HasOne("Volo.Abp.Identity.OrganizationUnit", null) + .WithMany() + .HasForeignKey("OrganizationUnitId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("OrganizationUnits") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => + { + b.HasOne("Volo.Abp.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Roles") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Tokens") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => + { + b.HasOne("Volo.Abp.Identity.OrganizationUnit", null) + .WithMany() + .HasForeignKey("ParentId"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnitRole", b => + { + b.HasOne("Volo.Abp.Identity.OrganizationUnit", null) + .WithMany("Roles") + .HasForeignKey("OrganizationUnitId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Volo.Abp.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b => + { + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) + .WithMany("UserClaims") + .HasForeignKey("ApiResourceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceProperty", b => + { + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) + .WithMany("Properties") + .HasForeignKey("ApiResourceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceScope", b => + { + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) + .WithMany("Scopes") + .HasForeignKey("ApiResourceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceSecret", b => + { + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) + .WithMany("Secrets") + .HasForeignKey("ApiResourceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiScopeClaim", b => + { + b.HasOne("Volo.Abp.IdentityServer.ApiScopes.ApiScope", null) + .WithMany("UserClaims") + .HasForeignKey("ApiScopeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiScopeProperty", b => + { + b.HasOne("Volo.Abp.IdentityServer.ApiScopes.ApiScope", null) + .WithMany("Properties") + .HasForeignKey("ApiScopeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientClaim", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) + .WithMany("Claims") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientCorsOrigin", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) + .WithMany("AllowedCorsOrigins") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientGrantType", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) + .WithMany("AllowedGrantTypes") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientIdPRestriction", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) + .WithMany("IdentityProviderRestrictions") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientPostLogoutRedirectUri", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) + .WithMany("PostLogoutRedirectUris") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientProperty", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) + .WithMany("Properties") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientRedirectUri", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) + .WithMany("RedirectUris") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientScope", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) + .WithMany("AllowedScopes") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientSecret", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) + .WithMany("ClientSecrets") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResourceClaim", b => + { + b.HasOne("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", null) + .WithMany("UserClaims") + .HasForeignKey("IdentityResourceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResourceProperty", b => + { + b.HasOne("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", null) + .WithMany("Properties") + .HasForeignKey("IdentityResourceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.OpenIddict.Authorizations.OpenIddictAuthorization", b => + { + b.HasOne("Volo.Abp.OpenIddict.Applications.OpenIddictApplication", null) + .WithMany() + .HasForeignKey("ApplicationId"); + }); + + modelBuilder.Entity("Volo.Abp.OpenIddict.Tokens.OpenIddictToken", b => + { + b.HasOne("Volo.Abp.OpenIddict.Applications.OpenIddictApplication", null) + .WithMany() + .HasForeignKey("ApplicationId"); + + b.HasOne("Volo.Abp.OpenIddict.Authorizations.OpenIddictAuthorization", null) + .WithMany() + .HasForeignKey("AuthorizationId"); + }); + + modelBuilder.Entity("LINGYUN.Abp.Saas.Tenants.Tenant", b => + { + b.Navigation("ConnectionStrings"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Datas.Data", b => + { + b.Navigation("Items"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Packages.Package", b => + { + b.Navigation("Blobs"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => + { + b.Navigation("Actions"); + + b.Navigation("EntityChanges"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => + { + b.Navigation("PropertyChanges"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => + { + b.Navigation("Claims"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => + { + b.Navigation("Claims"); + + b.Navigation("Logins"); + + b.Navigation("OrganizationUnits"); + + b.Navigation("Roles"); + + b.Navigation("Tokens"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => + { + b.Navigation("Roles"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResource", b => + { + b.Navigation("Properties"); + + b.Navigation("Scopes"); + + b.Navigation("Secrets"); + + b.Navigation("UserClaims"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiScopes.ApiScope", b => + { + b.Navigation("Properties"); + + b.Navigation("UserClaims"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.Client", b => + { + b.Navigation("AllowedCorsOrigins"); + + b.Navigation("AllowedGrantTypes"); + + b.Navigation("AllowedScopes"); + + b.Navigation("Claims"); + + b.Navigation("ClientSecrets"); + + b.Navigation("IdentityProviderRestrictions"); + + b.Navigation("PostLogoutRedirectUris"); + + b.Navigation("Properties"); + + b.Navigation("RedirectUris"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", b => + { + b.Navigation("Properties"); + + b.Navigation("UserClaims"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/aspnet-core/migrations/LY.MicroService.Applications.Single.EntityFrameworkCore/Migrations/20240929080118_Add-Demo-Module.cs b/aspnet-core/migrations/LY.MicroService.Applications.Single.EntityFrameworkCore/Migrations/20240929080118_Add-Demo-Module.cs new file mode 100644 index 000000000..bbf9c68b9 --- /dev/null +++ b/aspnet-core/migrations/LY.MicroService.Applications.Single.EntityFrameworkCore/Migrations/20240929080118_Add-Demo-Module.cs @@ -0,0 +1,95 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace LY.MicroService.Applications.Single.EntityFrameworkCore.Migrations +{ + /// + public partial class AddDemoModule : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Demo_Authors", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + Name = table.Column(type: "varchar(64)", maxLength: 64, nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + BirthDate = table.Column(type: "datetime(6)", nullable: false), + ShortBio = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + ExtraProperties = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + ConcurrencyStamp = table.Column(type: "varchar(40)", maxLength: 40, nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + CreationTime = table.Column(type: "datetime(6)", nullable: false), + CreatorId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), + LastModificationTime = table.Column(type: "datetime(6)", nullable: true), + LastModifierId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), + IsDeleted = table.Column(type: "tinyint(1)", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), + DeletionTime = table.Column(type: "datetime(6)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Demo_Authors", x => x.Id); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "Demo_Books", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + Name = table.Column(type: "varchar(128)", maxLength: 128, nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Type = table.Column(type: "int", nullable: false), + PublishDate = table.Column(type: "datetime(6)", nullable: false), + Price = table.Column(type: "float", nullable: false), + AuthorId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + ExtraProperties = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + ConcurrencyStamp = table.Column(type: "varchar(40)", maxLength: 40, nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + CreationTime = table.Column(type: "datetime(6)", nullable: false), + CreatorId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), + LastModificationTime = table.Column(type: "datetime(6)", nullable: true), + LastModifierId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_Demo_Books", x => x.Id); + table.ForeignKey( + name: "FK_Demo_Books_Demo_Authors_AuthorId", + column: x => x.AuthorId, + principalTable: "Demo_Authors", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateIndex( + name: "IX_Demo_Authors_Name", + table: "Demo_Authors", + column: "Name"); + + migrationBuilder.CreateIndex( + name: "IX_Demo_Books_AuthorId", + table: "Demo_Books", + column: "AuthorId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "Demo_Books"); + + migrationBuilder.DropTable( + name: "Demo_Authors"); + } + } +} diff --git a/aspnet-core/migrations/LY.MicroService.Applications.Single.EntityFrameworkCore/Migrations/SingleMigrationsDbContextModelSnapshot.cs b/aspnet-core/migrations/LY.MicroService.Applications.Single.EntityFrameworkCore/Migrations/SingleMigrationsDbContextModelSnapshot.cs index f97a6912d..b7be23f59 100644 --- a/aspnet-core/migrations/LY.MicroService.Applications.Single.EntityFrameworkCore/Migrations/SingleMigrationsDbContextModelSnapshot.cs +++ b/aspnet-core/migrations/LY.MicroService.Applications.Single.EntityFrameworkCore/Migrations/SingleMigrationsDbContextModelSnapshot.cs @@ -24,6 +24,130 @@ namespace LY.MicroService.Applications.Single.EntityFrameworkCore.Migrations MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); + modelBuilder.Entity("LINGYUN.Abp.Demo.Authors.Author", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BirthDate") + .HasColumnType("datetime(6)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("char(36)") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime(6)") + .HasColumnName("DeletionTime"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("char(36)") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ShortBio") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("Name"); + + b.ToTable("Demo_Authors", (string)null); + }); + + modelBuilder.Entity("LINGYUN.Abp.Demo.Books.Book", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AuthorId") + .HasColumnType("char(36)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("longtext") + .HasColumnName("ExtraProperties"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("char(36)") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("Price") + .HasColumnType("float"); + + b.Property("PublishDate") + .HasColumnType("datetime(6)"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("AuthorId"); + + b.ToTable("Demo_Books", (string)null); + }); + modelBuilder.Entity("LINGYUN.Abp.LocalizationManagement.Language", b => { b.Property("Id") @@ -4967,6 +5091,15 @@ namespace LY.MicroService.Applications.Single.EntityFrameworkCore.Migrations b.ToTable("AbpSettingDefinitions", (string)null); }); + modelBuilder.Entity("LINGYUN.Abp.Demo.Books.Book", b => + { + b.HasOne("LINGYUN.Abp.Demo.Authors.Author", null) + .WithMany() + .HasForeignKey("AuthorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + modelBuilder.Entity("LINGYUN.Abp.Saas.Tenants.Tenant", b => { b.HasOne("LINGYUN.Abp.Saas.Editions.Edition", "Edition") diff --git a/aspnet-core/migrations/LY.MicroService.Applications.Single.EntityFrameworkCore/SingleMigrationsDbContext.cs b/aspnet-core/migrations/LY.MicroService.Applications.Single.EntityFrameworkCore/SingleMigrationsDbContext.cs index 4829e0ca6..ecc710889 100644 --- a/aspnet-core/migrations/LY.MicroService.Applications.Single.EntityFrameworkCore/SingleMigrationsDbContext.cs +++ b/aspnet-core/migrations/LY.MicroService.Applications.Single.EntityFrameworkCore/SingleMigrationsDbContext.cs @@ -1,4 +1,5 @@ -using LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore; +using LINGYUN.Abp.Demo.EntityFrameworkCore; +using LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore; using LINGYUN.Abp.MessageService.EntityFrameworkCore; using LINGYUN.Abp.Notifications.EntityFrameworkCore; using LINGYUN.Abp.Saas.EntityFrameworkCore; @@ -48,5 +49,7 @@ public class SingleMigrationsDbContext : AbpDbContext modelBuilder.ConfigureNotifications(); modelBuilder.ConfigureNotificationsDefinition(); modelBuilder.ConfigureMessageService(); + + modelBuilder.ConfigureDemo(); } } diff --git a/aspnet-core/modules/caching-management/LINGYUN.Abp.CachingManagement.StackExchangeRedis/LINGYUN/Abp/CachingManagement/StackExchangeRedis/StackExchangeRedisCacheManager.cs b/aspnet-core/modules/caching-management/LINGYUN.Abp.CachingManagement.StackExchangeRedis/LINGYUN/Abp/CachingManagement/StackExchangeRedis/StackExchangeRedisCacheManager.cs index 28049b23d..e2516f100 100644 --- a/aspnet-core/modules/caching-management/LINGYUN.Abp.CachingManagement.StackExchangeRedis/LINGYUN/Abp/CachingManagement/StackExchangeRedis/StackExchangeRedisCacheManager.cs +++ b/aspnet-core/modules/caching-management/LINGYUN.Abp.CachingManagement.StackExchangeRedis/LINGYUN/Abp/CachingManagement/StackExchangeRedis/StackExchangeRedisCacheManager.cs @@ -19,7 +19,6 @@ namespace LINGYUN.Abp.CachingManagement.StackExchangeRedis; [Dependency(ReplaceServices = true)] public class StackExchangeRedisCacheManager : ICacheManager, ISingletonDependency { - private readonly static MethodInfo GetRedisDatabaseMethod; private readonly static MethodInfo ConnectAsyncMethod; protected RedisCacheOptions RedisCacheOptions { get; } @@ -28,15 +27,11 @@ public class StackExchangeRedisCacheManager : ICacheManager, ISingletonDependenc protected IDistributedCache DistributedCache { get; } protected AbpRedisCache RedisCache => DistributedCache.As(); - protected IDatabase RedisDatabase => GetRedisDatabase(); - private IDatabase _redisDatabase; - static StackExchangeRedisCacheManager() { var type = typeof(AbpRedisCache); ConnectAsyncMethod = type.GetMethod("ConnectAsync", BindingFlags.Instance | BindingFlags.NonPublic); - GetRedisDatabaseMethod = type.GetMethod("GetRedisDatabase", BindingFlags.Instance | BindingFlags.NonPublic); } public StackExchangeRedisCacheManager( @@ -53,7 +48,7 @@ public class StackExchangeRedisCacheManager : ICacheManager, ISingletonDependenc public async virtual Task GetKeysAsync(GetCacheKeysRequest request, CancellationToken cancellationToken = default) { - await ConnectAsync(cancellationToken); + var cache = await ConnectAsync(cancellationToken); // 缓存键名规则: InstanceName + (t + TenantId)(CurrentTenant.IsAvailable) + CacheItemName + KeyPrefix + Key // 缓存键名规则: InstanceName + (c:)(!CurrentTenant.IsAvailable) + CacheItemName + KeyPrefix + Key @@ -75,17 +70,17 @@ public class StackExchangeRedisCacheManager : ICacheManager, ISingletonDependenc match += "c:*"; } // abp*t:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx*application* - // abp*c:*application* + // abp*c:application* if (!CacheOptions.KeyPrefix.IsNullOrWhiteSpace()) { - match += CacheOptions.KeyPrefix + "*"; + match += CacheOptions.KeyPrefix.EnsureEndsWith('*'); } // app*abp*t:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx*application* // app*abp*c:*application* if (!request.Prefix.IsNullOrWhiteSpace()) { - match = request.Prefix + "*" + match; + match += request.Prefix.EnsureEndsWith('*') + match; } // if filter is Mailing: @@ -93,14 +88,14 @@ public class StackExchangeRedisCacheManager : ICacheManager, ISingletonDependenc // app*abp*c:*application*Mailing* if (!request.Filter.IsNullOrWhiteSpace()) { - match += request.Filter + "*"; + match += request.Filter.EnsureStartsWith('*').EnsureEndsWith('*'); } // scan 0 match * count 50000 // redis有自定义的key排序,由传递的marker来确定下一次检索起始位 var args = new object[] { request.Marker ?? "0", "match", match, "count", 50000 }; - var result = await RedisDatabase.ExecuteAsync("scan", args); + var result = await cache.ExecuteAsync("scan", args); var results = (RedisResult[])result; @@ -119,19 +114,20 @@ public class StackExchangeRedisCacheManager : ICacheManager, ISingletonDependenc long size = 0; var values = new Dictionary(); + var cache = await ConnectAsync(cancellationToken); + // type RedisKey - var type = await RedisDatabase.KeyTypeAsync(key); + var type = await cache.KeyTypeAsync(key); // ttl RedisKey - var ttl = await RedisDatabase.KeyTimeToLiveAsync(key); + var ttl = await cache.KeyTimeToLiveAsync(key); switch (type) { case RedisType.Hash: // hlen RedisKey - size = await RedisDatabase.HashLengthAsync(key); + size = await cache.HashLengthAsync(key); // hscan RedisKey - var hvalues = RedisDatabase.HashScan(key); - foreach (var hvalue in hvalues) + await foreach (var hvalue in cache.HashScanAsync(key)) { if (!hvalue.Name.IsNullOrEmpty) { @@ -141,16 +137,16 @@ public class StackExchangeRedisCacheManager : ICacheManager, ISingletonDependenc break; case RedisType.String: // strlen RedisKey - size = await RedisDatabase.StringLengthAsync(key); + size = await cache.StringLengthAsync(key); // get RedisKey - var svalue = RedisDatabase.StringGet(key); + var svalue = await cache.StringGetAsync(key); values.Add("value", svalue.IsNullOrEmpty ? "" : svalue.ToString()); break; case RedisType.List: // llen RedisKey - size = await RedisDatabase.ListLengthAsync(key); + size = await cache.ListLengthAsync(key); // lrange RedisKey - var lvalues = RedisDatabase.ListRange(key); + var lvalues = await cache.ListRangeAsync(key); for (var lindex = 0; lindex < lvalues.Length; lindex++) { if (!lvalues[lindex].IsNullOrEmpty) @@ -228,21 +224,6 @@ public class StackExchangeRedisCacheManager : ICacheManager, ISingletonDependenc protected virtual ValueTask ConnectAsync(CancellationToken token = default) { - if (_redisDatabase != null) - { - return default; - } - return (ValueTask)ConnectAsyncMethod.Invoke(RedisCache, new object[] { token }); } - - private IDatabase GetRedisDatabase() - { - if (_redisDatabase == null) - { - _redisDatabase = GetRedisDatabaseMethod.Invoke(RedisCache, null) as IDatabase; - } - - return _redisDatabase; - } } diff --git a/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Application/LINGYUN/Abp/DataProtectionManagement/DataProtectionManagementApplicationMappingProfile.cs b/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Application/LINGYUN/Abp/DataProtectionManagement/DataProtectionManagementApplicationMappingProfile.cs index 0141a1461..84efe897e 100644 --- a/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Application/LINGYUN/Abp/DataProtectionManagement/DataProtectionManagementApplicationMappingProfile.cs +++ b/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Application/LINGYUN/Abp/DataProtectionManagement/DataProtectionManagementApplicationMappingProfile.cs @@ -10,6 +10,10 @@ public class DataProtectionManagementApplicationMappingProfile :Profile CreateMap() .ForMember(dto => dto.ValueRange, map => map.MapFrom(src => MapToArray(src.ValueRange))); CreateMap(); + CreateMap() + .ForMember(dto => dto.AllowProperties, map => map.MapFrom(src => MapToArray(src.AllowProperties))); + CreateMap() + .ForMember(dto => dto.AllowProperties, map => map.MapFrom(src => MapToArray(src.AllowProperties))); } private string[] MapToArray(string val) diff --git a/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Application/LINGYUN/Abp/DataProtectionManagement/DataProtectionManagementApplicationServiceBase.cs b/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Application/LINGYUN/Abp/DataProtectionManagement/DataProtectionManagementApplicationServiceBase.cs index 7dfcca1a0..400ad6085 100644 --- a/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Application/LINGYUN/Abp/DataProtectionManagement/DataProtectionManagementApplicationServiceBase.cs +++ b/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Application/LINGYUN/Abp/DataProtectionManagement/DataProtectionManagementApplicationServiceBase.cs @@ -1,11 +1,12 @@ -using Volo.Abp.Application.Services; +using LINGYUN.Abp.DataProtection.Localization; +using Volo.Abp.Application.Services; namespace LINGYUN.Abp.DataProtectionManagement; public abstract class DataProtectionManagementApplicationServiceBase : ApplicationService { protected DataProtectionManagementApplicationServiceBase() { - LocalizationResource = typeof(AbpDataProtectionManagementApplicationModule); + LocalizationResource = typeof(DataProtectionResource); ObjectMapperContext = typeof(AbpDataProtectionManagementApplicationModule); } } diff --git a/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Application/LINGYUN/Abp/DataProtectionManagement/OrganizationUnitEntityRuleAppService.cs b/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Application/LINGYUN/Abp/DataProtectionManagement/OrganizationUnitEntityRuleAppService.cs index 88f2a6437..ef4d5cab8 100644 --- a/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Application/LINGYUN/Abp/DataProtectionManagement/OrganizationUnitEntityRuleAppService.cs +++ b/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Application/LINGYUN/Abp/DataProtectionManagement/OrganizationUnitEntityRuleAppService.cs @@ -36,8 +36,8 @@ public class OrganizationUnitEntityRuleAppService : DataProtectionManagementAppl { throw new BusinessException(DataProtectionManagementErrorCodes.OrganizationUnitEntityRule.DuplicateEntityRule) .WithData(nameof(OrganizationUnitEntityRule.OrgCode), input.OrgCode) - .WithData(nameof(EntityTypeInfo.DisplayName), entityTypeInfo.DisplayName) - .WithData(nameof(EntityRuleBase.Operation), input.Operation); + .WithData(nameof(EntityTypeInfo.Name), entityTypeInfo.Name) + .WithData(nameof(EntityRuleBase.Operation), input.Operation.ToString()); } var entityRule = new OrganizationUnitEntityRule( @@ -78,6 +78,7 @@ public class OrganizationUnitEntityRuleAppService : DataProtectionManagementAppl { entityRule.AllowProperties = allowPropertites; } + entityRule.FilterGroup = input.FilterGroup; entityRule = await _organizationUnitEntityRuleRepository.UpdateAsync(entityRule); diff --git a/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Application/LINGYUN/Abp/DataProtectionManagement/RoleEntityRuleAppService.cs b/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Application/LINGYUN/Abp/DataProtectionManagement/RoleEntityRuleAppService.cs index 21a7fedc3..f77ce9ef4 100644 --- a/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Application/LINGYUN/Abp/DataProtectionManagement/RoleEntityRuleAppService.cs +++ b/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Application/LINGYUN/Abp/DataProtectionManagement/RoleEntityRuleAppService.cs @@ -34,10 +34,10 @@ public class RoleEntityRuleAppService : DataProtectionManagementApplicationServi var entityTypeInfo = await _entityTypeInfoRepository.GetAsync(input.EntityTypeId); if (await _roleEntityRuleRepository.FindEntityRuleAsync(input.RoleName, entityTypeInfo.TypeFullName, input.Operation) != null) { - throw new BusinessException(DataProtectionManagementErrorCodes.OrganizationUnitEntityRule.DuplicateEntityRule) + throw new BusinessException(DataProtectionManagementErrorCodes.RoleEntityRule.DuplicateEntityRule) .WithData(nameof(RoleEntityRule.RoleName), input.RoleName) - .WithData(nameof(EntityTypeInfo.DisplayName), entityTypeInfo.DisplayName) - .WithData(nameof(EntityRuleBase.Operation), input.Operation); + .WithData(nameof(EntityTypeInfo.Name), entityTypeInfo.Name) + .WithData(nameof(EntityRuleBase.Operation), input.Operation.ToString()); } var entityRule = new RoleEntityRule( @@ -79,6 +79,8 @@ public class RoleEntityRuleAppService : DataProtectionManagementApplicationServi entityRule.AllowProperties = allowPropertites; } + entityRule.FilterGroup = input.FilterGroup; + entityRule = await _roleEntityRuleRepository.UpdateAsync(entityRule); await CurrentUnitOfWork.SaveChangesAsync(); diff --git a/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Domain.Shared/LINGYUN.Abp.DataProtectionManagement.Domain.Shared.csproj b/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Domain.Shared/LINGYUN.Abp.DataProtectionManagement.Domain.Shared.csproj index 8abcfdc0c..4e27439f9 100644 --- a/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Domain.Shared/LINGYUN.Abp.DataProtectionManagement.Domain.Shared.csproj +++ b/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Domain.Shared/LINGYUN.Abp.DataProtectionManagement.Domain.Shared.csproj @@ -13,6 +13,16 @@ + + + + + + + + + + diff --git a/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Domain.Shared/LINGYUN/Abp/DataProtectionManagement/AbpDataProtectionManagementDomainSharedModule.cs b/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Domain.Shared/LINGYUN/Abp/DataProtectionManagement/AbpDataProtectionManagementDomainSharedModule.cs index 59635febc..da5fb9ae4 100644 --- a/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Domain.Shared/LINGYUN/Abp/DataProtectionManagement/AbpDataProtectionManagementDomainSharedModule.cs +++ b/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Domain.Shared/LINGYUN/Abp/DataProtectionManagement/AbpDataProtectionManagementDomainSharedModule.cs @@ -1,10 +1,34 @@ -using Volo.Abp.Domain; +using LINGYUN.Abp.DataProtection; +using LINGYUN.Abp.DataProtection.Localization; +using Volo.Abp.Domain; +using Volo.Abp.Localization; +using Volo.Abp.Localization.ExceptionHandling; using Volo.Abp.Modularity; +using Volo.Abp.VirtualFileSystem; namespace LINGYUN.Abp.DataProtectionManagement; [DependsOn(typeof(AbpDddDomainSharedModule))] +[DependsOn(typeof(AbpDataProtectionAbstractionsModule))] public class AbpDataProtectionManagementDomainSharedModule : AbpModule { + public override void ConfigureServices(ServiceConfigurationContext context) + { + Configure(options => + { + options.FileSets.AddEmbedded(); + }); + Configure(options => + { + options.Resources + .Get() + .AddVirtualJson("/LINGYUN/Abp/DataProtectionManagement/Localization/Resources"); + }); + + Configure(options => + { + options.MapCodeNamespace(DataProtectionManagementErrorCodes.Namespace, typeof(DataProtectionResource)); + }); + } } diff --git a/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Domain.Shared/LINGYUN/Abp/DataProtectionManagement/DataProtectionManagementErrorCodes.cs b/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Domain.Shared/LINGYUN/Abp/DataProtectionManagement/DataProtectionManagementErrorCodes.cs index 21177a1ea..1f57aba4b 100644 --- a/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Domain.Shared/LINGYUN/Abp/DataProtectionManagement/DataProtectionManagementErrorCodes.cs +++ b/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Domain.Shared/LINGYUN/Abp/DataProtectionManagement/DataProtectionManagementErrorCodes.cs @@ -8,11 +8,11 @@ public static class DataProtectionManagementErrorCodes { public const string Prefix = Namespace + ":001"; /// - /// 已经存在相同的类型 + /// 已经存在名为 {Name} 的实体类型定义 /// public const string DuplicateTypeInfo = Prefix + "100"; /// - /// 已经存在相同的属性 + /// 实体类型已经存在名为 {Name} 的属性定义 /// public const string DuplicateProperty = Prefix + "200"; } @@ -21,7 +21,7 @@ public static class DataProtectionManagementErrorCodes { public const string Prefix = Namespace + ":002"; /// - /// 已经存在相同的实体数据访问规则 + /// 已为角色 {RoleName} 分配了实体 {Name} 的 {Operation} 访问规则! /// public const string DuplicateEntityRule = Prefix + "100"; } @@ -30,7 +30,7 @@ public static class DataProtectionManagementErrorCodes { public const string Prefix = Namespace + ":003"; /// - /// 已经存在相同的实体数据访问规则 + /// 已为组织机构 {OrgCode} 分配了实体 {Name} 的 {Operation} 访问规则! /// public const string DuplicateEntityRule = Prefix + "100"; } diff --git a/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Domain.Shared/LINGYUN/Abp/DataProtectionManagement/Localization/Resources/en.json b/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Domain.Shared/LINGYUN/Abp/DataProtectionManagement/Localization/Resources/en.json new file mode 100644 index 000000000..f25078dce --- /dev/null +++ b/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Domain.Shared/LINGYUN/Abp/DataProtectionManagement/Localization/Resources/en.json @@ -0,0 +1,9 @@ +{ + "culture": "en", + "texts": { + "DataProtectionManagement:001100": "There already exists an entity type definition named {Name}!", + "DataProtectionManagement:001200": "The entity type already has a property definition named {Name}!", + "DataProtectionManagement:002100": "The {Operation} access rule for entity {Name} has been assigned to role {RoleName}!", + "DataProtectionManagement:003100": "The {Operation} access rule for entity {Name} has been assigned to organization {RoleName}!" + } +} \ No newline at end of file diff --git a/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Domain.Shared/LINGYUN/Abp/DataProtectionManagement/Localization/Resources/zh-Hans.json b/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Domain.Shared/LINGYUN/Abp/DataProtectionManagement/Localization/Resources/zh-Hans.json new file mode 100644 index 000000000..2e1047a28 --- /dev/null +++ b/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Domain.Shared/LINGYUN/Abp/DataProtectionManagement/Localization/Resources/zh-Hans.json @@ -0,0 +1,9 @@ +{ + "culture": "zh-Hans", + "texts": { + "DataProtectionManagement:001100": "已经存在名为 {Name} 的实体类型定义!", + "DataProtectionManagement:001200": "实体类型已经存在名为 {Name} 的属性定义!", + "DataProtectionManagement:002100": "已为角色 {RoleName} 分配了实体 {Name} 的 {Operation} 访问规则!", + "DataProtectionManagement:003100": "已为组织机构 {OrgCode} 分配了实体 {Name} 的 {Operation} 访问规则!" + } +} \ No newline at end of file diff --git a/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Domain/LINGYUN/Abp/DataProtectionManagement/AbpDataProtectionManagementDomainModule.cs b/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Domain/LINGYUN/Abp/DataProtectionManagement/AbpDataProtectionManagementDomainModule.cs index 1e4967ce1..3691baad5 100644 --- a/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Domain/LINGYUN/Abp/DataProtectionManagement/AbpDataProtectionManagementDomainModule.cs +++ b/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Domain/LINGYUN/Abp/DataProtectionManagement/AbpDataProtectionManagementDomainModule.cs @@ -1,6 +1,8 @@ using LINGYUN.Abp.DataProtection; +using Microsoft.Extensions.Caching.Distributed; using Microsoft.Extensions.DependencyInjection; using Volo.Abp.AutoMapper; +using Volo.Abp.Caching; using Volo.Abp.Domain; using Volo.Abp.Domain.Entities.Events.Distributed; using Volo.Abp.Modularity; @@ -35,6 +37,11 @@ public class AbpDataProtectionManagementDomainModule : AbpModule options.AutoEventSelectors.Add(); }); + Configure(options => + { + options.ConfigureCache(new DistributedCacheEntryOptions()); + }); + context.Services.AddHostedService(); } } diff --git a/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Domain/LINGYUN/Abp/DataProtectionManagement/ProtectedEntitiesSaver.cs b/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Domain/LINGYUN/Abp/DataProtectionManagement/ProtectedEntitiesSaver.cs index b905f4b16..a95b4825c 100644 --- a/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Domain/LINGYUN/Abp/DataProtectionManagement/ProtectedEntitiesSaver.cs +++ b/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Domain/LINGYUN/Abp/DataProtectionManagement/ProtectedEntitiesSaver.cs @@ -67,7 +67,7 @@ public class ProtectedEntitiesSaver : IProtectedEntitiesSaver, ITransientDepende var newRecords = new List(); var changeRecords = new List(); - var entityTypeList = await EntityTypeInfoRepository.GetListAsync(); + var entityTypeList = await EntityTypeInfoRepository.GetListAsync(includeDetails: true); foreach (var protectedEntityMap in ManagementOptions.ProtectedEntities) { var resourceType = protectedEntityMap.Key; diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application.Contracts/FodyWeavers.xml b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application.Contracts/FodyWeavers.xml new file mode 100644 index 000000000..00e1d9a1c --- /dev/null +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application.Contracts/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application.Contracts/FodyWeavers.xsd b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application.Contracts/FodyWeavers.xsd new file mode 100644 index 000000000..3f3946e28 --- /dev/null +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application.Contracts/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application.Contracts/LINGYUN.Abp.Demo.Application.Contracts.csproj b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application.Contracts/LINGYUN.Abp.Demo.Application.Contracts.csproj new file mode 100644 index 000000000..743dfccd6 --- /dev/null +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application.Contracts/LINGYUN.Abp.Demo.Application.Contracts.csproj @@ -0,0 +1,27 @@ + + + + + + + netstandard2.0 + false + false + false + false + false + enable + + + + + + + + + + + + + + diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application.Contracts/LINGYUN/Abp/Demo/AbpDemoApplicationContractsModule.cs b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application.Contracts/LINGYUN/Abp/Demo/AbpDemoApplicationContractsModule.cs new file mode 100644 index 000000000..75a530f1d --- /dev/null +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application.Contracts/LINGYUN/Abp/Demo/AbpDemoApplicationContractsModule.cs @@ -0,0 +1,15 @@ +using LINGYUN.Abp.Exporter; +using Volo.Abp.Application; +using Volo.Abp.Authorization; +using Volo.Abp.Modularity; + +namespace LINGYUN.Abp.Demo; + +[DependsOn( + typeof(AbpExporterApplicationContractsModule), + typeof(AbpAuthorizationAbstractionsModule), + typeof(AbpDddApplicationContractsModule), + typeof(AbpDemoDomainSharedModule))] +public class AbpDemoApplicationContractsModule : AbpModule +{ +} diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application.Contracts/LINGYUN/Abp/Demo/Authors/AuthorDto.cs b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application.Contracts/LINGYUN/Abp/Demo/Authors/AuthorDto.cs new file mode 100644 index 000000000..c318f71a4 --- /dev/null +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application.Contracts/LINGYUN/Abp/Demo/Authors/AuthorDto.cs @@ -0,0 +1,12 @@ +using System; +using Volo.Abp.Application.Dtos; + +namespace LINGYUN.Abp.Demo.Authors; +public class AuthorDto : EntityDto +{ + public string Name { get; set; } + + public DateTime BirthDate { get; set; } + + public string? ShortBio { get; set; } +} diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application.Contracts/LINGYUN/Abp/Demo/Authors/CreateAuthorDto.cs b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application.Contracts/LINGYUN/Abp/Demo/Authors/CreateAuthorDto.cs new file mode 100644 index 000000000..549b11ea4 --- /dev/null +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application.Contracts/LINGYUN/Abp/Demo/Authors/CreateAuthorDto.cs @@ -0,0 +1,15 @@ +using System; +using System.ComponentModel.DataAnnotations; + +namespace LINGYUN.Abp.Demo.Authors; +public class CreateAuthorDto +{ + [Required] + [StringLength(AuthorConsts.MaxNameLength)] + public string Name { get; set; } + + [Required] + public DateTime BirthDate { get; set; } + + public string? ShortBio { get; set; } +} diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application.Contracts/LINGYUN/Abp/Demo/Authors/GetAuthorListDto.cs b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application.Contracts/LINGYUN/Abp/Demo/Authors/GetAuthorListDto.cs new file mode 100644 index 000000000..81e706586 --- /dev/null +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application.Contracts/LINGYUN/Abp/Demo/Authors/GetAuthorListDto.cs @@ -0,0 +1,7 @@ +using Volo.Abp.Application.Dtos; + +namespace LINGYUN.Abp.Demo.Authors; +public class GetAuthorListDto : PagedAndSortedResultRequestDto +{ + public string? Filter { get; set; } +} \ No newline at end of file diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application.Contracts/LINGYUN/Abp/Demo/Authors/IAuthorAppService.cs b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application.Contracts/LINGYUN/Abp/Demo/Authors/IAuthorAppService.cs new file mode 100644 index 000000000..558f56ac1 --- /dev/null +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application.Contracts/LINGYUN/Abp/Demo/Authors/IAuthorAppService.cs @@ -0,0 +1,18 @@ +using System; +using System.Threading.Tasks; +using Volo.Abp.Application.Dtos; +using Volo.Abp.Application.Services; + +namespace LINGYUN.Abp.Demo.Authors; +public interface IAuthorAppService : IApplicationService +{ + Task GetAsync(Guid id); + + Task> GetListAsync(GetAuthorListDto input); + + Task CreateAsync(CreateAuthorDto input); + + Task UpdateAsync(Guid id, UpdateAuthorDto input); + + Task DeleteAsync(Guid id); +} diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application.Contracts/LINGYUN/Abp/Demo/Authors/UpdateAuthorDto.cs b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application.Contracts/LINGYUN/Abp/Demo/Authors/UpdateAuthorDto.cs new file mode 100644 index 000000000..cddbbae6a --- /dev/null +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application.Contracts/LINGYUN/Abp/Demo/Authors/UpdateAuthorDto.cs @@ -0,0 +1,15 @@ +using System; +using System.ComponentModel.DataAnnotations; + +namespace LINGYUN.Abp.Demo.Authors; +public class UpdateAuthorDto +{ + [Required] + [StringLength(AuthorConsts.MaxNameLength)] + public string Name { get; set; } + + [Required] + public DateTime BirthDate { get; set; } + + public string ShortBio { get; set; } +} diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application.Contracts/LINGYUN/Abp/Demo/Books/AuthorLookupDto.cs b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application.Contracts/LINGYUN/Abp/Demo/Books/AuthorLookupDto.cs new file mode 100644 index 000000000..b469e6549 --- /dev/null +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application.Contracts/LINGYUN/Abp/Demo/Books/AuthorLookupDto.cs @@ -0,0 +1,8 @@ +using System; +using Volo.Abp.Application.Dtos; + +namespace LINGYUN.Abp.Demo.Books; +public class AuthorLookupDto : EntityDto +{ + public string Name { get; set; } +} \ No newline at end of file diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application.Contracts/LINGYUN/Abp/Demo/Books/BookDto.cs b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application.Contracts/LINGYUN/Abp/Demo/Books/BookDto.cs new file mode 100644 index 000000000..0f4c8f487 --- /dev/null +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application.Contracts/LINGYUN/Abp/Demo/Books/BookDto.cs @@ -0,0 +1,24 @@ +using System; +using System.ComponentModel; +using Volo.Abp.Application.Dtos; + +namespace LINGYUN.Abp.Demo.Books; +public class BookDto : AuditedEntityDto +{ + [DisplayName("名称")] + public string Name { get; set; } + + [DisplayName("类型")] + public BookType Type { get; set; } + + [DisplayName("出版日期")] + public DateTime PublishDate { get; set; } + + [DisplayName("价格")] + public float Price { get; set; } + + public Guid AuthorId { get; set; } + + [DisplayName("作者")] + public string AuthorName { get; set; } +} diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application.Contracts/LINGYUN/Abp/Demo/Books/BookExportListInput.cs b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application.Contracts/LINGYUN/Abp/Demo/Books/BookExportListInput.cs new file mode 100644 index 000000000..e8f4de8b2 --- /dev/null +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application.Contracts/LINGYUN/Abp/Demo/Books/BookExportListInput.cs @@ -0,0 +1,11 @@ +using System.ComponentModel.DataAnnotations; +using Volo.Abp.Application.Dtos; + +namespace LINGYUN.Abp.Demo.Books; +public class BookExportListInput : LimitedResultRequestDto, ISortedResultRequest +{ + [Required] + public string FileName { get; set; } + public string? Filterr { get; set; } + public string? Sorting { get; set; } +} diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application.Contracts/LINGYUN/Abp/Demo/Books/BookImportDto.cs b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application.Contracts/LINGYUN/Abp/Demo/Books/BookImportDto.cs new file mode 100644 index 000000000..230429b0b --- /dev/null +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application.Contracts/LINGYUN/Abp/Demo/Books/BookImportDto.cs @@ -0,0 +1,30 @@ +using System; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; + +namespace LINGYUN.Abp.Demo.Books; +public class BookImportDto +{ + [Required] + [StringLength(128)] + [DisplayName("名称")] + public string Name { get; set; } + + [Required] + [DisplayName("类型")] + public BookType Type { get; set; } = BookType.Undefined; + + [Required] + [DataType(DataType.Date)] + [DisplayName("出版日期")] + public DateTime PublishDate { get; set; } = DateTime.Now; + + [Required] + [DisplayName("价格")] + public float Price { get; set; } + + public Guid AuthorId { get; set; } + + [DisplayName("作者")] + public string AuthorName { get; set; } +} diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application.Contracts/LINGYUN/Abp/Demo/Books/BookImportInput.cs b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application.Contracts/LINGYUN/Abp/Demo/Books/BookImportInput.cs new file mode 100644 index 000000000..74d1a9e31 --- /dev/null +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application.Contracts/LINGYUN/Abp/Demo/Books/BookImportInput.cs @@ -0,0 +1,9 @@ +using System.ComponentModel.DataAnnotations; +using Volo.Abp.Content; + +namespace LINGYUN.Abp.Demo.Books; +public class BookImportInput +{ + [Required] + public IRemoteStreamContent Content { get; set; } +} diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application.Contracts/LINGYUN/Abp/Demo/Books/CreateUpdateBookDto.cs b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application.Contracts/LINGYUN/Abp/Demo/Books/CreateUpdateBookDto.cs new file mode 100644 index 000000000..3fc3a3509 --- /dev/null +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application.Contracts/LINGYUN/Abp/Demo/Books/CreateUpdateBookDto.cs @@ -0,0 +1,22 @@ +using System; +using System.ComponentModel.DataAnnotations; + +namespace LINGYUN.Abp.Demo.Books; +public class CreateUpdateBookDto +{ + [Required] + [StringLength(128)] + public string Name { get; set; } + + [Required] + public BookType Type { get; set; } = BookType.Undefined; + + [Required] + [DataType(DataType.Date)] + public DateTime PublishDate { get; set; } = DateTime.Now; + + [Required] + public float Price { get; set; } + + public Guid AuthorId { get; set; } +} \ No newline at end of file diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application.Contracts/LINGYUN/Abp/Demo/Books/IBookAppService.cs b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application.Contracts/LINGYUN/Abp/Demo/Books/IBookAppService.cs new file mode 100644 index 000000000..044ac4aae --- /dev/null +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application.Contracts/LINGYUN/Abp/Demo/Books/IBookAppService.cs @@ -0,0 +1,18 @@ +using LINGYUN.Abp.Exporter; +using System; +using System.Threading.Tasks; +using Volo.Abp.Application.Dtos; +using Volo.Abp.Application.Services; + +namespace LINGYUN.Abp.Demo.Books; +public interface IBookAppService : + ICrudAppService< //Defines CRUD methods + BookDto, //Used to show books + Guid, //Primary key of the book entity + PagedAndSortedResultRequestDto, //Used for paging/sorting + CreateUpdateBookDto>, //Used to create/update a book + IExporterAppService, + IImporterAppService +{ + Task> GetAuthorLookupAsync(); +} \ No newline at end of file diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application.Contracts/LINGYUN/Abp/Demo/DemoRemoteServiceConsts.cs b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application.Contracts/LINGYUN/Abp/Demo/DemoRemoteServiceConsts.cs new file mode 100644 index 000000000..101d5e756 --- /dev/null +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application.Contracts/LINGYUN/Abp/Demo/DemoRemoteServiceConsts.cs @@ -0,0 +1,6 @@ +namespace LINGYUN.Abp.Demo; +public static class DemoRemoteServiceConsts +{ + public const string RemoteServiceName = "Demo"; + public const string ModuleName = "demo"; +} diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application.Contracts/LINGYUN/Abp/Demo/Permissions/DemoPermissionDefinitionProvider.cs b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application.Contracts/LINGYUN/Abp/Demo/Permissions/DemoPermissionDefinitionProvider.cs new file mode 100644 index 000000000..7a773375c --- /dev/null +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application.Contracts/LINGYUN/Abp/Demo/Permissions/DemoPermissionDefinitionProvider.cs @@ -0,0 +1,34 @@ +using LINGYUN.Abp.Demo.Localization; +using Volo.Abp.Authorization.Permissions; +using Volo.Abp.Localization; + +namespace LINGYUN.Abp.Demo.Permissions; +public class DemoPermissionDefinitionProvider : PermissionDefinitionProvider +{ + public override void Define(IPermissionDefinitionContext context) + { + var demoGroup = context.AddGroup(DemoPermissions.GroupName, L("Permission:Demo")); + + var booksPermission = demoGroup.AddPermission(DemoPermissions.Books.Default, L("Permission:Books")); + booksPermission.AddChild(DemoPermissions.Books.Create, L("Permission:Books.Create")); + booksPermission.AddChild(DemoPermissions.Books.Edit, L("Permission:Books.Edit")); + booksPermission.AddChild(DemoPermissions.Books.Delete, L("Permission:Books.Delete")); + booksPermission.AddChild(DemoPermissions.Books.Export, L("Permission:Books.Export")); + booksPermission.AddChild(DemoPermissions.Books.Import, L("Permission:Books.Import")); + + var authorsPermission = demoGroup.AddPermission( + DemoPermissions.Authors.Default, L("Permission:Authors")); + authorsPermission.AddChild( + DemoPermissions.Authors.Create, L("Permission:Authors.Create")); + authorsPermission.AddChild( + DemoPermissions.Authors.Edit, L("Permission:Authors.Edit")); + authorsPermission.AddChild( + DemoPermissions.Authors.Delete, L("Permission:Authors.Delete")); + + } + + private static LocalizableString L(string name) + { + return LocalizableString.Create(name); + } +} diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application.Contracts/LINGYUN/Abp/Demo/Permissions/DemoPermissions.cs b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application.Contracts/LINGYUN/Abp/Demo/Permissions/DemoPermissions.cs new file mode 100644 index 000000000..1062f8173 --- /dev/null +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application.Contracts/LINGYUN/Abp/Demo/Permissions/DemoPermissions.cs @@ -0,0 +1,25 @@ +namespace LINGYUN.Abp.Demo.Permissions; +public static class DemoPermissions +{ + public const string GroupName = "Demo"; + + public static class Books + { + public const string Default = GroupName + ".Books"; + public const string Create = Default + ".Create"; + public const string Edit = Default + ".Edit"; + public const string Delete = Default + ".Delete"; + + public const string Export = Default + ".Export"; + public const string Import = Default + ".Import"; + } + + // *** ADDED a NEW NESTED CLASS *** + public static class Authors + { + public const string Default = GroupName + ".Authors"; + public const string Create = Default + ".Create"; + public const string Edit = Default + ".Edit"; + public const string Delete = Default + ".Delete"; + } +} diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application/FodyWeavers.xml b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application/FodyWeavers.xml new file mode 100644 index 000000000..00e1d9a1c --- /dev/null +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application/FodyWeavers.xsd b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application/FodyWeavers.xsd new file mode 100644 index 000000000..3f3946e28 --- /dev/null +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application/LINGYUN.Abp.Demo.Application.csproj b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application/LINGYUN.Abp.Demo.Application.csproj new file mode 100644 index 000000000..b08af849b --- /dev/null +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application/LINGYUN.Abp.Demo.Application.csproj @@ -0,0 +1,28 @@ + + + + + + + net8.0 + enable + enable + false + false + false + false + false + + + + + + + + + + + + + + diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application/LINGYUN/Abp/Demo/AbpDemoApplicationModule.cs b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application/LINGYUN/Abp/Demo/AbpDemoApplicationModule.cs new file mode 100644 index 000000000..166a3e98e --- /dev/null +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application/LINGYUN/Abp/Demo/AbpDemoApplicationModule.cs @@ -0,0 +1,25 @@ +using LINGYUN.Abp.Exporter; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.Application; +using Volo.Abp.AutoMapper; +using Volo.Abp.Modularity; + +namespace LINGYUN.Abp.Demo; + +[DependsOn( + typeof(AbpDddApplicationModule), + typeof(AbpDemoDomainModule), + typeof(AbpExporterApplicationModule), + typeof(AbpDemoApplicationContractsModule))] +public class AbpDemoApplicationModule : AbpModule +{ + public override void ConfigureServices(ServiceConfigurationContext context) + { + context.Services.AddAutoMapperObjectMapper(); + + Configure(options => + { + options.AddProfile(validate: true); + }); + } +} diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application/LINGYUN/Abp/Demo/Authors/AuthorAppService.cs b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application/LINGYUN/Abp/Demo/Authors/AuthorAppService.cs new file mode 100644 index 000000000..18d31b3d2 --- /dev/null +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application/LINGYUN/Abp/Demo/Authors/AuthorAppService.cs @@ -0,0 +1,89 @@ +using LINGYUN.Abp.Demo.Permissions; +using Microsoft.AspNetCore.Authorization; +using Volo.Abp.Application.Dtos; +using Volo.Abp.Domain.Repositories; + +namespace LINGYUN.Abp.Demo.Authors; + +[Authorize(DemoPermissions.Authors.Default)] +public class AuthorAppService : DemoApplicationServiceBase, IAuthorAppService +{ + private readonly IAuthorRepository _authorRepository; + private readonly AuthorManager _authorManager; + + public AuthorAppService( + IAuthorRepository authorRepository, + AuthorManager authorManager) + { + _authorRepository = authorRepository; + _authorManager = authorManager; + } + + public async Task GetAsync(Guid id) + { + var author = await _authorRepository.GetAsync(id); + return ObjectMapper.Map(author); + } + + public async Task> GetListAsync(GetAuthorListDto input) + { + if (input.Sorting.IsNullOrWhiteSpace()) + { + input.Sorting = nameof(Author.Name); + } + + var authors = await _authorRepository.GetListAsync( + input.SkipCount, + input.MaxResultCount, + input.Sorting, + input.Filter + ); + + var totalCount = input.Filter == null + ? await _authorRepository.CountAsync() + : await _authorRepository.CountAsync( + author => author.Name.Contains(input.Filter)); + + return new PagedResultDto( + totalCount, + ObjectMapper.Map, List>(authors) + ); + } + + [Authorize(DemoPermissions.Authors.Create)] + public async Task CreateAsync(CreateAuthorDto input) + { + var author = await _authorManager.CreateAsync( + input.Name, + input.BirthDate, + input.ShortBio + ); + + await _authorRepository.InsertAsync(author); + + return ObjectMapper.Map(author); + } + + [Authorize(DemoPermissions.Authors.Edit)] + public async Task UpdateAsync(Guid id, UpdateAuthorDto input) + { + var author = await _authorRepository.GetAsync(id); + + if (author.Name != input.Name) + { + await _authorManager.ChangeNameAsync(author, input.Name); + } + + author.BirthDate = input.BirthDate; + author.ShortBio = input.ShortBio; + + await _authorRepository.UpdateAsync(author); + } + + [Authorize(DemoPermissions.Authors.Delete)] + public async Task DeleteAsync(Guid id) + { + await _authorRepository.DeleteAsync(id); + } + +} \ No newline at end of file diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application/LINGYUN/Abp/Demo/Books/BookAppService.cs b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application/LINGYUN/Abp/Demo/Books/BookAppService.cs new file mode 100644 index 000000000..079240790 --- /dev/null +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application/LINGYUN/Abp/Demo/Books/BookAppService.cs @@ -0,0 +1,206 @@ +using LINGYUN.Abp.Demo.Authors; +using LINGYUN.Abp.Demo.Permissions; +using LINGYUN.Abp.Exporter; +using Microsoft.AspNetCore.Authorization; +using System.Linq.Dynamic.Core; +using Volo.Abp.Application.Dtos; +using Volo.Abp.Application.Services; +using Volo.Abp.Content; +using Volo.Abp.Domain.Entities; + +namespace LINGYUN.Abp.Demo.Books; + +[Authorize(DemoPermissions.Books.Default)] +public class BookAppService : + CrudAppService< + Book, //The Book entity + BookDto, //Used to show books + Guid, //Primary key of the book entity + PagedAndSortedResultRequestDto, //Used for paging/sorting + CreateUpdateBookDto>, //Used to create/update a book + IBookAppService //implement the IBookAppService +{ + private readonly IAuthorRepository _authorRepository; + private readonly AuthorManager _authorManager; + + private readonly IExporterProvider _exporterProvider; + private readonly IImporterProvider _importerProvider; + + public BookAppService( + IExporterProvider exporterProvider, + IImporterProvider importerProvider, + IBookRepository bookRepository, + AuthorManager authorManager, + IAuthorRepository authorRepository) + : base(bookRepository) + { + _exporterProvider = exporterProvider; + _importerProvider = importerProvider; + _authorManager = authorManager; + _authorRepository = authorRepository; + GetPolicyName = DemoPermissions.Books.Default; + GetListPolicyName = DemoPermissions.Books.Default; + CreatePolicyName = DemoPermissions.Books.Create; + UpdatePolicyName = DemoPermissions.Books.Edit; + DeletePolicyName = DemoPermissions.Books.Delete; + } + + public async virtual Task ImportAsync(BookImportInput input) + { + await CheckCreatePolicyAsync(); + await CheckPolicyAsync(DemoPermissions.Books.Import); + + var stream = input.Content.GetStream(); + var createAuthors = new List(); + var existsAuthors = new List(); + var createManyDtos = await _importerProvider.ImportAsync(stream); + + foreach (var book in createManyDtos) + { + var author = existsAuthors.Find(x => x.Name == book.AuthorName) ?? + await _authorRepository.FindByNameAsync(book.AuthorName); + if (author == null) + { + author = await _authorManager.CreateAsync(book.AuthorName, Clock.Now); + createAuthors.Add(author); + } + if (!existsAuthors.Any(x => x.Name == author.Name)) + { + existsAuthors.Add(author); + } + book.AuthorId = author.Id; + } + + var createManyBooks = createManyDtos.Select(dto => + { + var book = ObjectMapper.Map(dto); + + TryToSetTenantId(book); + + return book; + }); + + if (createAuthors.Count > 0) + { + await _authorRepository.InsertManyAsync(createAuthors, autoSave: true); + } + + await Repository.InsertManyAsync(createManyBooks, autoSave: true); + } + + public async virtual Task ExportAsync(BookExportListInput input) + { + await CheckPolicyAsync(DemoPermissions.Books.Export); + + var bookSet = await Repository.GetQueryableAsync(); + var authorSet = await _authorRepository.GetQueryableAsync(); + + var query = from book in bookSet + join author in authorSet on book.AuthorId equals author.Id + select new { book, author }; + + query = query + .OrderBy(NormalizeSorting(input.Sorting)) + .Take(input.MaxResultCount); + + var queryResult = await AsyncExecuter.ToListAsync(query); + + var bookDtos = queryResult.Select(x => + { + var bookDto = ObjectMapper.Map(x.book); + bookDto.AuthorName = x.author.Name; + return bookDto; + }).ToList(); + + var stream = await _exporterProvider.ExportAsync(bookDtos); + + return new RemoteStreamContent(stream, input.FileName); + } + + public override async Task GetAsync(Guid id) + { + //Get the IQueryable from the repository + var queryable = await Repository.GetQueryableAsync(); + + //Prepare a query to join books and authors + var query = from book in queryable + join author in await _authorRepository.GetQueryableAsync() on book.AuthorId equals author.Id + where book.Id == id + select new { book, author }; + + //Execute the query and get the book with author + var queryResult = await AsyncExecuter.FirstOrDefaultAsync(query); + if (queryResult == null) + { + throw new EntityNotFoundException(typeof(Book), id); + } + + var bookDto = ObjectMapper.Map(queryResult.book); + bookDto.AuthorName = queryResult.author.Name; + return bookDto; + } + + public override async Task> GetListAsync(PagedAndSortedResultRequestDto input) + { + //Get the IQueryable from the repository + var queryable = await Repository.GetQueryableAsync(); + + //Prepare a query to join books and authors + var query = from book in queryable + join author in await _authorRepository.GetQueryableAsync() on book.AuthorId equals author.Id + select new { book, author }; + + //Paging + query = query + .OrderBy(NormalizeSorting(input.Sorting)) + .Skip(input.SkipCount) + .Take(input.MaxResultCount); + + //Execute the query and get a list + var queryResult = await AsyncExecuter.ToListAsync(query); + + //Convert the query result to a list of BookDto objects + var bookDtos = queryResult.Select(x => + { + var bookDto = ObjectMapper.Map(x.book); + bookDto.AuthorName = x.author.Name; + return bookDto; + }).ToList(); + + //Get the total count with another query + var totalCount = await Repository.GetCountAsync(); + + return new PagedResultDto( + totalCount, + bookDtos + ); + } + + public async Task> GetAuthorLookupAsync() + { + var authors = await _authorRepository.GetListAsync(); + + return new ListResultDto( + ObjectMapper.Map, List>(authors) + ); + } + + private static string NormalizeSorting(string? sorting) + { + if (sorting.IsNullOrEmpty()) + { + return $"book.{nameof(Book.Name)}"; + } + + if (sorting.Contains("authorName", StringComparison.OrdinalIgnoreCase)) + { + return sorting.Replace( + "authorName", + "author.Name", + StringComparison.OrdinalIgnoreCase + ); + } + + return $"book.{sorting}"; + } +} \ No newline at end of file diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application/LINGYUN/Abp/Demo/DemoApplicationMapperProfile.cs b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application/LINGYUN/Abp/Demo/DemoApplicationMapperProfile.cs new file mode 100644 index 000000000..e269a76df --- /dev/null +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application/LINGYUN/Abp/Demo/DemoApplicationMapperProfile.cs @@ -0,0 +1,26 @@ +using AutoMapper; +using LINGYUN.Abp.Demo.Authors; +using LINGYUN.Abp.Demo.Books; +using Volo.Abp.AutoMapper; + +namespace LINGYUN.Abp.Demo; +public class DemoApplicationMapperProfile : Profile +{ + public DemoApplicationMapperProfile() + { + CreateMap() + .Ignore(dto => dto.AuthorName); + CreateMap() + .IgnoreAuditedObjectProperties() + .Ignore(dto => dto.Id) + .Ignore(dto => dto.ExtraProperties) + .Ignore(dto => dto.ConcurrencyStamp); + CreateMap() + .IgnoreAuditedObjectProperties() + .Ignore(dto => dto.Id) + .Ignore(dto => dto.ExtraProperties) + .Ignore(dto => dto.ConcurrencyStamp); + CreateMap(); + CreateMap(); + } +} diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application/LINGYUN/Abp/Demo/DemoApplicationServiceBase.cs b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application/LINGYUN/Abp/Demo/DemoApplicationServiceBase.cs new file mode 100644 index 000000000..a51616716 --- /dev/null +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application/LINGYUN/Abp/Demo/DemoApplicationServiceBase.cs @@ -0,0 +1,11 @@ +using Volo.Abp.Application.Services; + +namespace LINGYUN.Abp.Demo; +public abstract class DemoApplicationServiceBase : ApplicationService +{ + protected DemoApplicationServiceBase() + { + LocalizationResource = typeof(AbpDemoApplicationModule); + ObjectMapperContext = typeof(AbpDemoApplicationModule); + } +} diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain.Shared/FodyWeavers.xml b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain.Shared/FodyWeavers.xml new file mode 100644 index 000000000..00e1d9a1c --- /dev/null +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain.Shared/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain.Shared/FodyWeavers.xsd b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain.Shared/FodyWeavers.xsd new file mode 100644 index 000000000..3f3946e28 --- /dev/null +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain.Shared/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain.Shared/LINGYUN.Abp.Demo.Domain.Shared.csproj b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain.Shared/LINGYUN.Abp.Demo.Domain.Shared.csproj new file mode 100644 index 000000000..c039fd00c --- /dev/null +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain.Shared/LINGYUN.Abp.Demo.Domain.Shared.csproj @@ -0,0 +1,30 @@ + + + + + + + netstandard2.0 + false + false + false + false + false + + + + + + + + + + + + + + + + + + diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain.Shared/LINGYUN/Abp/Demo/AbpDemoDomainSharedModule.cs b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain.Shared/LINGYUN/Abp/Demo/AbpDemoDomainSharedModule.cs new file mode 100644 index 000000000..b8871c88d --- /dev/null +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain.Shared/LINGYUN/Abp/Demo/AbpDemoDomainSharedModule.cs @@ -0,0 +1,31 @@ +using LINGYUN.Abp.Demo.Localization; +using Volo.Abp.Domain; +using Volo.Abp.Localization; +using Volo.Abp.Localization.ExceptionHandling; +using Volo.Abp.Modularity; +using Volo.Abp.VirtualFileSystem; + +namespace LINGYUN.Abp.Demo; + +[DependsOn(typeof(AbpDddDomainSharedModule))] +public class AbpDemoDomainSharedModule : AbpModule +{ + public override void ConfigureServices(ServiceConfigurationContext context) + { + Configure(options => + { + options.FileSets.AddEmbedded(); + }); + + Configure(options => + { + options.Resources + .Add("en") + .AddVirtualJson("/LINGYUN/Abp/Demo/Localization/Resources"); + }); + Configure(options => + { + options.MapCodeNamespace(DemoErrorCodes.Namespace, typeof(DemoResource)); + }); + } +} diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain.Shared/LINGYUN/Abp/Demo/Authors/AuthorConsts.cs b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain.Shared/LINGYUN/Abp/Demo/Authors/AuthorConsts.cs new file mode 100644 index 000000000..23b067d5c --- /dev/null +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain.Shared/LINGYUN/Abp/Demo/Authors/AuthorConsts.cs @@ -0,0 +1,5 @@ +namespace LINGYUN.Abp.Demo.Authors; +public static class AuthorConsts +{ + public const int MaxNameLength = 64; +} diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain.Shared/LINGYUN/Abp/Demo/Books/BookType.cs b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain.Shared/LINGYUN/Abp/Demo/Books/BookType.cs new file mode 100644 index 000000000..f7e65ddfd --- /dev/null +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain.Shared/LINGYUN/Abp/Demo/Books/BookType.cs @@ -0,0 +1,13 @@ +namespace LINGYUN.Abp.Demo.Books; +public enum BookType +{ + Undefined, + Adventure, + Biography, + Dystopia, + Fantastic, + Horror, + Science, + ScienceFiction, + Poetry +} diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain.Shared/LINGYUN/Abp/Demo/DemoErrorCodes.cs b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain.Shared/LINGYUN/Abp/Demo/DemoErrorCodes.cs new file mode 100644 index 000000000..fa79beaa8 --- /dev/null +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain.Shared/LINGYUN/Abp/Demo/DemoErrorCodes.cs @@ -0,0 +1,14 @@ +namespace LINGYUN.Abp.Demo; +public static class DemoErrorCodes +{ + public const string Namespace = "Demo"; + + public static class Author + { + public const string Prefix = Namespace + ":00"; + /// + /// 作者 {Name} 已经存在! + /// + public const string AuthorAlreadyExists = Prefix + "001"; + } +} diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain.Shared/LINGYUN/Abp/Demo/Localization/DemoResource.cs b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain.Shared/LINGYUN/Abp/Demo/Localization/DemoResource.cs new file mode 100644 index 000000000..2cdc6b9fd --- /dev/null +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain.Shared/LINGYUN/Abp/Demo/Localization/DemoResource.cs @@ -0,0 +1,8 @@ +using Volo.Abp.Localization; + +namespace LINGYUN.Abp.Demo.Localization; + +[LocalizationResourceName("Demo")] +public class DemoResource +{ +} diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain.Shared/LINGYUN/Abp/Demo/Localization/Resources/en.json b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain.Shared/LINGYUN/Abp/Demo/Localization/Resources/en.json new file mode 100644 index 000000000..ed2f30b80 --- /dev/null +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain.Shared/LINGYUN/Abp/Demo/Localization/Resources/en.json @@ -0,0 +1,16 @@ +{ + "culture": "en", + "texts": { + "Permission:Books": "Books", + "Permission:Books.Create": "Create Books", + "Permission:Books.Edit": "Edit Books", + "Permission:Books.Delete": "Delete Books", + "Permission:Books.Export": "Export Books", + "Permission:Books.Import": "Import Books", + "Permission:Authors": "Authors", + "Permission:Authors.Create": "Create Authors", + "Permission:Authors.Edit": "Edit Authors", + "Permission:Authors.Delete": "Delete Authors", + "Demo:00001": "Author {Name} already exists!" + } +} \ No newline at end of file diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain.Shared/LINGYUN/Abp/Demo/Localization/Resources/zh-Hans.json b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain.Shared/LINGYUN/Abp/Demo/Localization/Resources/zh-Hans.json new file mode 100644 index 000000000..456fe6912 --- /dev/null +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain.Shared/LINGYUN/Abp/Demo/Localization/Resources/zh-Hans.json @@ -0,0 +1,16 @@ +{ + "culture": "zh-Hans", + "texts": { + "Permission:Books": "书籍管理", + "Permission:Books.Create": "新增书籍", + "Permission:Books.Edit": "编辑书籍", + "Permission:Books.Delete": "删除书籍", + "Permission:Books.Export": "导出书籍", + "Permission:Books.Import": "导入书籍", + "Permission:Authors": "作者管理", + "Permission:Authors.Create": "新增作者", + "Permission:Authors.Edit": "编辑作者", + "Permission:Authors.Delete": "删除作者", + "Demo:00001": "作者 {Name} 已经存在!" + } +} \ No newline at end of file diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain/FodyWeavers.xml b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain/FodyWeavers.xml new file mode 100644 index 000000000..00e1d9a1c --- /dev/null +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain/FodyWeavers.xsd b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain/FodyWeavers.xsd new file mode 100644 index 000000000..3f3946e28 --- /dev/null +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain/LINGYUN.Abp.Demo.Domain.csproj b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain/LINGYUN.Abp.Demo.Domain.csproj new file mode 100644 index 000000000..661f3ada3 --- /dev/null +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain/LINGYUN.Abp.Demo.Domain.csproj @@ -0,0 +1,28 @@ + + + + + + + net8.0 + enable + enable + false + false + false + false + false + + + + + + + + + + + + + + diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain/LINGYUN/Abp/Demo/AbpDemoDomainModule.cs b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain/LINGYUN/Abp/Demo/AbpDemoDomainModule.cs new file mode 100644 index 000000000..d62688561 --- /dev/null +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain/LINGYUN/Abp/Demo/AbpDemoDomainModule.cs @@ -0,0 +1,37 @@ +using LINGYUN.Abp.DataProtection; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.AutoMapper; +using Volo.Abp.Domain; +using Volo.Abp.Modularity; + +namespace LINGYUN.Abp.Demo; + +[DependsOn( + typeof(AbpAutoMapperModule), + typeof(AbpDddDomainModule), + typeof(AbpDataProtectionModule), + typeof(AbpDemoDomainSharedModule))] +public class AbpDemoDomainModule : AbpModule +{ + public override void ConfigureServices(ServiceConfigurationContext context) + { + context.Services.AddAutoMapperObjectMapper(); + + Configure(options => + { + options.AddProfile(validate: true); + }); + + //Configure(options => + //{ + // options.AddPersistenceResource(); + //}); + + // 分布式事件 + //Configure(options => + //{ + // options.AutoEventSelectors.Add(); + // options.EtoMappings.Add(); + //}); + } +} diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain/LINGYUN/Abp/Demo/Authors/Author.cs b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain/LINGYUN/Abp/Demo/Authors/Author.cs new file mode 100644 index 000000000..fdf137c2d --- /dev/null +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain/LINGYUN/Abp/Demo/Authors/Author.cs @@ -0,0 +1,43 @@ +using JetBrains.Annotations; +using Volo.Abp; +using Volo.Abp.Domain.Entities.Auditing; + +namespace LINGYUN.Abp.Demo.Authors; +public class Author : FullAuditedAggregateRoot +{ + public string Name { get; private set; } + public DateTime BirthDate { get; set; } + public string? ShortBio { get; set; } + + private Author() + { + /* This constructor is for deserialization / ORM purpose */ + } + + internal Author( + Guid id, + [NotNull] string name, + DateTime birthDate, + [CanBeNull] string? shortBio = null) + : base(id) + { + SetName(name); + BirthDate = birthDate; + ShortBio = shortBio; + } + + internal Author ChangeName([NotNull] string name) + { + SetName(name); + return this; + } + + private void SetName([NotNull] string name) + { + Name = Check.NotNullOrWhiteSpace( + name, + nameof(name), + maxLength: AuthorConsts.MaxNameLength + ); + } +} diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain/LINGYUN/Abp/Demo/Authors/AuthorAlreadyExistsException.cs b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain/LINGYUN/Abp/Demo/Authors/AuthorAlreadyExistsException.cs new file mode 100644 index 000000000..8b300529b --- /dev/null +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain/LINGYUN/Abp/Demo/Authors/AuthorAlreadyExistsException.cs @@ -0,0 +1,11 @@ +using Volo.Abp; + +namespace LINGYUN.Abp.Demo.Authors; +public class AuthorAlreadyExistsException : BusinessException +{ + public AuthorAlreadyExistsException(string name) + : base(DemoErrorCodes.Author.AuthorAlreadyExists) + { + WithData("Name", name); + } +} diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain/LINGYUN/Abp/Demo/Authors/AuthorManager.cs b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain/LINGYUN/Abp/Demo/Authors/AuthorManager.cs new file mode 100644 index 000000000..ec9925494 --- /dev/null +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain/LINGYUN/Abp/Demo/Authors/AuthorManager.cs @@ -0,0 +1,51 @@ +using JetBrains.Annotations; +using Volo.Abp; +using Volo.Abp.Domain.Services; + +namespace LINGYUN.Abp.Demo.Authors; +public class AuthorManager : DomainService +{ + private readonly IAuthorRepository _authorRepository; + + public AuthorManager(IAuthorRepository authorRepository) + { + _authorRepository = authorRepository; + } + + public async Task CreateAsync( + [NotNull] string name, + DateTime birthDate, + [CanBeNull] string? shortBio = null) + { + Check.NotNullOrWhiteSpace(name, nameof(name)); + + var existingAuthor = await _authorRepository.FindByNameAsync(name); + if (existingAuthor != null) + { + throw new AuthorAlreadyExistsException(name); + } + + return new Author( + GuidGenerator.Create(), + name, + birthDate, + shortBio + ); + } + + public async Task ChangeNameAsync( + [NotNull] Author author, + [NotNull] string newName) + { + Check.NotNull(author, nameof(author)); + Check.NotNullOrWhiteSpace(newName, nameof(newName)); + + var existingAuthor = await _authorRepository.FindByNameAsync(newName); + if (existingAuthor != null && existingAuthor.Id != author.Id) + { + throw new AuthorAlreadyExistsException(newName); + } + + author.ChangeName(newName); + } +} diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain/LINGYUN/Abp/Demo/Authors/IAuthorRepository.cs b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain/LINGYUN/Abp/Demo/Authors/IAuthorRepository.cs new file mode 100644 index 000000000..d674c46dd --- /dev/null +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain/LINGYUN/Abp/Demo/Authors/IAuthorRepository.cs @@ -0,0 +1,14 @@ +using Volo.Abp.Domain.Repositories; + +namespace LINGYUN.Abp.Demo.Authors; +public interface IAuthorRepository : IRepository +{ + Task FindByNameAsync(string name); + + Task> GetListAsync( + int skipCount, + int maxResultCount, + string sorting, + string? filter = null + ); +} diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain/LINGYUN/Abp/Demo/Books/Book.cs b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain/LINGYUN/Abp/Demo/Books/Book.cs new file mode 100644 index 000000000..20c3194fa --- /dev/null +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain/LINGYUN/Abp/Demo/Books/Book.cs @@ -0,0 +1,16 @@ +using LINGYUN.Abp.DataProtection; +using Volo.Abp.Domain.Entities.Auditing; + +namespace LINGYUN.Abp.Demo.Books; +public class Book : AuditedAggregateRoot, IDataProtected +{ + public string Name { get; set; } + + public BookType Type { get; set; } + + public DateTime PublishDate { get; set; } + + public float Price { get; set; } + + public Guid AuthorId { get; set; } +} diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain/LINGYUN/Abp/Demo/Books/IBookRepository.cs b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain/LINGYUN/Abp/Demo/Books/IBookRepository.cs new file mode 100644 index 000000000..7a32e5f69 --- /dev/null +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain/LINGYUN/Abp/Demo/Books/IBookRepository.cs @@ -0,0 +1,6 @@ +using Volo.Abp.Domain.Repositories; + +namespace LINGYUN.Abp.Demo.Books; +public interface IBookRepository : IRepository +{ +} diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain/LINGYUN/Abp/Demo/DemoDbProterties.cs b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain/LINGYUN/Abp/Demo/DemoDbProterties.cs new file mode 100644 index 000000000..abe5f4bf3 --- /dev/null +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain/LINGYUN/Abp/Demo/DemoDbProterties.cs @@ -0,0 +1,10 @@ +namespace LINGYUN.Abp.Demo; +public static class DemoDbProterties +{ + public static string DbTablePrefix { get; set; } = "Demo_"; + + public static string? DbSchema { get; set; } = null; + + + public const string ConnectionStringName = "Demo"; +} diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain/LINGYUN/Abp/Demo/DemoDomainMapperProfile.cs b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain/LINGYUN/Abp/Demo/DemoDomainMapperProfile.cs new file mode 100644 index 000000000..fc0624887 --- /dev/null +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain/LINGYUN/Abp/Demo/DemoDomainMapperProfile.cs @@ -0,0 +1,10 @@ +using AutoMapper; + +namespace LINGYUN.Abp.Demo; +public class DemoDomainMapperProfile : Profile +{ + public DemoDomainMapperProfile() + { + + } +} diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.EntityFrameworkCore/FodyWeavers.xml b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.EntityFrameworkCore/FodyWeavers.xml new file mode 100644 index 000000000..00e1d9a1c --- /dev/null +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.EntityFrameworkCore/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.EntityFrameworkCore/FodyWeavers.xsd b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.EntityFrameworkCore/FodyWeavers.xsd new file mode 100644 index 000000000..3f3946e28 --- /dev/null +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.EntityFrameworkCore/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.EntityFrameworkCore/LINGYUN.Abp.Demo.EntityFrameworkCore.csproj b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.EntityFrameworkCore/LINGYUN.Abp.Demo.EntityFrameworkCore.csproj new file mode 100644 index 000000000..e90a8cba6 --- /dev/null +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.EntityFrameworkCore/LINGYUN.Abp.Demo.EntityFrameworkCore.csproj @@ -0,0 +1,23 @@ + + + + + + + net8.0 + enable + enable + false + false + false + false + false + + + + + + + + + diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.EntityFrameworkCore/LINGYUN/Abp/Demo/Authors/EfCoreAuthorRepository.cs b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.EntityFrameworkCore/LINGYUN/Abp/Demo/Authors/EfCoreAuthorRepository.cs new file mode 100644 index 000000000..4336e8e67 --- /dev/null +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.EntityFrameworkCore/LINGYUN/Abp/Demo/Authors/EfCoreAuthorRepository.cs @@ -0,0 +1,41 @@ +using LINGYUN.Abp.Demo.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; +using System.Linq.Dynamic.Core; +using Volo.Abp.Domain.Repositories.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore; + +namespace LINGYUN.Abp.Demo.Authors; +public class EfCoreAuthorRepository + : EfCoreRepository, + IAuthorRepository +{ + public EfCoreAuthorRepository( + IDbContextProvider dbContextProvider) + : base(dbContextProvider) + { + } + + public async Task FindByNameAsync(string name) + { + var dbSet = await GetDbSetAsync(); + return await dbSet.FirstOrDefaultAsync(author => author.Name == name); + } + + public async Task> GetListAsync( + int skipCount, + int maxResultCount, + string sorting, + string? filter = null) + { + var dbSet = await GetDbSetAsync(); + return await dbSet + .WhereIf( + !filter.IsNullOrWhiteSpace(), + author => author.Name.Contains(filter!) + ) + .OrderBy(sorting) + .Skip(skipCount) + .Take(maxResultCount) + .ToListAsync(); + } +} diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.EntityFrameworkCore/LINGYUN/Abp/Demo/Books/EfCoreBookRepository.cs b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.EntityFrameworkCore/LINGYUN/Abp/Demo/Books/EfCoreBookRepository.cs new file mode 100644 index 000000000..17a889a94 --- /dev/null +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.EntityFrameworkCore/LINGYUN/Abp/Demo/Books/EfCoreBookRepository.cs @@ -0,0 +1,17 @@ +using JetBrains.Annotations; +using LINGYUN.Abp.DataProtection; +using LINGYUN.Abp.DataProtection.EntityFrameworkCore; +using LINGYUN.Abp.Demo.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore; + +namespace LINGYUN.Abp.Demo.Books; +public class EfCoreBookRepository : EfCoreDataProtectionRepository, IBookRepository +{ + public EfCoreBookRepository( + [NotNull] IDbContextProvider dbContextProvider, + [NotNull] IDataAuthorizationService dataAuthorizationService, + [NotNull] IEntityTypeFilterBuilder entityTypeFilterBuilder) + : base(dbContextProvider, dataAuthorizationService, entityTypeFilterBuilder) + { + } +} diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.EntityFrameworkCore/LINGYUN/Abp/Demo/EntityFrameworkCore/AbpDemoEntityFrameworkCoreModule.cs b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.EntityFrameworkCore/LINGYUN/Abp/Demo/EntityFrameworkCore/AbpDemoEntityFrameworkCoreModule.cs new file mode 100644 index 000000000..74896658e --- /dev/null +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.EntityFrameworkCore/LINGYUN/Abp/Demo/EntityFrameworkCore/AbpDemoEntityFrameworkCoreModule.cs @@ -0,0 +1,25 @@ +using LINGYUN.Abp.DataProtection.EntityFrameworkCore; +using LINGYUN.Abp.Demo.Authors; +using LINGYUN.Abp.Demo.Books; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.Modularity; + +namespace LINGYUN.Abp.Demo.EntityFrameworkCore; + +[DependsOn( + typeof(AbpDemoDomainModule), + typeof(AbpDataProtectionEntityFrameworkCoreModule))] +public class AbpDemoEntityFrameworkCoreModule : AbpModule +{ + public override void ConfigureServices(ServiceConfigurationContext context) + { + context.Services.AddAbpDbContext(options => + { + // + options.AddRepository(); + options.AddRepository(); + + options.AddDefaultRepositories(); + }); + } +} diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.EntityFrameworkCore/LINGYUN/Abp/Demo/EntityFrameworkCore/DemoDbContext.cs b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.EntityFrameworkCore/LINGYUN/Abp/Demo/EntityFrameworkCore/DemoDbContext.cs new file mode 100644 index 000000000..874d1dc9b --- /dev/null +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.EntityFrameworkCore/LINGYUN/Abp/Demo/EntityFrameworkCore/DemoDbContext.cs @@ -0,0 +1,24 @@ +using LINGYUN.Abp.DataProtection.EntityFrameworkCore; +using LINGYUN.Abp.Demo.Authors; +using LINGYUN.Abp.Demo.Books; +using Microsoft.EntityFrameworkCore; + +namespace LINGYUN.Abp.Demo.EntityFrameworkCore; +public class DemoDbContext : AbpDataProtectionDbContext +{ + public DbSet Books { get; set; } + + public DbSet Authors { get; set; } + + + public DemoDbContext(DbContextOptions options) : base(options) + { + } + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + base.OnModelCreating(modelBuilder); + + modelBuilder.ConfigureDemo(); ; + } +} diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.EntityFrameworkCore/LINGYUN/Abp/Demo/EntityFrameworkCore/DemoDbContextModelCreatingExtensions.cs b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.EntityFrameworkCore/LINGYUN/Abp/Demo/EntityFrameworkCore/DemoDbContextModelCreatingExtensions.cs new file mode 100644 index 000000000..017c0dc2f --- /dev/null +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.EntityFrameworkCore/LINGYUN/Abp/Demo/EntityFrameworkCore/DemoDbContextModelCreatingExtensions.cs @@ -0,0 +1,45 @@ +using LINGYUN.Abp.Demo.Authors; +using LINGYUN.Abp.Demo.Books; +using Microsoft.EntityFrameworkCore; +using Volo.Abp; +using Volo.Abp.EntityFrameworkCore.Modeling; + +namespace LINGYUN.Abp.Demo.EntityFrameworkCore; +public static class DemoDbContextModelCreatingExtensions +{ + public static void ConfigureDemo( + this ModelBuilder builder, + Action? optionsAction = null) + { + Check.NotNull(builder, nameof(builder)); + + var options = new DemoModelBuilderConfigurationOptions( + DemoDbProterties.DbTablePrefix, + DemoDbProterties.DbSchema + ); + optionsAction?.Invoke(options); + + builder.Entity(b => + { + b.ToTable(options.TablePrefix + "Books", options.Schema); + b.ConfigureByConvention(); //auto configure for the base class props + b.Property(x => x.Name).IsRequired().HasMaxLength(128); + + // ADD THE MAPPING FOR THE RELATION + b.HasOne().WithMany().HasForeignKey(x => x.AuthorId).IsRequired(); + }); + + builder.Entity(b => + { + b.ToTable(options.TablePrefix + "Authors", options.Schema); + + b.ConfigureByConvention(); + + b.Property(x => x.Name) + .IsRequired() + .HasMaxLength(AuthorConsts.MaxNameLength); + + b.HasIndex(x => x.Name); + }); + } +} diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.EntityFrameworkCore/LINGYUN/Abp/Demo/EntityFrameworkCore/DemoModelBuilderConfigurationOptions.cs b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.EntityFrameworkCore/LINGYUN/Abp/Demo/EntityFrameworkCore/DemoModelBuilderConfigurationOptions.cs new file mode 100644 index 000000000..174cad13c --- /dev/null +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.EntityFrameworkCore/LINGYUN/Abp/Demo/EntityFrameworkCore/DemoModelBuilderConfigurationOptions.cs @@ -0,0 +1,16 @@ +using JetBrains.Annotations; +using Volo.Abp.EntityFrameworkCore.Modeling; + +namespace LINGYUN.Abp.Demo.EntityFrameworkCore; +public class DemoModelBuilderConfigurationOptions : AbpModelBuilderConfigurationOptions +{ + public DemoModelBuilderConfigurationOptions( + [NotNull] string tablePrefix = "", + [CanBeNull] string? schema = null) + : base( + tablePrefix, + schema) + { + + } +} diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.HttpApi/FodyWeavers.xml b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.HttpApi/FodyWeavers.xml new file mode 100644 index 000000000..00e1d9a1c --- /dev/null +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.HttpApi/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.HttpApi/FodyWeavers.xsd b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.HttpApi/FodyWeavers.xsd new file mode 100644 index 000000000..3f3946e28 --- /dev/null +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.HttpApi/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.HttpApi/LINGYUN.Abp.Demo.HttpApi.csproj b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.HttpApi/LINGYUN.Abp.Demo.HttpApi.csproj new file mode 100644 index 000000000..48ba4cb68 --- /dev/null +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.HttpApi/LINGYUN.Abp.Demo.HttpApi.csproj @@ -0,0 +1,26 @@ + + + + + + + net8.0 + enable + enable + false + false + false + false + false + + + + + + + + + + + + diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.HttpApi/LINGYUN/Abp/Demo/AbpDemoHttpApiModule.cs b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.HttpApi/LINGYUN/Abp/Demo/AbpDemoHttpApiModule.cs new file mode 100644 index 000000000..8d652d25f --- /dev/null +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.HttpApi/LINGYUN/Abp/Demo/AbpDemoHttpApiModule.cs @@ -0,0 +1,28 @@ +using LINGYUN.Abp.Demo.Localization; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.AspNetCore.Mvc; +using Volo.Abp.AspNetCore.Mvc.Localization; +using Volo.Abp.Modularity; + +namespace LINGYUN.Abp.Demo; + +[DependsOn( + typeof(AbpAspNetCoreMvcModule), + typeof(AbpDemoApplicationContractsModule))] +public class AbpDemoHttpApiModule : AbpModule +{ + public override void PreConfigureServices(ServiceConfigurationContext context) + { + PreConfigure(mvcBuilder => + { + mvcBuilder.AddApplicationPartIfNotExists(typeof(AbpDemoHttpApiModule).Assembly); + }); + + PreConfigure(options => + { + options.AddAssemblyResource( + typeof(DemoResource), + typeof(AbpDemoApplicationContractsModule).Assembly); + }); + } +} diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.HttpApi/LINGYUN/Abp/Demo/Authors/AuthorController.cs b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.HttpApi/LINGYUN/Abp/Demo/Authors/AuthorController.cs new file mode 100644 index 000000000..27ade7692 --- /dev/null +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.HttpApi/LINGYUN/Abp/Demo/Authors/AuthorController.cs @@ -0,0 +1,58 @@ +using LINGYUN.Abp.Demo.Permissions; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using Volo.Abp; +using Volo.Abp.Application.Dtos; +using Volo.Abp.AspNetCore.Mvc; + +namespace LINGYUN.Abp.Demo.Authors; + +[Controller] +[Authorize(DemoPermissions.Authors.Default)] +[RemoteService(Name = DemoRemoteServiceConsts.RemoteServiceName)] +[Area(DemoRemoteServiceConsts.ModuleName)] +[Route($"api/{DemoRemoteServiceConsts.ModuleName}/authors")] +public class AuthorController : AbpControllerBase, IAuthorAppService +{ + private readonly IAuthorAppService _service; + public AuthorController(IAuthorAppService service) + { + _service = service; + } + + [HttpPost] + [Authorize(DemoPermissions.Authors.Create)] + public virtual Task CreateAsync(CreateAuthorDto input) + { + return _service.CreateAsync(input); + } + + [HttpDelete] + [Route("{id}")] + [Authorize(DemoPermissions.Authors.Delete)] + public virtual Task DeleteAsync(Guid id) + { + return _service.DeleteAsync(id); + } + + [HttpGet] + [Route("{id}")] + public virtual Task GetAsync(Guid id) + { + return _service.GetAsync(id); + } + + [HttpGet] + public virtual Task> GetListAsync(GetAuthorListDto input) + { + return _service.GetListAsync(input); + } + + [HttpPut] + [Route("{id}")] + [Authorize(DemoPermissions.Authors.Edit)] + public virtual Task UpdateAsync(Guid id, UpdateAuthorDto input) + { + return _service.UpdateAsync(id, input); + } +} diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.HttpApi/LINGYUN/Abp/Demo/Books/BookController.cs b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.HttpApi/LINGYUN/Abp/Demo/Books/BookController.cs new file mode 100644 index 000000000..839d1ac0f --- /dev/null +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.HttpApi/LINGYUN/Abp/Demo/Books/BookController.cs @@ -0,0 +1,81 @@ +using LINGYUN.Abp.Demo.Permissions; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using Volo.Abp; +using Volo.Abp.Application.Dtos; +using Volo.Abp.AspNetCore.Mvc; +using Volo.Abp.Content; + +namespace LINGYUN.Abp.Demo.Books; + +[Controller] +[Authorize(DemoPermissions.Books.Default)] +[RemoteService(Name = DemoRemoteServiceConsts.RemoteServiceName)] +[Area(DemoRemoteServiceConsts.ModuleName)] +[Route($"api/{DemoRemoteServiceConsts.ModuleName}/books")] +public class BookController : AbpControllerBase, IBookAppService +{ + private readonly IBookAppService _service; + + public BookController(IBookAppService service) + { + _service = service; + } + + [HttpPost] + [Authorize(DemoPermissions.Books.Create)] + public virtual Task CreateAsync(CreateUpdateBookDto input) + { + return _service.CreateAsync(input); + } + + [HttpDelete] + [Route("{id}")] + [Authorize(DemoPermissions.Books.Delete)] + public virtual Task DeleteAsync(Guid id) + { + return _service.DeleteAsync(id); + } + + [HttpPost] + [Route("import")] + public virtual Task ImportAsync([FromForm] BookImportInput input) + { + return _service.ImportAsync(input); + } + + [HttpGet] + [Route("export")] + public virtual Task ExportAsync(BookExportListInput input) + { + return _service.ExportAsync(input); + } + + [HttpGet] + [Route("{id}")] + public virtual Task GetAsync(Guid id) + { + return _service.GetAsync(id); + } + + [HttpGet] + [Route("lookup")] + public virtual Task> GetAuthorLookupAsync() + { + return _service.GetAuthorLookupAsync(); + } + + [HttpGet] + public virtual Task> GetListAsync(PagedAndSortedResultRequestDto input) + { + return _service.GetListAsync(input); + } + + [HttpPut] + [Route("{id}")] + [Authorize(DemoPermissions.Books.Edit)] + public virtual Task UpdateAsync(Guid id, CreateUpdateBookDto input) + { + return _service.UpdateAsync(id, input); + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Packages/PackageAppService.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Packages/PackageAppService.cs index 7292aece0..eedec01ef 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Packages/PackageAppService.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Packages/PackageAppService.cs @@ -29,7 +29,7 @@ public class PackageAppService : PlatformApplicationServiceBase, IPackageAppServ { var package = await _packageRepository.FindLatestAsync(input.Name, input.Version); - return package == null ? PackageDto.None() : ObjectMapper.Map(package); + return ObjectMapper.Map(package); } [Authorize(PlatformPermissions.Package.Create)] diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Localization/Resources/en.json b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Localization/Resources/en.json index 7a149bf0f..4c1f3a8c2 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Localization/Resources/en.json +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Localization/Resources/en.json @@ -21,6 +21,7 @@ "DisplayName:Code": "Code", "DisplayName:IsPublic": "Is Public", "DisplayName:DisplayName": "Display Name", + "DisplayName:UIFramework": "UI Framework", "DisplayName:Description": "Description", "DisplayName:AllowBeNull": "Allow Be Null", "DisplayName:DefaultValue": "Default Value", @@ -41,6 +42,15 @@ "DisplayName:Version": "Version", "DisplayName:ForceUpdate": "Force Update", "DisplayName:Authors": "Authors", + "DisplayName:Level": "Level", + "DisplayName:Url": "Url", + "DisplayName:Size": "Size", + "DisplayName:Summary": "Summary", + "DisplayName:CreatedAt": "Created Time", + "DisplayName:UpdatedAt": "Updated Time", + "DisplayName:DownloadCount": "Download Count", + "DisplayName:File": "File", + "DisplayName:Blobs": "Blobs", "Layout:AddNew": "Add New", "Layout:Edit": "Edit", "Layout:EditByName": "Edit Layout - {0}", diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Localization/Resources/zh-Hans.json b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Localization/Resources/zh-Hans.json index 283841978..f9c91c6f2 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Localization/Resources/zh-Hans.json +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Localization/Resources/zh-Hans.json @@ -42,6 +42,15 @@ "DisplayName:Version": "版本", "DisplayName:ForceUpdate": "强制更新", "DisplayName:Authors": "作者", + "DisplayName:Level": "更新级别", + "DisplayName:Url": "下载地址", + "DisplayName:Size": "文件大小", + "DisplayName:Summary": "文件说明", + "DisplayName:CreatedAt": "创建时间", + "DisplayName:UpdatedAt": "修改时间", + "DisplayName:DownloadCount": "下载次数", + "DisplayName:File": "上传文件", + "DisplayName:Blobs": "资源文件", "Layout:AddNew": "添加新布局", "Layout:Edit": "编辑布局", "Layout:EditByName": "编辑布局 - {0}", diff --git a/aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.HttpApi/LINGYUN/Abp/TaskManagement/BackgroundJobInfoController.cs b/aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.HttpApi/LINGYUN/Abp/TaskManagement/BackgroundJobInfoController.cs index 86f722bfb..b36dcb4c5 100644 --- a/aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.HttpApi/LINGYUN/Abp/TaskManagement/BackgroundJobInfoController.cs +++ b/aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.HttpApi/LINGYUN/Abp/TaskManagement/BackgroundJobInfoController.cs @@ -142,9 +142,9 @@ public class BackgroundJobInfoController : DynamicQueryableControllerBase { - if (ctx.Request.CanAccept(MimeTypes.Application.Json)) + if (string.Equals(ctx.Request.Headers[XRequestFromHeader], DontRedirectRequestFromHeader, StringComparison.Ordinal)) { - ctx.Response.Headers.Location = ctx.RedirectUri; + // ctx.Response.Headers.Location = ctx.RedirectUri; ctx.Response.StatusCode = 401; } else @@ -41,10 +45,10 @@ public class AbpCookieAuthenticationHandler : CookieAuthenticationHandler }, OnRedirectToAccessDenied = ctx => { - if (ctx.Request.CanAccept(MimeTypes.Application.Json)) + if (string.Equals(ctx.Request.Headers[XRequestFromHeader], DontRedirectRequestFromHeader, StringComparison.Ordinal)) { - ctx.Response.Headers.Location = ctx.RedirectUri; - ctx.Response.StatusCode = 403; + // ctx.Response.Headers.Location = ctx.RedirectUri; + ctx.Response.StatusCode = 401; } else { @@ -54,9 +58,10 @@ public class AbpCookieAuthenticationHandler : CookieAuthenticationHandler }, OnRedirectToLogout = ctx => { - if (ctx.Request.CanAccept(MimeTypes.Application.Json)) + if (string.Equals(ctx.Request.Headers[XRequestFromHeader], DontRedirectRequestFromHeader, StringComparison.Ordinal)) { - ctx.Response.Headers.Location = ctx.RedirectUri; + // ctx.Response.Headers.Location = ctx.RedirectUri; + ctx.Response.StatusCode = 401; } else { @@ -66,9 +71,10 @@ public class AbpCookieAuthenticationHandler : CookieAuthenticationHandler }, OnRedirectToReturnUrl = ctx => { - if (ctx.Request.CanAccept(MimeTypes.Application.Json)) + if (string.Equals(ctx.Request.Headers[XRequestFromHeader], DontRedirectRequestFromHeader, StringComparison.Ordinal)) { - ctx.Response.Headers.Location = ctx.RedirectUri; + // ctx.Response.Headers.Location = ctx.RedirectUri; + ctx.Response.StatusCode = 401; } else { diff --git a/aspnet-core/services/LY.MicroService.Applications.Single/LY.MicroService.Applications.Single.csproj b/aspnet-core/services/LY.MicroService.Applications.Single/LY.MicroService.Applications.Single.csproj index 5e08c8c69..9823acb71 100644 --- a/aspnet-core/services/LY.MicroService.Applications.Single/LY.MicroService.Applications.Single.csproj +++ b/aspnet-core/services/LY.MicroService.Applications.Single/LY.MicroService.Applications.Single.csproj @@ -78,6 +78,7 @@ + @@ -122,6 +123,12 @@ + + + + + + diff --git a/aspnet-core/services/LY.MicroService.Applications.Single/MicroServiceApplicationsSingleModule.Configure.cs b/aspnet-core/services/LY.MicroService.Applications.Single/MicroServiceApplicationsSingleModule.Configure.cs index 6678173d0..bcc5e3042 100644 --- a/aspnet-core/services/LY.MicroService.Applications.Single/MicroServiceApplicationsSingleModule.Configure.cs +++ b/aspnet-core/services/LY.MicroService.Applications.Single/MicroServiceApplicationsSingleModule.Configure.cs @@ -2,8 +2,12 @@ using Elsa.Options; using LINGYUN.Abp.Aliyun.Localization; using LINGYUN.Abp.BackgroundTasks; +using LINGYUN.Abp.DataProtectionManagement; +using LINGYUN.Abp.Demo.Books; +using LINGYUN.Abp.Demo.Localization; using LINGYUN.Abp.ExceptionHandling; using LINGYUN.Abp.ExceptionHandling.Emailing; +using LINGYUN.Abp.Exporter.MiniExcel; using LINGYUN.Abp.Idempotent; using LINGYUN.Abp.Identity.Session; using LINGYUN.Abp.IdentityServer.IdentityResources; @@ -39,6 +43,7 @@ using Microsoft.AspNetCore.Server.Kestrel.Core; using Microsoft.Extensions.Caching.StackExchangeRedis; using Microsoft.IdentityModel.Logging; using Microsoft.OpenApi.Models; +using MiniExcelLibs.Attributes; using OpenIddict.Server; using OpenIddict.Server.AspNetCore; using Quartz; @@ -60,7 +65,6 @@ using Volo.Abp.EntityFrameworkCore; using Volo.Abp.FeatureManagement; using Volo.Abp.Features; using Volo.Abp.GlobalFeatures; -using Volo.Abp.Http; using Volo.Abp.Http.Client; using Volo.Abp.Identity.Localization; using Volo.Abp.IdentityServer; @@ -455,6 +459,42 @@ public partial class MicroServiceApplicationsSingleModule }); } } + /// + /// 配置数据导出 + /// + private void ConfigureExporter() + { + Configure(options => + { + options.MapExportSetting(typeof(BookDto), config => + { + config.DynamicColumns = new[] + { + // 忽略某些字段 + new DynamicExcelColumn(nameof(BookDto.AuthorId)){ Ignore = true }, + new DynamicExcelColumn(nameof(BookDto.LastModificationTime)){ Ignore = true }, + new DynamicExcelColumn(nameof(BookDto.LastModifierId)){ Ignore = true }, + new DynamicExcelColumn(nameof(BookDto.CreationTime)){ Ignore = true }, + new DynamicExcelColumn(nameof(BookDto.CreatorId)){ Ignore = true }, + new DynamicExcelColumn(nameof(BookDto.Id)){ Ignore = true }, + }; + }); + }); + } + /// + /// 配置数据权限 + /// + private void ConfigureEntityDataProtected() + { + Configure(options => + { + options.AddEntities(typeof(DemoResource), + new[] + { + typeof(Book), + }); + }); + } private void ConfigurePermissionManagement(IConfiguration configuration) { @@ -813,24 +853,21 @@ public partial class MicroServiceApplicationsSingleModule services.Replace(ServiceLifetime.Scoped); services.AddAuthentication() - .AddJwtBearer(options => + .AddAbpJwtBearer(options => { - options.Authority = configuration["AuthServer:Authority"]; - options.RequireHttpsMetadata = false; - options.Audience = configuration["AuthServer:ApiName"]; - options.Events = new JwtBearerEvents + configuration.GetSection("AuthServer").Bind(options); + + options.Events ??= new JwtBearerEvents(); + options.Events.OnMessageReceived = context => { - OnMessageReceived = context => + var accessToken = context.Request.Query["access_token"]; + var path = context.HttpContext.Request.Path; + if (!string.IsNullOrEmpty(accessToken) && + (path.StartsWithSegments("/api/files"))) { - var accessToken = context.Request.Query["access_token"]; - var path = context.HttpContext.Request.Path; - if (!string.IsNullOrEmpty(accessToken) && - (path.StartsWithSegments("/api/files"))) - { - context.Token = accessToken; - } - return Task.CompletedTask; + context.Token = accessToken; } + return Task.CompletedTask; }; }); diff --git a/aspnet-core/services/LY.MicroService.Applications.Single/MicroServiceApplicationsSingleModule.cs b/aspnet-core/services/LY.MicroService.Applications.Single/MicroServiceApplicationsSingleModule.cs index 8a2f81f9e..2141cca65 100644 --- a/aspnet-core/services/LY.MicroService.Applications.Single/MicroServiceApplicationsSingleModule.cs +++ b/aspnet-core/services/LY.MicroService.Applications.Single/MicroServiceApplicationsSingleModule.cs @@ -22,12 +22,17 @@ using LINGYUN.Abp.CachingManagement; using LINGYUN.Abp.CachingManagement.StackExchangeRedis; using LINGYUN.Abp.Dapr.Client; using LINGYUN.Abp.Data.DbMigrator; +using LINGYUN.Abp.DataProtectionManagement; +using LINGYUN.Abp.DataProtectionManagement.EntityFrameworkCore; +using LINGYUN.Abp.Demo; +using LINGYUN.Abp.Demo.EntityFrameworkCore; using LINGYUN.Abp.Elsa; using LINGYUN.Abp.Elsa.Activities; using LINGYUN.Abp.Elsa.EntityFrameworkCore; using LINGYUN.Abp.Elsa.EntityFrameworkCore.MySql; using LINGYUN.Abp.ExceptionHandling; using LINGYUN.Abp.ExceptionHandling.Emailing; +using LINGYUN.Abp.Exporter.MiniExcel; using LINGYUN.Abp.FeatureManagement; using LINGYUN.Abp.FeatureManagement.HttpApi; using LINGYUN.Abp.Features.LimitValidation; @@ -180,25 +185,30 @@ namespace LY.MicroService.Applications.Single; typeof(AbpOssManagementHttpApiModule), typeof(AbpOssManagementFileSystemImageSharpModule), typeof(AbpOssManagementSettingManagementModule), + typeof(PlatformDomainModule), typeof(PlatformApplicationModule), typeof(PlatformHttpApiModule), typeof(PlatformEntityFrameworkCoreModule), typeof(PlatformSettingsVueVbenAdminModule), typeof(PlatformThemeVueVbenAdminModule), + typeof(AbpUINavigationVueVbenAdminModule), typeof(AbpSaasDomainModule), typeof(AbpSaasApplicationModule), typeof(AbpSaasHttpApiModule), typeof(AbpSaasEntityFrameworkCoreModule), + typeof(TaskManagementDomainModule), typeof(TaskManagementApplicationModule), typeof(TaskManagementHttpApiModule), typeof(TaskManagementEntityFrameworkCoreModule), + typeof(AbpTextTemplatingDomainModule), typeof(AbpTextTemplatingApplicationModule), typeof(AbpTextTemplatingHttpApiModule), typeof(AbpTextTemplatingEntityFrameworkCoreModule), + typeof(AbpWebhooksModule), typeof(AbpWebhooksEventBusModule), typeof(AbpWebhooksIdentityModule), @@ -207,27 +217,33 @@ namespace LY.MicroService.Applications.Single; typeof(WebhooksManagementApplicationModule), typeof(WebhooksManagementHttpApiModule), typeof(WebhooksManagementEntityFrameworkCoreModule), + typeof(AbpFeatureManagementApplicationModule), typeof(AbpFeatureManagementHttpApiModule), typeof(AbpFeatureManagementEntityFrameworkCoreModule), + typeof(AbpSettingManagementDomainModule), typeof(AbpSettingManagementApplicationModule), typeof(AbpSettingManagementHttpApiModule), typeof(AbpSettingManagementEntityFrameworkCoreModule), + typeof(AbpPermissionManagementApplicationModule), typeof(AbpPermissionManagementHttpApiModule), typeof(AbpPermissionManagementDomainIdentityModule), // typeof(AbpPermissionManagementDomainIdentityServerModule), typeof(AbpPermissionManagementEntityFrameworkCoreModule), typeof(AbpPermissionManagementDomainOrganizationUnitsModule), // 组织机构权限管理 + typeof(SingleMigrationsEntityFrameworkCoreModule), typeof(AbpEntityFrameworkCoreMySQLModule), typeof(AbpAliyunSmsModule), typeof(AbpAliyunSettingManagementModule), + typeof(AbpAuthenticationQQModule), typeof(AbpAuthenticationWeChatModule), typeof(AbpAuthorizationOrganizationUnitsModule), typeof(AbpIdentityOrganizaztionUnitsModule), + typeof(AbpBackgroundTasksModule), typeof(AbpBackgroundTasksActivitiesModule), typeof(AbpBackgroundTasksDistributedLockingModule), @@ -236,23 +252,38 @@ namespace LY.MicroService.Applications.Single; typeof(AbpBackgroundTasksJobsModule), typeof(AbpBackgroundTasksNotificationsModule), typeof(AbpBackgroundTasksQuartzModule), + + typeof(AbpDataProtectionManagementApplicationModule), + typeof(AbpDataProtectionManagementHttpApiModule), + typeof(AbpDataProtectionManagementEntityFrameworkCoreModule), + + typeof(AbpDemoApplicationModule), + typeof(AbpDemoHttpApiModule), + typeof(AbpDemoEntityFrameworkCoreModule), + typeof(AbpDaprClientModule), typeof(AbpExceptionHandlingModule), typeof(AbpEmailingExceptionHandlingModule), typeof(AbpFeaturesLimitValidationModule), typeof(AbpFeaturesValidationRedisClientModule), typeof(AbpAspNetCoreMvcLocalizationModule), + typeof(AbpLocalizationCultureMapModule), typeof(AbpLocalizationPersistenceModule), + typeof(AbpOpenApiAuthorizationModule), + typeof(AbpIMSignalRModule), + typeof(AbpNotificationsModule), typeof(AbpNotificationsCommonModule), typeof(AbpNotificationsSignalRModule), typeof(AbpNotificationsEmailingModule), typeof(AbpMultiTenancyEditionsModule), + typeof(AbpTencentQQModule), typeof(AbpTencentCloudSettingManagementModule), + typeof(AbpIdentityWeChatModule), typeof(AbpNotificationsWeChatMiniProgramModule), typeof(AbpWeChatMiniProgramModule), @@ -265,17 +296,21 @@ namespace LY.MicroService.Applications.Single; typeof(AbpWeChatOfficialHandlersModule), typeof(AbpWeChatWorkHandlersModule), typeof(AbpWeChatSettingManagementModule), + typeof(AbpDataDbMigratorModule), typeof(AbpIdGeneratorModule), typeof(AbpUINavigationModule), typeof(AbpAccountTemplatesModule), typeof(AbpAspNetCoreAuthenticationJwtBearerModule), typeof(AbpCachingStackExchangeRedisModule), + typeof(AbpElsaModule), typeof(AbpElsaServerModule), typeof(AbpElsaActivitiesModule), typeof(AbpElsaEntityFrameworkCoreModule), typeof(AbpElsaEntityFrameworkCoreMySqlModule), + + typeof(AbpExporterMiniExcelModule), typeof(AbpAspNetCoreMvcUiMultiTenancyModule), typeof(AbpAspNetCoreSerilogModule), typeof(AbpHttpClientWrapperModule), @@ -310,6 +345,7 @@ public partial class MicroServiceApplicationsSingleModule : AbpModule ConfigureWeChat(); ConfigureWrapper(); + ConfigureExporter(); ConfigureAuditing(); ConfigureDbContext(); ConfigureIdempotent(); @@ -321,6 +357,7 @@ public partial class MicroServiceApplicationsSingleModule : AbpModule ConfigureBackgroundTasks(); ConfigureExceptionHandling(); ConfigureVirtualFileSystem(); + ConfigureEntityDataProtected(); ConfigureUrls(configuration); ConfigureCaching(configuration); ConfigureAuditing(configuration); diff --git a/aspnet-core/services/LY.MicroService.Applications.Single/appsettings.Development.json b/aspnet-core/services/LY.MicroService.Applications.Single/appsettings.Development.json index d6df3534e..c2e64f239 100644 --- a/aspnet-core/services/LY.MicroService.Applications.Single/appsettings.Development.json +++ b/aspnet-core/services/LY.MicroService.Applications.Single/appsettings.Development.json @@ -52,7 +52,8 @@ "TaskManagement": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456;SslMode=None", "Workflow": "Server=127.0.0.1;Database=Workflow-V70;User Id=root;Password=123456;SslMode=None", "Notifications": "Server=127.0.0.1;Database=Messages-V70;User Id=root;Password=123456;SslMode=None", - "MessageService": "Server=127.0.0.1;Database=Messages-V70;User Id=root;Password=123456;SslMode=None" + "MessageService": "Server=127.0.0.1;Database=Messages-V70;User Id=root;Password=123456;SslMode=None", + "Demo": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456;SslMode=None" }, "DistributedLock": { "IsEnabled": true, @@ -129,7 +130,8 @@ "AuthServer": { "UseOpenIddict": true, "Authority": "http://127.0.0.1:30001/", - "ApiName": "lingyun-abp-application", + "Audience": "lingyun-abp-application", + "RequireHttpsMetadata": false, "SwaggerClientId": "InternalServiceClient", "SwaggerClientSecret": "1q2w3E*" }, diff --git a/aspnet-core/templates/PackageName.CompanyName.ProjectName.csproj b/aspnet-core/templates/PackageName.CompanyName.ProjectName.csproj index ae82c9869..cceabf72e 100644 --- a/aspnet-core/templates/PackageName.CompanyName.ProjectName.csproj +++ b/aspnet-core/templates/PackageName.CompanyName.ProjectName.csproj @@ -3,7 +3,7 @@ net8.0 true LINGYUN.Abp.MicroService.Templates - 8.2.1 + 8.3.0 colin.in@foxmail.com Abp framework micro-service template MIT diff --git a/common.props b/common.props index 49e6ba98f..b94fc2553 100644 --- a/common.props +++ b/common.props @@ -1,12 +1,12 @@ latest - 8.2.2 + 8.3.0 colin $(NoWarn);CS1591;CS0436;CS8618;NU1803 https://github.com/colinin/abp-next-admin $(SolutionDir)LocalNuget - 8.2.2 + 8.3.0 MIT git https://github.com/colinin/abp-next-admin