diff --git a/aspnet-core/templates/PackageName.CompanyName.ProjectName.csproj b/aspnet-core/templates/PackageName.CompanyName.ProjectName.csproj deleted file mode 100644 index cceabf72e..000000000 --- a/aspnet-core/templates/PackageName.CompanyName.ProjectName.csproj +++ /dev/null @@ -1,30 +0,0 @@ - - - net8.0 - true - LINGYUN.Abp.MicroService.Templates - 8.3.0 - colin.in@foxmail.com - Abp framework micro-service template - MIT - false - https://github.com/colinin/abp-next-admin - micro webapi cloud - Template - git - https://github.com/colinin/abp-next-admin - true - true - true - true - False - False - - - - - true - content - - - \ No newline at end of file diff --git a/aspnet-core/templates/content/.template.config/template.json b/aspnet-core/templates/content/.template.config/template.json deleted file mode 100644 index 132f70183..000000000 --- a/aspnet-core/templates/content/.template.config/template.json +++ /dev/null @@ -1,109 +0,0 @@ -{ - "$schema": "http://json.schemastore.org/template", - "author": "colin.in@foxmail.com", - "classifications": ["micro", "webapi", "cloud"], - "name": "LINGYUN.Abp.MicroService", - "identity": "LINGYUN.Abp.MicroService", - "description": "Abp framework micro-service template", - "groupIdentity": "LINGYUN.Abp.Application", - "shortName": "lam", - "tags": { - "language": "C#", - "type": "project" - }, - "sources": [ - { - "modifiers": [ - { - "exclude": [ "**/[Bb]in/**", "**/[Oo]bj/**", "**/[Ll]ocalNuget/**" , ".template.config/**/*", ".vs/**/*"] - } - ] - } - ], - "sourceName": "ProjectName", - "preferNameDirectory": true, - "symbols": { - "AuthenticationScheme": { - "type": "parameter", - "description": "Authentication Scheme", - "datatype": "choice", - "defaultValue": "IdentityServer4", - "isRequired": false, - "choices": [ - { - "choice": "IdentityServer4", - "description": "IdentityServer4" - }, - { - "choice": "OpenIddict", - "description": "OpenIddict" - } - ] - }, - "DatabaseManagement": { - "type": "parameter", - "description": "Database Management", - "dataType": "choice", - "defaultValue": "MySQL", - "isRequired": false, - "choices": [ - { - "choice": "SqlServer", - "description": "Sql Server" - }, - { - "choice": "MySQL", - "description": "My SQL" - }, - { - "choice": "Sqlite", - "description": "Sqlite" - }, - { - "choice": "Oracle", - "description": "Oracle" - }, - { - "choice": "OracleDevart", - "description": "Oracle Devart Driver" - }, - { - "choice": "PostgreSql", - "description": "Postgre Sql" - } - ] - }, - "SqlServer": { - "type": "computed", - "value": "(DatabaseManagement == \"SqlServer\")" - }, - "MySQL": { - "type": "computed", - "value": "(DatabaseManagement == \"MySQL\")" - }, - "Sqlite": { - "type": "computed", - "value": "(DatabaseManagement == \"Sqlite\")" - }, - "Oracle": { - "type": "computed", - "value": "(DatabaseManagement == \"Oracle\")" - }, - "OracleDevart": { - "type": "computed", - "value": "(DatabaseManagement == \"Oracle.Devart\")" - }, - "PostgreSql": { - "type": "computed", - "value": "(DatabaseManagement == \"PostgreSql\")" - }, - "IdentityServer4": { - "type": "computed", - "value": "(AuthenticationScheme == \"IdentityServer4\")" - }, - "OpenIddict": { - "type": "computed", - "value": "(AuthenticationScheme == \"OpenIddict\")" - } - } -} diff --git a/aspnet-core/templates/content/.template.config/template.zh-Hans.json b/aspnet-core/templates/content/.template.config/template.zh-Hans.json deleted file mode 100644 index f0339e4e4..000000000 --- a/aspnet-core/templates/content/.template.config/template.zh-Hans.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "description": "适用于abp框架的微服务模板项目", - "symbols/AuthenticationScheme/description": "认证服务体系, 可选项为: IdentityServer4、OpenIddict, 默认使用IdentityServer4.", - "symbols/DatabaseManagement/description": "数据库管理提供者, 可选项为: SqlServer、MySQL、Sqlite、Oracle、OracleDevart、PostgreSql, 默认使用MySQL." -} diff --git a/aspnet-core/templates/content/Directory.Build.props b/aspnet-core/templates/content/Directory.Build.props deleted file mode 100644 index a9ca45ada..000000000 --- a/aspnet-core/templates/content/Directory.Build.props +++ /dev/null @@ -1,13 +0,0 @@ - - - true - - - - - all - runtime; build; native; contentfiles; analyzers - - - - diff --git a/aspnet-core/templates/content/Directory.Packages.props b/aspnet-core/templates/content/Directory.Packages.props deleted file mode 100644 index 433f06afb..000000000 --- a/aspnet-core/templates/content/Directory.Packages.props +++ /dev/null @@ -1,490 +0,0 @@ - - - 8.2.0 - 2.14.1 - 8.3.0 - 8.3.0 - 8.0.0 - 8.0.0 - 8.0.0 - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/aspnet-core/templates/content/NuGet.Config b/aspnet-core/templates/content/NuGet.Config deleted file mode 100644 index ddde6944c..000000000 --- a/aspnet-core/templates/content/NuGet.Config +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/aspnet-core/templates/content/PackageName.CompanyName.ProjectName.sln b/aspnet-core/templates/content/PackageName.CompanyName.ProjectName.sln deleted file mode 100644 index 8d3a5d224..000000000 --- a/aspnet-core/templates/content/PackageName.CompanyName.ProjectName.sln +++ /dev/null @@ -1,150 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.0.31903.59 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{4B0AD527-99B3-49A9-8A45-FD8671F8BE4D}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PackageName.CompanyName.ProjectName.HttpApi.Host", "host\PackageName.CompanyName.ProjectName.HttpApi.Host\PackageName.CompanyName.ProjectName.HttpApi.Host.csproj", "{31E33CE2-71D3-43FF-9A30-2DCC82C607AE}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".Solution Items", ".Solution Items", "{C9675742-7986-4BC1-9781-FD1C3C5B6287}" - ProjectSection(SolutionItems) = preProject - common.props = common.props - configureawait.props = configureawait.props - Directory.Build.props = Directory.Build.props - Directory.Packages.props = Directory.Packages.props - NuGet.Config = NuGet.Config - EndProjectSection -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "host", "host", "{4786387C-C1C5-46F8-806F-EBC54DB0A4FA}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{A9CB1547-1C2C-4A23-82EC-C834C1626E0A}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PackageName.CompanyName.ProjectName.Application.Tests", "tests\PackageName.CompanyName.ProjectName.Application.Tests\PackageName.CompanyName.ProjectName.Application.Tests.csproj", "{9262FE7A-76B2-424F-8C34-AFA1D95D7E5A}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PackageName.CompanyName.ProjectName.Domain.Tests", "tests\PackageName.CompanyName.ProjectName.Domain.Tests\PackageName.CompanyName.ProjectName.Domain.Tests.csproj", "{A0D1F8A4-3494-4E26-9E2D-DB874B93DBCE}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PackageName.CompanyName.ProjectName.EntityFrameworkCore.Tests", "tests\PackageName.CompanyName.ProjectName.EntityFrameworkCore.Tests\PackageName.CompanyName.ProjectName.EntityFrameworkCore.Tests.csproj", "{0B2E1C9E-092D-4E5F-BE9F-5506E689FC85}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PackageName.CompanyName.ProjectName.TestBase", "tests\PackageName.CompanyName.ProjectName.TestBase\PackageName.CompanyName.ProjectName.TestBase.csproj", "{4A9D43A2-D08B-40E8-9C74-F2B95BF81AED}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PackageName.CompanyName.ProjectName.DbMigrator", "host\PackageName.CompanyName.ProjectName.DbMigrator\PackageName.CompanyName.ProjectName.DbMigrator.csproj", "{F6EE5BCD-69C7-4C8A-8B45-251AFE2BB01E}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "migrations", "migrations", "{2BF87FAA-69E7-486E-9123-1F407A2BB633}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PackageName.CompanyName.ProjectName.Domain.Shared", "src\PackageName.CompanyName.ProjectName.Domain.Shared\PackageName.CompanyName.ProjectName.Domain.Shared.csproj", "{77090F97-BD80-4469-842F-F5769CF849E9}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PackageName.CompanyName.ProjectName.Domain", "src\PackageName.CompanyName.ProjectName.Domain\PackageName.CompanyName.ProjectName.Domain.csproj", "{DF2CCF03-95D5-4BE4-8B32-742818C56F15}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PackageName.CompanyName.ProjectName.Application.Contracts", "src\PackageName.CompanyName.ProjectName.Application.Contracts\PackageName.CompanyName.ProjectName.Application.Contracts.csproj", "{54FB9929-7D9C-40FC-A0D0-94ACBA37D20E}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PackageName.CompanyName.ProjectName.Application", "src\PackageName.CompanyName.ProjectName.Application\PackageName.CompanyName.ProjectName.Application.csproj", "{F2A6182F-BCB9-4C80-947C-0A2ED1B6BFDB}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PackageName.CompanyName.ProjectName.Dapr.Client", "src\PackageName.CompanyName.ProjectName.Dapr.Client\PackageName.CompanyName.ProjectName.Dapr.Client.csproj", "{B69F04FF-8505-49F6-9B60-BB800846C87C}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PackageName.CompanyName.ProjectName.EntityFrameworkCore", "src\PackageName.CompanyName.ProjectName.EntityFrameworkCore\PackageName.CompanyName.ProjectName.EntityFrameworkCore.csproj", "{09CA7186-DBA7-4428-A1ED-31292AC02050}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PackageName.CompanyName.ProjectName.HttpApi", "src\PackageName.CompanyName.ProjectName.HttpApi\PackageName.CompanyName.ProjectName.HttpApi.csproj", "{FDB3A3E9-C072-438D-8B8D-2AA957C1167F}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PackageName.CompanyName.ProjectName.HttpApi.Client", "src\PackageName.CompanyName.ProjectName.HttpApi.Client\PackageName.CompanyName.ProjectName.HttpApi.Client.csproj", "{8CE7C515-CD78-42D4-A9D7-39D217A3D046}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PackageName.CompanyName.ProjectName.SettingManagement", "src\PackageName.CompanyName.ProjectName.SettingManagement\PackageName.CompanyName.ProjectName.SettingManagement.csproj", "{CAEB3435-A332-4FFA-BE5F-4E386FA8B19B}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PackageName.CompanyName.ProjectName.AIO.Host", "host\PackageName.CompanyName.ProjectName.AIO.Host\PackageName.CompanyName.ProjectName.AIO.Host.csproj", "{26F1E2F7-3B0E-4333-9E66-EFE0D113386B}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {31E33CE2-71D3-43FF-9A30-2DCC82C607AE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {31E33CE2-71D3-43FF-9A30-2DCC82C607AE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {31E33CE2-71D3-43FF-9A30-2DCC82C607AE}.Release|Any CPU.ActiveCfg = Release|Any CPU - {31E33CE2-71D3-43FF-9A30-2DCC82C607AE}.Release|Any CPU.Build.0 = Release|Any CPU - {9262FE7A-76B2-424F-8C34-AFA1D95D7E5A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9262FE7A-76B2-424F-8C34-AFA1D95D7E5A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9262FE7A-76B2-424F-8C34-AFA1D95D7E5A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {9262FE7A-76B2-424F-8C34-AFA1D95D7E5A}.Release|Any CPU.Build.0 = Release|Any CPU - {A0D1F8A4-3494-4E26-9E2D-DB874B93DBCE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A0D1F8A4-3494-4E26-9E2D-DB874B93DBCE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A0D1F8A4-3494-4E26-9E2D-DB874B93DBCE}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A0D1F8A4-3494-4E26-9E2D-DB874B93DBCE}.Release|Any CPU.Build.0 = Release|Any CPU - {0B2E1C9E-092D-4E5F-BE9F-5506E689FC85}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0B2E1C9E-092D-4E5F-BE9F-5506E689FC85}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0B2E1C9E-092D-4E5F-BE9F-5506E689FC85}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0B2E1C9E-092D-4E5F-BE9F-5506E689FC85}.Release|Any CPU.Build.0 = Release|Any CPU - {4A9D43A2-D08B-40E8-9C74-F2B95BF81AED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4A9D43A2-D08B-40E8-9C74-F2B95BF81AED}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4A9D43A2-D08B-40E8-9C74-F2B95BF81AED}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4A9D43A2-D08B-40E8-9C74-F2B95BF81AED}.Release|Any CPU.Build.0 = Release|Any CPU - {F6EE5BCD-69C7-4C8A-8B45-251AFE2BB01E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F6EE5BCD-69C7-4C8A-8B45-251AFE2BB01E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F6EE5BCD-69C7-4C8A-8B45-251AFE2BB01E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F6EE5BCD-69C7-4C8A-8B45-251AFE2BB01E}.Release|Any CPU.Build.0 = Release|Any CPU - {77090F97-BD80-4469-842F-F5769CF849E9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {77090F97-BD80-4469-842F-F5769CF849E9}.Debug|Any CPU.Build.0 = Debug|Any CPU - {77090F97-BD80-4469-842F-F5769CF849E9}.Release|Any CPU.ActiveCfg = Release|Any CPU - {77090F97-BD80-4469-842F-F5769CF849E9}.Release|Any CPU.Build.0 = Release|Any CPU - {DF2CCF03-95D5-4BE4-8B32-742818C56F15}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {DF2CCF03-95D5-4BE4-8B32-742818C56F15}.Debug|Any CPU.Build.0 = Debug|Any CPU - {DF2CCF03-95D5-4BE4-8B32-742818C56F15}.Release|Any CPU.ActiveCfg = Release|Any CPU - {DF2CCF03-95D5-4BE4-8B32-742818C56F15}.Release|Any CPU.Build.0 = Release|Any CPU - {54FB9929-7D9C-40FC-A0D0-94ACBA37D20E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {54FB9929-7D9C-40FC-A0D0-94ACBA37D20E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {54FB9929-7D9C-40FC-A0D0-94ACBA37D20E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {54FB9929-7D9C-40FC-A0D0-94ACBA37D20E}.Release|Any CPU.Build.0 = Release|Any CPU - {F2A6182F-BCB9-4C80-947C-0A2ED1B6BFDB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F2A6182F-BCB9-4C80-947C-0A2ED1B6BFDB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F2A6182F-BCB9-4C80-947C-0A2ED1B6BFDB}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F2A6182F-BCB9-4C80-947C-0A2ED1B6BFDB}.Release|Any CPU.Build.0 = Release|Any CPU - {B69F04FF-8505-49F6-9B60-BB800846C87C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B69F04FF-8505-49F6-9B60-BB800846C87C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B69F04FF-8505-49F6-9B60-BB800846C87C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B69F04FF-8505-49F6-9B60-BB800846C87C}.Release|Any CPU.Build.0 = Release|Any CPU - {09CA7186-DBA7-4428-A1ED-31292AC02050}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {09CA7186-DBA7-4428-A1ED-31292AC02050}.Debug|Any CPU.Build.0 = Debug|Any CPU - {09CA7186-DBA7-4428-A1ED-31292AC02050}.Release|Any CPU.ActiveCfg = Release|Any CPU - {09CA7186-DBA7-4428-A1ED-31292AC02050}.Release|Any CPU.Build.0 = Release|Any CPU - {FDB3A3E9-C072-438D-8B8D-2AA957C1167F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {FDB3A3E9-C072-438D-8B8D-2AA957C1167F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FDB3A3E9-C072-438D-8B8D-2AA957C1167F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {FDB3A3E9-C072-438D-8B8D-2AA957C1167F}.Release|Any CPU.Build.0 = Release|Any CPU - {8CE7C515-CD78-42D4-A9D7-39D217A3D046}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8CE7C515-CD78-42D4-A9D7-39D217A3D046}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8CE7C515-CD78-42D4-A9D7-39D217A3D046}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8CE7C515-CD78-42D4-A9D7-39D217A3D046}.Release|Any CPU.Build.0 = Release|Any CPU - {CAEB3435-A332-4FFA-BE5F-4E386FA8B19B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {CAEB3435-A332-4FFA-BE5F-4E386FA8B19B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CAEB3435-A332-4FFA-BE5F-4E386FA8B19B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {CAEB3435-A332-4FFA-BE5F-4E386FA8B19B}.Release|Any CPU.Build.0 = Release|Any CPU - {26F1E2F7-3B0E-4333-9E66-EFE0D113386B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {26F1E2F7-3B0E-4333-9E66-EFE0D113386B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {26F1E2F7-3B0E-4333-9E66-EFE0D113386B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {26F1E2F7-3B0E-4333-9E66-EFE0D113386B}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {31E33CE2-71D3-43FF-9A30-2DCC82C607AE} = {4786387C-C1C5-46F8-806F-EBC54DB0A4FA} - {9262FE7A-76B2-424F-8C34-AFA1D95D7E5A} = {A9CB1547-1C2C-4A23-82EC-C834C1626E0A} - {A0D1F8A4-3494-4E26-9E2D-DB874B93DBCE} = {A9CB1547-1C2C-4A23-82EC-C834C1626E0A} - {0B2E1C9E-092D-4E5F-BE9F-5506E689FC85} = {A9CB1547-1C2C-4A23-82EC-C834C1626E0A} - {4A9D43A2-D08B-40E8-9C74-F2B95BF81AED} = {A9CB1547-1C2C-4A23-82EC-C834C1626E0A} - {F6EE5BCD-69C7-4C8A-8B45-251AFE2BB01E} = {2BF87FAA-69E7-486E-9123-1F407A2BB633} - {77090F97-BD80-4469-842F-F5769CF849E9} = {4B0AD527-99B3-49A9-8A45-FD8671F8BE4D} - {DF2CCF03-95D5-4BE4-8B32-742818C56F15} = {4B0AD527-99B3-49A9-8A45-FD8671F8BE4D} - {54FB9929-7D9C-40FC-A0D0-94ACBA37D20E} = {4B0AD527-99B3-49A9-8A45-FD8671F8BE4D} - {F2A6182F-BCB9-4C80-947C-0A2ED1B6BFDB} = {4B0AD527-99B3-49A9-8A45-FD8671F8BE4D} - {B69F04FF-8505-49F6-9B60-BB800846C87C} = {4B0AD527-99B3-49A9-8A45-FD8671F8BE4D} - {09CA7186-DBA7-4428-A1ED-31292AC02050} = {4B0AD527-99B3-49A9-8A45-FD8671F8BE4D} - {FDB3A3E9-C072-438D-8B8D-2AA957C1167F} = {4B0AD527-99B3-49A9-8A45-FD8671F8BE4D} - {8CE7C515-CD78-42D4-A9D7-39D217A3D046} = {4B0AD527-99B3-49A9-8A45-FD8671F8BE4D} - {CAEB3435-A332-4FFA-BE5F-4E386FA8B19B} = {4B0AD527-99B3-49A9-8A45-FD8671F8BE4D} - {26F1E2F7-3B0E-4333-9E66-EFE0D113386B} = {4786387C-C1C5-46F8-806F-EBC54DB0A4FA} - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {62C0F185-E2C2-46A2-B4B2-5E703E25849E} - EndGlobalSection -EndGlobal diff --git a/aspnet-core/templates/content/README.md b/aspnet-core/templates/content/README.md deleted file mode 100644 index 81638ea3d..000000000 --- a/aspnet-core/templates/content/README.md +++ /dev/null @@ -1,83 +0,0 @@ -# LINGYUN.Abp.MicroService.Template - -[English](README.md) | [中文](README.zh-CN.md) - -## Introduction - -LINGYUN.Abp.MicroService.Template is a microservice project template based on ABP Framework. This template provides a complete microservice architecture foundation, including necessary project structure and configurations. - -## Features - -- Complete microservice project structure -- Integrated authentication -- Database integration (multiple databases supported) -- Unified configuration management -- Distributed event bus support -- Background job processing - -## How to Use - -### Install Template - -```bash -dotnet new install LINGYUN.Abp.MicroService.Template -``` - -### Create New Project - -```bash -labp create YourCompanyName.YourProjectName -pk YourPackageName -o /path/to/output --dbms MySql --cs "Server=127.0.0.1;Database=YourDatabase;User Id=your_user;Password=your_password;SslMode=None" --no-random-port -``` - -## How to Run - -After creating your project, you can run it using the following command: - -```bash -dotnet run --launch-profile "YourPackageName.YourCompanyName.YourProjectName.Development" -``` - -For example: -```bash -dotnet run --launch-profile "LY.MicroService.Applications.Single.Development" -``` - -## How to Package and Publish - -1. Clone the Project - -```bash -git clone -cd /aspnet-core/templates/content -``` - -2. Modify Version - Edit `../PackageName.CompanyName.ProjectName.csproj` file, update PackageVersion: - -```xml -8.3.0 -``` - -3. Execute Packaging Script - -```powershell -# Windows PowerShell -.\pack.ps1 - -# PowerShell Core (Windows/Linux/macOS) -pwsh pack.ps1 -``` - -## Supported Databases - -- SqlServer -- MySQL -- PostgreSQL -- Oracle -- SQLite - -## Notes - -- Ensure .NET SDK 8.0 or higher is installed -- Pay attention to NuGet publish address and key when packaging -- Complete testing is recommended before publishing diff --git a/aspnet-core/templates/content/README.zh-CN.md b/aspnet-core/templates/content/README.zh-CN.md deleted file mode 100644 index 7ee4451d0..000000000 --- a/aspnet-core/templates/content/README.zh-CN.md +++ /dev/null @@ -1,83 +0,0 @@ -# LINGYUN.Abp.MicroService.Template - -[English](README.md) | [中文](README.zh-CN.md) - -## 简介 - -LINGYUN.Abp.MicroService.Template 是一个基于 ABP Framework 的微服务项目模板。此模板提供了一个完整的微服务架构基础,包括必要的项目结构和配置。 - -## 功能特点 - -- 完整的微服务项目结构 -- 集成身份认证 -- 数据库集成(支持多种数据库) -- 统一的配置管理 -- 分布式事件总线支持 -- 后台任务处理 - -## 如何使用 - -### 安装模板 - -```bash -dotnet new install LINGYUN.Abp.MicroService.Template -``` - -### 创建新项目 - -```bash -labp create YourCompanyName.YourProjectName -pk YourPackageName -o /path/to/output --dbms MySql --cs "Server=127.0.0.1;Database=YourDatabase;User Id=your_user;Password=your_password;SslMode=None" --no-random-port -``` - -## 如何运行 - -创建项目后,您可以使用以下命令运行项目: - -```bash -dotnet run --launch-profile "YourPackageName.YourCompanyName.YourProjectName.Development" -``` - -示例: -```bash -dotnet run --launch-profile "LY.MicroService.Applications.Single.Development" -``` - -## 如何打包发布 - -1. 克隆项目 - -```bash -git clone -cd /aspnet-core/templates/content -``` - -2. 修改版本号 - 编辑 `../PackageName.CompanyName.ProjectName.csproj` 文件,更新 PackageVersion: - -```xml -8.3.0 -``` - -3. 执行打包脚本 - -```powershell -# Windows PowerShell -.\pack.ps1 - -# PowerShell Core (Windows/Linux/macOS) -pwsh pack.ps1 -``` - -## 支持的数据库 - -- SqlServer -- MySQL -- PostgreSQL -- Oracle -- SQLite - -## 注意事项 - -- 确保已安装 .NET SDK 8.0 或更高版本 -- 打包时注意修改 NuGet 发布地址和密钥 -- 建议在发布前进行完整的测试 diff --git a/aspnet-core/templates/content/common.props b/aspnet-core/templates/content/common.props deleted file mode 100644 index c299ae39b..000000000 --- a/aspnet-core/templates/content/common.props +++ /dev/null @@ -1,38 +0,0 @@ - - - latest - 8.2.1 - colin - $(NoWarn);CS1591;CS0436;CS8618;NU1803 - https://github.com/colinin/abp-next-admin - $(SolutionDir)LocalNuget - 8.2.1 - MIT - git - https://github.com/colinin/abp-next-admin - true - - - - - - - - - - - - - - - - - - - - - - $(SolutionDir)LocalNuget - - - \ No newline at end of file diff --git a/aspnet-core/templates/content/configureawait.props b/aspnet-core/templates/content/configureawait.props deleted file mode 100644 index 3caa88c04..000000000 --- a/aspnet-core/templates/content/configureawait.props +++ /dev/null @@ -1,9 +0,0 @@ - - - - - All - runtime; build; native; contentfiles; analyzers - - - \ No newline at end of file diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/.config/dotnet-tools.json b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/.config/dotnet-tools.json deleted file mode 100644 index 6b93cca86..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/.config/dotnet-tools.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": 1, - "isRoot": true, - "tools": { - "dotnet-ef": { - "version": "7.0.3", - "commands": [ - "dotnet-ef" - ] - } - } -} \ No newline at end of file diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/.gitignore b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/.gitignore deleted file mode 100644 index 7b6f60857..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -wwwroot -package*.json \ No newline at end of file diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Authentication/AbpCookieAuthenticationHandler.cs b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Authentication/AbpCookieAuthenticationHandler.cs deleted file mode 100644 index 34517090f..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Authentication/AbpCookieAuthenticationHandler.cs +++ /dev/null @@ -1,89 +0,0 @@ -using Microsoft.AspNetCore.Authentication; -using Microsoft.AspNetCore.Authentication.Cookies; -using Microsoft.Extensions.Options; -using System.Text.Encodings.Web; - -namespace PackageName.CompanyName.ProjectName.AIO.Host.Authentication; - -public class AbpCookieAuthenticationHandler : CookieAuthenticationHandler -{ - public AbpCookieAuthenticationHandler( - IOptionsMonitor options, - ILoggerFactory logger, - UrlEncoder encoder) : base(options, logger, encoder) - { - } - - public AbpCookieAuthenticationHandler( - IOptionsMonitor options, - ILoggerFactory logger, - UrlEncoder encoder, - ISystemClock clock) : base(options, logger, encoder, clock) - { - } - - protected const string XRequestFromHeader = "X-Request-From"; - protected const string DontRedirectRequestFromHeader = "vben"; - protected override Task InitializeEventsAsync() - { - var events = new CookieAuthenticationEvents - { - OnRedirectToLogin = ctx => - { - if (string.Equals(ctx.Request.Headers[XRequestFromHeader], DontRedirectRequestFromHeader, StringComparison.Ordinal)) - { - // ctx.Response.Headers.Location = ctx.RedirectUri; - ctx.Response.StatusCode = 401; - } - else - { - ctx.Response.Redirect(ctx.RedirectUri); - } - return Task.CompletedTask; - }, - OnRedirectToAccessDenied = ctx => - { - if (string.Equals(ctx.Request.Headers[XRequestFromHeader], DontRedirectRequestFromHeader, StringComparison.Ordinal)) - { - // ctx.Response.Headers.Location = ctx.RedirectUri; - ctx.Response.StatusCode = 401; - } - else - { - ctx.Response.Redirect(ctx.RedirectUri); - } - return Task.CompletedTask; - }, - OnRedirectToLogout = ctx => - { - if (string.Equals(ctx.Request.Headers[XRequestFromHeader], DontRedirectRequestFromHeader, StringComparison.Ordinal)) - { - // ctx.Response.Headers.Location = ctx.RedirectUri; - ctx.Response.StatusCode = 401; - } - else - { - ctx.Response.Redirect(ctx.RedirectUri); - } - return Task.CompletedTask; - }, - OnRedirectToReturnUrl = ctx => - { - if (string.Equals(ctx.Request.Headers[XRequestFromHeader], DontRedirectRequestFromHeader, StringComparison.Ordinal)) - { - // ctx.Response.Headers.Location = ctx.RedirectUri; - ctx.Response.StatusCode = 401; - } - else - { - ctx.Response.Redirect(ctx.RedirectUri); - } - return Task.CompletedTask; - } - }; - - Events = events; - - return Task.CompletedTask; - } -} diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/BackgroundJobs/NotificationPublishJob.cs b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/BackgroundJobs/NotificationPublishJob.cs deleted file mode 100644 index c9db9977a..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/BackgroundJobs/NotificationPublishJob.cs +++ /dev/null @@ -1,38 +0,0 @@ -using LINGYUN.Abp.Notifications; -using Microsoft.Extensions.Options; -using Volo.Abp.BackgroundJobs; -using Volo.Abp.DependencyInjection; - -namespace PackageName.CompanyName.ProjectName.AIO.Host.BackgroundJobs; - -public class NotificationPublishJob : AsyncBackgroundJob, ITransientDependency -{ - protected AbpNotificationsPublishOptions Options { get; } - protected IServiceScopeFactory ServiceScopeFactory { get; } - protected INotificationDataSerializer NotificationDataSerializer { get; } - public NotificationPublishJob( - IOptions options, - IServiceScopeFactory serviceScopeFactory, - INotificationDataSerializer notificationDataSerializer) - { - Options = options.Value; - ServiceScopeFactory = serviceScopeFactory; - NotificationDataSerializer = notificationDataSerializer; - } - - public override async Task ExecuteAsync(NotificationPublishJobArgs args) - { - var providerType = Type.GetType(args.ProviderType); - using (var scope = ServiceScopeFactory.CreateScope()) - { - if (scope.ServiceProvider.GetRequiredService(providerType) is INotificationPublishProvider publishProvider) - { - var store = scope.ServiceProvider.GetRequiredService(); - var notification = await store.GetNotificationOrNullAsync(args.TenantId, args.NotificationId); - notification.Data = NotificationDataSerializer.Serialize(notification.Data); - - await publishProvider.PublishAsync(notification, args.UserIdentifiers); - } - } - } -} diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/BackgroundJobs/NotificationPublishJobArgs.cs b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/BackgroundJobs/NotificationPublishJobArgs.cs deleted file mode 100644 index e5f077d65..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/BackgroundJobs/NotificationPublishJobArgs.cs +++ /dev/null @@ -1,22 +0,0 @@ -using LINGYUN.Abp.Notifications; - -namespace PackageName.CompanyName.ProjectName.AIO.Host.BackgroundJobs; - -public class NotificationPublishJobArgs -{ - public Guid? TenantId { get; set; } - public long NotificationId { get; set; } - public string ProviderType { get; set; } - public List UserIdentifiers { get; set; } - public NotificationPublishJobArgs() - { - UserIdentifiers = new List(); - } - public NotificationPublishJobArgs(long id, string providerType, List userIdentifiers, Guid? tenantId = null) - { - NotificationId = id; - ProviderType = providerType; - UserIdentifiers = userIdentifiers; - TenantId = tenantId; - } -} diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Controllers/HomeController.cs b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Controllers/HomeController.cs deleted file mode 100644 index e693a0917..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Controllers/HomeController.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Microsoft.AspNetCore.Mvc; - -namespace PackageName.CompanyName.ProjectName.AIO.Host.Controllers; - -public class HomeController : Controller -{ - public IActionResult Index() - { - return Redirect("/swagger"); - } -} diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Controllers/SettingMergeController.cs b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Controllers/SettingMergeController.cs deleted file mode 100644 index 11e91bd88..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Controllers/SettingMergeController.cs +++ /dev/null @@ -1,70 +0,0 @@ -using LINGYUN.Abp.SettingManagement; -using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.Options; -using Volo.Abp.DependencyInjection; - -namespace PackageName.CompanyName.ProjectName.AIO.Host.Controllers; - -[ExposeServices( - typeof(SettingController), - typeof(SettingMergeController))] -public class SettingMergeController : SettingController -{ - private readonly SettingManagementMergeOptions _mergeOptions; - public SettingMergeController( - ISettingAppService settingAppService, - ISettingTestAppService settingTestAppService, - IOptions mergeOptions) - : base(settingAppService, settingTestAppService) - { - _mergeOptions = mergeOptions.Value; - } - - [HttpGet] - [Route("by-current-tenant")] - public async override Task GetAllForCurrentTenantAsync() - { - var result = new SettingGroupResult(); - var markTypeMap = new List - { - typeof(SettingMergeController), - }; - foreach (var serviceType in _mergeOptions.GlobalSettingProviders - .Where(type => !markTypeMap.Any(markType => type.IsAssignableFrom(markType)))) - { - var settingService = LazyServiceProvider.LazyGetRequiredService(serviceType).As(); - var currentResult = await settingService.GetAllForCurrentTenantAsync(); - foreach (var group in currentResult.Items) - { - result.AddGroup(group); - } - markTypeMap.Add(serviceType); - } - - return result; - } - - [HttpGet] - [Route("by-global")] - public async override Task GetAllForGlobalAsync() - { - var result = new SettingGroupResult(); - var markTypeMap = new List - { - typeof(SettingMergeController), - }; - foreach (var serviceType in _mergeOptions.GlobalSettingProviders - .Where(type => !markTypeMap.Any(markType => type.IsAssignableFrom(markType)))) - { - var settingService = LazyServiceProvider.LazyGetRequiredService(serviceType).As(); - var currentResult = await settingService.GetAllForGlobalAsync(); - foreach (var group in currentResult.Items) - { - result.AddGroup(group); - } - markTypeMap.Add(serviceType); - } - - return result; - } -} diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Controllers/UserSettingMergeController.cs b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Controllers/UserSettingMergeController.cs deleted file mode 100644 index 5091a8a5e..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Controllers/UserSettingMergeController.cs +++ /dev/null @@ -1,45 +0,0 @@ -using LINGYUN.Abp.SettingManagement; -using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.Options; -using Volo.Abp.DependencyInjection; - -namespace PackageName.CompanyName.ProjectName.AIO.Host.Controllers; - -[ExposeServices( - typeof(UserSettingController), - typeof(UserSettingMergeController))] -public class UserSettingMergeController : UserSettingController -{ - private readonly SettingManagementMergeOptions _mergeOptions; - public UserSettingMergeController( - IUserSettingAppService service, - IOptions mergeOptions) - : base(service) - { - _mergeOptions = mergeOptions.Value; - } - - [HttpGet] - [Route("by-current-user")] - public async override Task GetAllForCurrentUserAsync() - { - var result = new SettingGroupResult(); - var markTypeMap = new List - { - typeof(UserSettingMergeController), - }; - foreach (var serviceType in _mergeOptions.UserSettingProviders - .Where(type => !markTypeMap.Any(markType => type.IsAssignableFrom(markType)))) - { - var settingService = LazyServiceProvider.LazyGetRequiredService(serviceType).As(); - var currentResult = await settingService.GetAllForCurrentUserAsync(); - foreach (var group in currentResult.Items) - { - result.AddGroup(group); - } - markTypeMap.Add(serviceType); - } - - return result; - } -} diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Dockerfile b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Dockerfile deleted file mode 100644 index aee09fd66..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Dockerfile +++ /dev/null @@ -1,19 +0,0 @@ -FROM mcr.microsoft.com/dotnet/aspnet:8.0 -LABEL maintainer="colin.in@foxmail.com" -WORKDIR /app - -COPY . /app - -#东8区 -ENV TZ=Asia/Shanghai -RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo '$TZ' > /etc/timezone - -EXPOSE 80/tcp -VOLUME [ "./app/blobs" ] -VOLUME [ "./app/Logs" ] -VOLUME [ "./app/Modules" ] - -RUN apt update -RUN apt install wget -y - -ENTRYPOINT ["dotnet", "LY.MicroService.Applications.Single.dll"] diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/EventBus/Distributed/ChatMessageEventHandler.cs b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/EventBus/Distributed/ChatMessageEventHandler.cs deleted file mode 100644 index a08702a0a..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/EventBus/Distributed/ChatMessageEventHandler.cs +++ /dev/null @@ -1,59 +0,0 @@ -using LINGYUN.Abp.IM; -using LINGYUN.Abp.IM.Messages; -using LINGYUN.Abp.RealTime; -using Microsoft.Extensions.Logging.Abstractions; -using Microsoft.Extensions.Options; -using Volo.Abp.DependencyInjection; -using Volo.Abp.EventBus.Distributed; - -namespace PackageName.CompanyName.ProjectName.AIO.Host.EventBus.Distributed -{ - public class ChatMessageEventHandler : IDistributedEventHandler>, ITransientDependency - { - /// - /// Reference to . - /// - public ILogger Logger { get; set; } - /// - /// Reference to . - /// - protected AbpIMOptions Options { get; } - - protected IMessageStore MessageStore { get; } - protected IMessageBlocker MessageBlocker { get; } - protected IMessageSenderProviderManager MessageSenderProviderManager { get; } - - public ChatMessageEventHandler( - IOptions options, - IMessageStore messageStore, - IMessageBlocker messageBlocker, - IMessageSenderProviderManager messageSenderProviderManager) - { - Options = options.Value; - MessageStore = messageStore; - MessageBlocker = messageBlocker; - MessageSenderProviderManager = messageSenderProviderManager; - - Logger = NullLogger.Instance; - } - - public async virtual Task HandleEventAsync(RealTimeEto eventData) - { - Logger.LogDebug($"Persistent chat message."); - - var message = eventData.Data; - // 消息拦截 - // 扩展敏感词汇过滤 - await MessageBlocker.InterceptAsync(message); - - await MessageStore.StoreMessageAsync(message); - - // 发送消息 - foreach (var provider in MessageSenderProviderManager.Providers) - { - Logger.LogDebug($"Sending message with provider {provider.Name}"); - await provider.SendMessageAsync(message); - } - } - } -} diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/EventBus/Distributed/NotificationEventHandler.cs b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/EventBus/Distributed/NotificationEventHandler.cs deleted file mode 100644 index cb871c6ef..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/EventBus/Distributed/NotificationEventHandler.cs +++ /dev/null @@ -1,470 +0,0 @@ -using LINGYUN.Abp.Notifications; -using Microsoft.Extensions.Localization; -using Microsoft.Extensions.Logging.Abstractions; -using Microsoft.Extensions.Options; -using PackageName.CompanyName.ProjectName.AIO.Host.BackgroundJobs; -using PackageName.CompanyName.ProjectName.AIO.Host.MultiTenancy; -using System.Globalization; -using Volo.Abp.BackgroundJobs; -using Volo.Abp.DependencyInjection; -using Volo.Abp.EventBus.Distributed; -using Volo.Abp.Json; -using Volo.Abp.Localization; -using Volo.Abp.MultiTenancy; -using Volo.Abp.TextTemplating; -using Volo.Abp.Uow; - -namespace PackageName.CompanyName.ProjectName.AIO.Host.EventBus.Distributed -{ - /// - /// 订阅通知发布事件,统一发布消息 - /// - /// - /// 作用在于SignalR客户端只会与一台服务器建立连接, - /// 只有启用了SignlR服务端的才能真正将消息发布到客户端 - /// - public class NotificationEventHandler : - IDistributedEventHandler>, - IDistributedEventHandler>, - ITransientDependency - { - /// - /// Reference to . - /// - public ILogger Logger { get; set; } - /// - /// Reference to . - /// - protected AbpNotificationsPublishOptions Options { get; } - /// - /// Reference to . - /// - protected ICurrentTenant CurrentTenant { get; } - /// - /// Reference to . - /// - protected ITenantConfigurationCache TenantConfigurationCache { get; } - /// - /// Reference to . - /// - protected IJsonSerializer JsonSerializer { get; } - /// - /// Reference to . - /// - protected IBackgroundJobManager BackgroundJobManager { get; } - /// - /// Reference to . - /// - protected ITemplateRenderer TemplateRenderer { get; } - /// - /// Reference to . - /// - protected INotificationStore NotificationStore { get; } - /// - /// Reference to . - /// - protected IStringLocalizerFactory StringLocalizerFactory { get; } - /// - /// Reference to . - /// - protected INotificationDataSerializer NotificationDataSerializer { get; } - /// - /// Reference to . - /// - protected INotificationDefinitionManager NotificationDefinitionManager { get; } - /// - /// Reference to . - /// - protected INotificationSubscriptionManager NotificationSubscriptionManager { get; } - /// - /// Reference to . - /// - protected INotificationPublishProviderManager NotificationPublishProviderManager { get; } - - /// - /// Initializes a new instance of the class. - /// - public NotificationEventHandler( - ICurrentTenant currentTenant, - ITenantConfigurationCache tenantConfigurationCache, - IJsonSerializer jsonSerializer, - ITemplateRenderer templateRenderer, - IBackgroundJobManager backgroundJobManager, - IStringLocalizerFactory stringLocalizerFactory, - IOptions options, - INotificationStore notificationStore, - INotificationDataSerializer notificationDataSerializer, - INotificationDefinitionManager notificationDefinitionManager, - INotificationSubscriptionManager notificationSubscriptionManager, - INotificationPublishProviderManager notificationPublishProviderManager) - { - Options = options.Value; - TenantConfigurationCache = tenantConfigurationCache; - CurrentTenant = currentTenant; - JsonSerializer = jsonSerializer; - TemplateRenderer = templateRenderer; - BackgroundJobManager = backgroundJobManager; - StringLocalizerFactory = stringLocalizerFactory; - NotificationStore = notificationStore; - NotificationDataSerializer = notificationDataSerializer; - NotificationDefinitionManager = notificationDefinitionManager; - NotificationSubscriptionManager = notificationSubscriptionManager; - NotificationPublishProviderManager = notificationPublishProviderManager; - - Logger = NullLogger.Instance; - } - - [UnitOfWork] - public async virtual Task HandleEventAsync(NotificationEto eventData) - { - var notification = await NotificationDefinitionManager.GetOrNullAsync(eventData.Name); - if (notification == null) - { - return; - } - - var culture = eventData.Data.Culture; - if (culture.IsNullOrWhiteSpace()) - { - culture = CultureInfo.CurrentCulture.Name; - } - using (CultureHelper.Use(culture, culture)) - { - if (notification.NotificationType == NotificationType.System) - { - using (CurrentTenant.Change(null)) - { - await SendToTenantAsync(null, notification, eventData); - - var allActiveTenants = await TenantConfigurationCache.GetTenantsAsync(); - - foreach (var activeTenant in allActiveTenants) - { - await SendToTenantAsync(activeTenant.Id, notification, eventData); - } - } - } - else - { - await SendToTenantAsync(eventData.TenantId, notification, eventData); - } - } - } - - [UnitOfWork] - public async virtual Task HandleEventAsync(NotificationEto eventData) - { - var notification = await NotificationDefinitionManager.GetOrNullAsync(eventData.Name); - if (notification == null) - { - return; - } - - if (notification.NotificationType == NotificationType.System) - { - using (CurrentTenant.Change(null)) - { - await SendToTenantAsync(null, notification, eventData); - - var allActiveTenants = await TenantConfigurationCache.GetTenantsAsync(); - - foreach (var activeTenant in allActiveTenants) - { - await SendToTenantAsync(activeTenant.Id, notification, eventData); - } - } - } - else - { - await SendToTenantAsync(eventData.TenantId, notification, eventData); - } - } - - protected async virtual Task SendToTenantAsync( - Guid? tenantId, - NotificationDefinition notification, - NotificationEto eventData) - { - using (CurrentTenant.Change(tenantId)) - { - var providers = Enumerable.Reverse(NotificationPublishProviderManager.Providers); - - // 过滤用户指定提供者 - if (eventData.UseProviders.Any()) - { - providers = providers.Where(p => eventData.UseProviders.Contains(p.Name)); - } - else if (notification.Providers.Any()) - { - providers = providers.Where(p => notification.Providers.Contains(p.Name)); - } - - var notificationInfo = new NotificationInfo - { - Name = notification.Name, - TenantId = tenantId, - Severity = eventData.Severity, - Type = notification.NotificationType, - ContentType = notification.ContentType, - CreationTime = eventData.CreationTime, - Lifetime = notification.NotificationLifetime, - }; - notificationInfo.SetId(eventData.Id); - - var title = notification.DisplayName.Localize(StringLocalizerFactory); - var message = ""; - - try - { - // 由于模板通知受租户影响, 格式化失败的消息将被丢弃. - message = await TemplateRenderer.RenderAsync( - templateName: eventData.Data.Name, - model: eventData.Data.ExtraProperties, - cultureName: eventData.Data.Culture, - globalContext: new Dictionary - { - // 模板不支持 $ 字符, 改为普通关键字 - { NotificationKeywords.Name, notification.Name }, - { NotificationKeywords.FormUser, eventData.Data.FormUser }, - { NotificationKeywords.Id, eventData.Id }, - { NotificationKeywords.Title, title.ToString() }, - { NotificationKeywords.CreationTime, eventData.CreationTime.ToString(Options.DateTimeFormat) }, - }); - } - catch(Exception ex) - { - Logger.LogWarning("Formatting template notification failed, message will be discarded, cause :{message}", ex.Message); - return; - } - - var notificationData = new NotificationData(); - notificationData.WriteStandardData( - title: title.ToString(), - message: message, - createTime: eventData.CreationTime, - formUser: eventData.Data.FormUser); - notificationData.ExtraProperties.AddIfNotContains(eventData.Data.ExtraProperties); - - notificationInfo.Data = notificationData; - - var subscriptionUsers = await GerSubscriptionUsersAsync( - notificationInfo.Name, - eventData.Users, - tenantId); - - await PersistentNotificationAsync( - notificationInfo, - subscriptionUsers, - providers); - - if (subscriptionUsers.Any()) - { - // 发布通知 - foreach (var provider in providers) - { - await PublishToSubscriberAsync(provider, notificationInfo, subscriptionUsers); - } - } - } - } - - protected async virtual Task SendToTenantAsync( - Guid? tenantId, - NotificationDefinition notification, - NotificationEto eventData) - { - using (CurrentTenant.Change(tenantId)) - { - var providers = Enumerable.Reverse(NotificationPublishProviderManager.Providers); - - // 过滤用户指定提供者 - if (eventData.UseProviders.Any()) - { - providers = providers.Where(p => eventData.UseProviders.Contains(p.Name)); - } - else if (notification.Providers.Any()) - { - providers = providers.Where(p => notification.Providers.Contains(p.Name)); - } - - var notificationInfo = new NotificationInfo - { - Name = notification.Name, - CreationTime = eventData.CreationTime, - Data = eventData.Data, - Severity = eventData.Severity, - Lifetime = notification.NotificationLifetime, - TenantId = tenantId, - Type = notification.NotificationType, - ContentType = notification.ContentType, - }; - notificationInfo.SetId(eventData.Id); - - notificationInfo.Data = NotificationDataSerializer.Serialize(notificationInfo.Data); - - // 获取用户订阅 - var subscriptionUsers = await GerSubscriptionUsersAsync( - notificationInfo.Name, - eventData.Users, - tenantId); - - // 持久化通知 - await PersistentNotificationAsync( - notificationInfo, - subscriptionUsers, - providers); - - if (subscriptionUsers.Any()) - { - // 发布订阅通知 - foreach (var provider in providers) - { - await PublishToSubscriberAsync(provider, notificationInfo, subscriptionUsers); - } - } - } - } - /// - /// 获取用户订阅列表 - /// - /// 通知名称 - /// 接收用户列表 - /// 租户标识 - /// 用户订阅列表 - protected async Task> GerSubscriptionUsersAsync( - string notificationName, - IEnumerable sendToUsers, - Guid? tenantId = null) - { - try - { - // 获取用户订阅列表 - var userSubscriptions = await NotificationSubscriptionManager.GetUsersSubscriptionsAsync( - tenantId, - notificationName, - sendToUsers); - - return userSubscriptions.Select(us => new UserIdentifier(us.UserId, us.UserName)); - } - catch(Exception ex) - { - Logger.LogWarning("Failed to get user subscription, message will not be received by the user, reason: {message}", ex.Message); - } - - return new List(); - } - /// - /// 持久化通知并返回订阅用户列表 - /// - /// 通知实体 - /// 订阅用户列表 - /// 通知发送提供者 - /// 返回订阅者列表 - protected async Task PersistentNotificationAsync( - NotificationInfo notificationInfo, - IEnumerable subscriptionUsers, - IEnumerable sendToProviders) - { - try - { - // 持久化通知 - await NotificationStore.InsertNotificationAsync(notificationInfo); - - if (!subscriptionUsers.Any()) - { - return; - } - - // 持久化用户通知 - await NotificationStore.InsertUserNotificationsAsync(notificationInfo, subscriptionUsers.Select(u => u.UserId)); - - if (notificationInfo.Lifetime == NotificationLifetime.OnlyOne) - { - // 一次性通知取消用户订阅 - await NotificationStore.DeleteUserSubscriptionAsync( - notificationInfo.TenantId, - subscriptionUsers, - notificationInfo.Name); - } - } - catch (Exception ex) - { - Logger.LogWarning("Failed to persistent notification failed, reason: {message}", ex.Message); - - foreach (var provider in sendToProviders) - { - // 处理持久化失败进入后台队列 - await ProcessingFailedToQueueAsync(provider, notificationInfo, subscriptionUsers); - } - } - } - /// - /// 发布订阅者通知 - /// - /// 通知发布者 - /// 通知信息 - /// 订阅用户列表 - /// - protected async Task PublishToSubscriberAsync( - INotificationPublishProvider provider, - NotificationInfo notificationInfo, - IEnumerable subscriptionUsers) - { - try - { - Logger.LogDebug($"Sending notification with provider {provider.Name}"); - - // 2024-10-10: 框架层面应该取消通知数据转换,而是交给提供商来实现 - //var notifacationDataMapping = Options.NotificationDataMappings - // .GetMapItemOrDefault(provider.Name, notificationInfo.Name); - //if (notifacationDataMapping != null) - //{ - // notificationInfo.Data = notifacationDataMapping.MappingFunc(notificationInfo.Data); - //} - - // 发布 - await provider.PublishAsync(notificationInfo, subscriptionUsers); - - Logger.LogDebug($"Send notification {notificationInfo.Name} with provider {provider.Name} was successful"); - } - catch (Exception ex) - { - Logger.LogWarning($"Send notification error with provider {provider.Name}"); - Logger.LogWarning($"Error message:{ex.Message}"); - Logger.LogDebug($"Failed to send notification {notificationInfo.Name}. Try to push notification to background job"); - // 发送失败的消息进入后台队列 - await ProcessingFailedToQueueAsync(provider, notificationInfo, subscriptionUsers); - } - } - /// - /// 处理失败的消息进入后台队列 - /// - /// - /// 注: 如果入队失败,消息将被丢弃. - /// - /// - /// - /// - /// - protected async Task ProcessingFailedToQueueAsync( - INotificationPublishProvider provider, - NotificationInfo notificationInfo, - IEnumerable subscriptionUsers) - { - try - { - // 发送失败的消息进入后台队列 - await BackgroundJobManager.EnqueueAsync( - new NotificationPublishJobArgs( - notificationInfo.GetId(), - provider.GetType().AssemblyQualifiedName, - subscriptionUsers.ToList(), - notificationInfo.TenantId)); - } - catch(Exception ex) - { - Logger.LogWarning("Failed to push to background job, notification will be discarded, error cause: {message}", ex.Message); - } - } - } -} diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/EventBus/Distributed/TenantSynchronizer.cs b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/EventBus/Distributed/TenantSynchronizer.cs deleted file mode 100644 index 3e07d5be9..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/EventBus/Distributed/TenantSynchronizer.cs +++ /dev/null @@ -1,53 +0,0 @@ -using LINGYUN.Abp.Saas.Tenants; -using PackageName.CompanyName.ProjectName.AIO.Host.MultiTenancy; -using Volo.Abp.Data; -using Volo.Abp.DependencyInjection; -using Volo.Abp.Domain.Entities.Events.Distributed; -using Volo.Abp.EventBus.Distributed; -using Volo.Abp.MultiTenancy; -using Volo.Abp.Uow; - -namespace PackageName.CompanyName.ProjectName.AIO.Host.EventBus.Distributed -{ - public class TenantSynchronizer : - IDistributedEventHandler>, - IDistributedEventHandler>, - IDistributedEventHandler>, - IDistributedEventHandler, - ITransientDependency - { - protected IDataSeeder DataSeeder { get; } - protected ITenantConfigurationCache TenantConfigurationCache { get; } - - public TenantSynchronizer( - IDataSeeder dataSeeder, - ITenantConfigurationCache tenantConfigurationCache) - { - DataSeeder = dataSeeder; - TenantConfigurationCache = tenantConfigurationCache; - } - - [UnitOfWork] - public async virtual Task HandleEventAsync(EntityCreatedEto eventData) - { - await TenantConfigurationCache.RefreshAsync(); - - await DataSeeder.SeedAsync(eventData.Entity.Id); - } - - public async virtual Task HandleEventAsync(EntityUpdatedEto eventData) - { - await TenantConfigurationCache.RefreshAsync(); - } - - public async virtual Task HandleEventAsync(EntityDeletedEto eventData) - { - await TenantConfigurationCache.RefreshAsync(); - } - - public async virtual Task HandleEventAsync(TenantConnectionStringUpdatedEto eventData) - { - await TenantConfigurationCache.RefreshAsync(); - } - } -} diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/EventBus/Distributed/UserCreateEventHandler.cs b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/EventBus/Distributed/UserCreateEventHandler.cs deleted file mode 100644 index ee5ab700b..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/EventBus/Distributed/UserCreateEventHandler.cs +++ /dev/null @@ -1,30 +0,0 @@ -using Volo.Abp.DependencyInjection; -using Volo.Abp.Domain.Entities.Events; -using Volo.Abp.Domain.Entities.Events.Distributed; -using Volo.Abp.EventBus.Distributed; -using Volo.Abp.EventBus.Local; -using Volo.Abp.Users; - -namespace PackageName.CompanyName.ProjectName.AIO.Host.EventBus.Distributed -{ - public class UserCreateEventHandler : IDistributedEventHandler>, ITransientDependency - { - private readonly ILocalEventBus _localEventBus; - public UserCreateEventHandler( - ILocalEventBus localEventBus) - { - _localEventBus = localEventBus; - } - /// - /// 接收添加用户事件,发布本地事件 - /// - /// - /// - public async Task HandleEventAsync(EntityCreatedEto eventData) - { - var localUserCreateEventData = new EntityCreatedEventData(eventData.Entity); - - await _localEventBus.PublishAsync(localUserCreateEventData); - } - } -} diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/EventBus/Distributed/WebhooksEventHandler.cs b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/EventBus/Distributed/WebhooksEventHandler.cs deleted file mode 100644 index eeb0fcdb7..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/EventBus/Distributed/WebhooksEventHandler.cs +++ /dev/null @@ -1,112 +0,0 @@ -using LINGYUN.Abp.Webhooks; -using LINGYUN.Abp.Webhooks.EventBus; -using Volo.Abp.BackgroundJobs; -using Volo.Abp.DependencyInjection; -using Volo.Abp.EventBus.Distributed; -using Volo.Abp.MultiTenancy; - -namespace PackageName.CompanyName.ProjectName.AIO.Host.EventBus.Distributed; - -public class WebhooksEventHandler : - IDistributedEventHandler, - ITransientDependency -{ - public IWebhookEventStore WebhookEventStore { get; set; } - - private readonly ICurrentTenant _currentTenant; - private readonly IBackgroundJobManager _backgroundJobManager; - private readonly IWebhookSubscriptionManager _webhookSubscriptionManager; - - public WebhooksEventHandler( - IWebhookSubscriptionManager webhookSubscriptionManager, - ICurrentTenant currentTenant, - IBackgroundJobManager backgroundJobManager) - { - _currentTenant = currentTenant; - _backgroundJobManager = backgroundJobManager; - _webhookSubscriptionManager = webhookSubscriptionManager; - - WebhookEventStore = NullWebhookEventStore.Instance; - } - - public async virtual Task HandleEventAsync(WebhooksEventData eventData) - { - var subscriptions = await _webhookSubscriptionManager - .GetAllSubscriptionsOfTenantsIfFeaturesGrantedAsync( - eventData.TenantIds, - eventData.WebhookName); - - await PublishAsync(eventData.WebhookName, eventData.Data, subscriptions, eventData.SendExactSameData, eventData.Headers); - } - - protected async virtual Task PublishAsync( - string webhookName, - string data, - List webhookSubscriptions, - bool sendExactSameData = false, - WebhookHeader headers = null) - { - if (webhookSubscriptions.IsNullOrEmpty()) - { - return; - } - - var subscriptionsGroupedByTenant = webhookSubscriptions.GroupBy(x => x.TenantId); - - foreach (var subscriptionGroupedByTenant in subscriptionsGroupedByTenant) - { - var webhookInfo = await SaveAndGetWebhookAsync(subscriptionGroupedByTenant.Key, webhookName, data); - - foreach (var webhookSubscription in subscriptionGroupedByTenant) - { - var headersToSend = webhookSubscription.Headers; - if (headers != null) - { - if (headers.UseOnlyGivenHeaders)//do not use the headers defined in subscription - { - headersToSend = headers.Headers; - } - else - { - //use the headers defined in subscription. If additional headers has same header, use additional headers value. - foreach (var additionalHeader in headers.Headers) - { - headersToSend[additionalHeader.Key] = additionalHeader.Value; - } - } - } - - await _backgroundJobManager.EnqueueAsync(new WebhookSenderArgs - { - TenantId = webhookSubscription.TenantId, - WebhookEventId = webhookInfo.Id, - Data = webhookInfo.Data, - WebhookName = webhookInfo.WebhookName, - WebhookSubscriptionId = webhookSubscription.Id, - Headers = headersToSend, - Secret = webhookSubscription.Secret, - WebhookUri = webhookSubscription.WebhookUri, - SendExactSameData = sendExactSameData - }); - } - } - } - - protected async virtual Task SaveAndGetWebhookAsync( - Guid? tenantId, - string webhookName, - string data) - { - var webhookInfo = new WebhookEvent - { - WebhookName = webhookName, - Data = data, - TenantId = tenantId - }; - - var webhookId = await WebhookEventStore.InsertAndGetIdAsync(webhookInfo); - webhookInfo.Id = webhookId; - - return webhookInfo; - } -} diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/EventBus/Local/UserCreateJoinIMEventHandler.cs b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/EventBus/Local/UserCreateJoinIMEventHandler.cs deleted file mode 100644 index 2b78e5841..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/EventBus/Local/UserCreateJoinIMEventHandler.cs +++ /dev/null @@ -1,58 +0,0 @@ -using LINGYUN.Abp.MessageService.Chat; -using LINGYUN.Abp.MessageService.Notifications; -using LINGYUN.Abp.Notifications; -using Volo.Abp.DependencyInjection; -using Volo.Abp.Domain.Entities.Events; -using Volo.Abp.EventBus; -using Volo.Abp.Uow; -using Volo.Abp.Users; - -namespace PackageName.CompanyName.ProjectName.AIO.Host.EventBus.Local -{ - public class UserCreateJoinIMEventHandler : ILocalEventHandler>, ITransientDependency - { - private readonly IChatDataSeeder _chatDataSeeder; - private readonly INotificationSubscriptionManager _notificationSubscriptionManager; - public UserCreateJoinIMEventHandler( - IChatDataSeeder chatDataSeeder, - INotificationSubscriptionManager notificationSubscriptionManager) - { - _chatDataSeeder = chatDataSeeder; - _notificationSubscriptionManager = notificationSubscriptionManager; - } - /// - /// 接收添加用户事件,初始化IM用户种子 - /// - /// - /// - [UnitOfWork] - public async virtual Task HandleEventAsync(EntityCreatedEventData eventData) - { - await SeedChatDataAsync(eventData.Entity); - - await SeedUserSubscriptionNotifiersAsync(eventData.Entity); - } - - protected async virtual Task SeedChatDataAsync(IUserData user) - { - await _chatDataSeeder.SeedAsync(user); - } - - protected async virtual Task SeedUserSubscriptionNotifiersAsync(IUserData user) - { - var userIdentifier = new UserIdentifier(user.Id, user.UserName); - - await _notificationSubscriptionManager - .SubscribeAsync( - user.TenantId, - userIdentifier, - MessageServiceNotificationNames.IM.FriendValidation); - - await _notificationSubscriptionManager - .SubscribeAsync( - user.TenantId, - userIdentifier, - MessageServiceNotificationNames.IM.NewFriend); - } - } -} diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/EventBus/Local/UserCreateSendWelcomeEventHandler.cs b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/EventBus/Local/UserCreateSendWelcomeEventHandler.cs deleted file mode 100644 index 8176df498..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/EventBus/Local/UserCreateSendWelcomeEventHandler.cs +++ /dev/null @@ -1,69 +0,0 @@ -using LINGYUN.Abp.Notifications; -using Volo.Abp.DependencyInjection; -using Volo.Abp.Domain.Entities.Events; -using Volo.Abp.EventBus; -using Volo.Abp.Users; - -namespace PackageName.CompanyName.ProjectName.AIO.Host.EventBus.Local -{ - public class UserCreateSendWelcomeEventHandler : ILocalEventHandler>, ITransientDependency - { - private readonly INotificationSender _notificationSender; - private readonly INotificationSubscriptionManager _notificationSubscriptionManager; - public UserCreateSendWelcomeEventHandler( - INotificationSender notificationSender, - INotificationSubscriptionManager notificationSubscriptionManager - ) - { - _notificationSender = notificationSender; - _notificationSubscriptionManager = notificationSubscriptionManager; - } - - public async Task HandleEventAsync(EntityCreatedEventData eventData) - { - var userIdentifer = new UserIdentifier(eventData.Entity.Id, eventData.Entity.UserName); - // 订阅用户欢迎消息 - await SubscribeInternalNotifers(userIdentifer, eventData.Entity.TenantId); - - await _notificationSender.SendNofiterAsync( - UserNotificationNames.WelcomeToApplication, - new NotificationTemplate( - UserNotificationNames.WelcomeToApplication, - formUser: eventData.Entity.UserName, - data: new Dictionary - { - { "name", eventData.Entity.UserName }, - }), - userIdentifer, - eventData.Entity.TenantId, - NotificationSeverity.Info); - } - - private async Task SubscribeInternalNotifers(UserIdentifier userIdentifer, Guid? tenantId = null) - { - // 订阅内置通知 - await _notificationSubscriptionManager - .SubscribeAsync( - tenantId, - userIdentifer, - DefaultNotifications.SystemNotice); - await _notificationSubscriptionManager - .SubscribeAsync( - tenantId, - userIdentifer, - DefaultNotifications.OnsideNotice); - await _notificationSubscriptionManager - .SubscribeAsync( - tenantId, - userIdentifer, - DefaultNotifications.ActivityNotice); - - // 订阅用户欢迎消息 - await _notificationSubscriptionManager - .SubscribeAsync( - tenantId, - userIdentifer, - UserNotificationNames.WelcomeToApplication); - } - } -} diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/IdentityResources/CustomIdentityResources.cs b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/IdentityResources/CustomIdentityResources.cs deleted file mode 100644 index 99fce8c22..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/IdentityResources/CustomIdentityResources.cs +++ /dev/null @@ -1,19 +0,0 @@ -using LINGYUN.Abp.Identity; -using IdentityServer4.Models; - -namespace PackageName.CompanyName.ProjectName.AIO.Host.IdentityResources; - -public class CustomIdentityResources -{ - public class AvatarUrl : IdentityResource - { - public AvatarUrl() - { - Name = IdentityConsts.ClaimType.Avatar.Name; - DisplayName = IdentityConsts.ClaimType.Avatar.DisplayName; - Description = IdentityConsts.ClaimType.Avatar.Description; - Emphasize = true; - UserClaims = new string[] { IdentityConsts.ClaimType.Avatar.Name }; - } - } -} diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/MicroServiceApplicationsSingleModule.Configure.cs b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/MicroServiceApplicationsSingleModule.Configure.cs deleted file mode 100644 index cbc4e883a..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/MicroServiceApplicationsSingleModule.Configure.cs +++ /dev/null @@ -1,935 +0,0 @@ -using Elsa; -using Elsa.Options; -using LINGYUN.Abp.Aliyun.Localization; -using LINGYUN.Abp.BackgroundTasks; -using LINGYUN.Abp.DataProtectionManagement; -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; -using LINGYUN.Abp.Localization.CultureMap; -using LINGYUN.Abp.Notifications; -using LINGYUN.Abp.OpenIddict.AspNetCore.Session; -using LINGYUN.Abp.OpenIddict.LinkUser; -using LINGYUN.Abp.OpenIddict.Permissions; -using LINGYUN.Abp.OpenIddict.Portal; -using LINGYUN.Abp.OpenIddict.Sms; -using LINGYUN.Abp.OpenIddict.WeChat; -using LINGYUN.Abp.Saas; -using LINGYUN.Abp.Serilog.Enrichers.Application; -using LINGYUN.Abp.Serilog.Enrichers.UniqueId; -using LINGYUN.Abp.Tencent.Localization; -using LINGYUN.Abp.TextTemplating; -using LINGYUN.Abp.WebhooksManagement; -using LINGYUN.Abp.WeChat.Common.Messages.Handlers; -using LINGYUN.Abp.WeChat.Localization; -using LINGYUN.Abp.WeChat.Work; -using LINGYUN.Abp.Wrapper; -using LINGYUN.Platform.Localization; -using PackageName.CompanyName.ProjectName.AIO.Host.Microsoft.Extensions.DependencyInjection; -using Medallion.Threading; -using Medallion.Threading.Redis; -using Microsoft.AspNetCore.Authentication.Cookies; -using Microsoft.AspNetCore.Authentication.JwtBearer; -using Microsoft.AspNetCore.Cors; -using Microsoft.AspNetCore.DataProtection; -using Microsoft.AspNetCore.Identity; -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 PackageName.CompanyName.ProjectName.AIO.Host.Authentication; -using PackageName.CompanyName.ProjectName.AIO.Host.IdentityResources; -using PackageName.CompanyName.ProjectName.AIO.Host.WeChat.Official.Messages; -using Quartz; -using StackExchange.Redis; -using System.Security.Cryptography; -using System.Security.Cryptography.X509Certificates; -using System.Text.Encodings.Web; -using System.Text.Unicode; -using Volo.Abp; -using Volo.Abp.AspNetCore.Mvc; -using Volo.Abp.AspNetCore.Mvc.AntiForgery; -using Volo.Abp.AspNetCore.Mvc.UI.Bundling; -using Volo.Abp.Auditing; -using Volo.Abp.Authorization.Permissions; -using Volo.Abp.BlobStoring; -using Volo.Abp.BlobStoring.FileSystem; -using Volo.Abp.Caching; -using Volo.Abp.EntityFrameworkCore; -using Volo.Abp.FeatureManagement; -using Volo.Abp.Features; -using Volo.Abp.GlobalFeatures; -using Volo.Abp.Http.Client; -using Volo.Abp.Identity.Localization; -using Volo.Abp.IdentityServer; -using Volo.Abp.IdentityServer.Localization; -using Volo.Abp.Json; -using Volo.Abp.Json.SystemTextJson; -using Volo.Abp.Localization; -using Volo.Abp.MultiTenancy; -using Volo.Abp.OpenIddict; -using Volo.Abp.OpenIddict.Localization; -using Volo.Abp.PermissionManagement; -using Volo.Abp.Quartz; -using Volo.Abp.Security.Claims; -using Volo.Abp.SettingManagement; -using Volo.Abp.SettingManagement.Localization; -using Volo.Abp.Threading; -using Volo.Abp.UI.Navigation.Urls; -using Volo.Abp.VirtualFileSystem; -using VoloAbpExceptionHandlingOptions = Volo.Abp.AspNetCore.ExceptionHandling.AbpExceptionHandlingOptions; - -namespace PackageName.CompanyName.ProjectName.AIO.Host; - -public partial class MicroServiceApplicationsSingleModule -{ - protected const string DefaultCorsPolicyName = "Default"; - public static string ApplicationName { get; set; } = "MicroService-Applications-Single"; - private readonly static OneTimeRunner OneTimeRunner = new(); - - private void PreConfigureFeature() - { - OneTimeRunner.Run(() => - { - GlobalFeatureManager.Instance.Modules.Editions().EnableAll(); - }); - } - - private void PreConfigureApp(IConfiguration configuration) - { - AbpSerilogEnrichersConsts.ApplicationName = ApplicationName; - - PreConfigure(options => - { - // 以开放端口区别,应在0-31之间 - options.SnowflakeIdOptions.WorkerId = 1; - options.SnowflakeIdOptions.WorkerIdBits = 5; - options.SnowflakeIdOptions.DatacenterId = 1; - }); - - if (configuration.GetValue("App:ShowPii")) - { - IdentityModelEventSource.ShowPII = true; - } - } - - private void PreConfigureAuthServer(IConfiguration configuration) - { - PreConfigure(builder => - { - builder.AddValidation(options => - { - //options.AddAudiences("lingyun-abp-application"); - - options.UseLocalServer(); - - options.UseAspNetCore(); - - options.UseDataProtection(); - }); - }); - } - - private void PreConfigureIdentity() - { - PreConfigure(builder => - { - builder.AddDefaultTokenProviders(); - }); - } - - private void PreConfigureCertificate(IConfiguration configuration, IWebHostEnvironment environment) - { - var cerConfig = configuration.GetSection("Certificates"); - if (environment.IsProduction() && cerConfig.Exists()) - { - // 开发环境下存在证书配置 - // 且证书文件存在则使用自定义的证书文件来启动Ids服务器 - var cerPath = Path.Combine(environment.ContentRootPath, cerConfig["CerPath"]); - if (File.Exists(cerPath)) - { - var certificate = new X509Certificate2(cerPath, cerConfig["Password"]); - - if (configuration.GetValue("AuthServer:UseOpenIddict")) - { - PreConfigure(options => - { - //https://documentation.openiddict.com/configuration/encryption-and-signing-credentials.html - options.AddDevelopmentEncryptionAndSigningCertificate = false; - }); - - PreConfigure(builder => - { - builder.AddSigningCertificate(certificate); - builder.AddEncryptionCertificate(certificate); - - builder.UseDataProtection(); - - // 禁用https - builder.UseAspNetCore() - .DisableTransportSecurityRequirement(); - }); - } - else - { - PreConfigure(options => - { - options.AddDeveloperSigningCredential = false; - }); - - PreConfigure(builder => - { - builder.AddSigningCredential(certificate); - }); - } - } - } - else - { - if (configuration.GetValue("AuthServer:UseOpenIddict")) - { - PreConfigure(options => - { - //https://documentation.openiddict.com/configuration/encryption-and-signing-credentials.html - options.AddDevelopmentEncryptionAndSigningCertificate = false; - }); - - PreConfigure(builder => - { - //https://documentation.openiddict.com/configuration/encryption-and-signing-credentials.html - using (var algorithm = RSA.Create(keySizeInBits: 2048)) - { - var subject = new X500DistinguishedName("CN=Fabrikam Encryption Certificate"); - var request = new CertificateRequest(subject, algorithm, HashAlgorithmName.SHA256, RSASignaturePadding.Pkcs1); - request.CertificateExtensions.Add(new X509KeyUsageExtension(X509KeyUsageFlags.DigitalSignature, critical: true)); - var certificate = request.CreateSelfSigned(DateTimeOffset.UtcNow, DateTimeOffset.UtcNow.AddYears(2)); - builder.AddSigningCertificate(certificate); - } - - using (var algorithm = RSA.Create(keySizeInBits: 2048)) - { - var subject = new X500DistinguishedName("CN=Fabrikam Signing Certificate"); - var request = new CertificateRequest(subject, algorithm, HashAlgorithmName.SHA256, RSASignaturePadding.Pkcs1); - request.CertificateExtensions.Add(new X509KeyUsageExtension(X509KeyUsageFlags.KeyEncipherment, critical: true)); - var certificate = request.CreateSelfSigned(DateTimeOffset.UtcNow, DateTimeOffset.UtcNow.AddYears(2)); - builder.AddEncryptionCertificate(certificate); - } - - builder.UseDataProtection(); - - // 禁用https - builder.UseAspNetCore() - .DisableTransportSecurityRequirement(); - }); - } - } - } - - private void PreConfigureQuartz(IConfiguration configuration) - { - PreConfigure(options => - { - // 如果使用持久化存储, 则配置quartz持久层 - if (configuration.GetSection("Quartz:UsePersistentStore").Get()) - { - var settings = configuration.GetSection("Quartz:Properties").Get>(); - if (settings != null) - { - foreach (var setting in settings) - { - options.Properties[setting.Key] = setting.Value; - } - } - - options.Configurator += (config) => - { - config.UsePersistentStore(store => - { - store.UseProperties = false; - store.UseNewtonsoftJsonSerializer(); - }); - }; - } - }); - } - - private void PreConfigureElsa(IServiceCollection services, IConfiguration configuration) - { - var elsaSection = configuration.GetSection("Elsa"); - var startups = new[] - { - typeof(Elsa.Activities.Console.Startup), - typeof(Elsa.Activities.Http.Startup), - typeof(Elsa.Activities.UserTask.Startup), - typeof(Elsa.Activities.Temporal.Quartz.Startup), - typeof(Elsa.Activities.Email.Startup), - typeof(Elsa.Scripting.JavaScript.Startup), - typeof(Elsa.Activities.Webhooks.Startup), - }; - - PreConfigure(elsa => - { - elsa - .AddActivitiesFrom() - .AddWorkflowsFrom() - .AddFeatures(startups, configuration) - .ConfigureWorkflowChannels(options => elsaSection.GetSection("WorkflowChannels").Bind(options)); - - elsa.DistributedLockingOptionsBuilder - .UseProviderFactory(sp => name => - { - var provider = sp.GetRequiredService(); - - return provider.CreateLock(name); - }); - }); - - services.AddNotificationHandlersFrom(); - - PreConfigure(mvcBuilder => - { - mvcBuilder.AddApplicationPartIfNotExists(typeof(Elsa.Webhooks.Api.Endpoints.List).Assembly); - }); - } - - private void ConfigureAuthServer(IConfiguration configuration) - { - Configure(builder => - { - builder.DisableTransportSecurityRequirement(); - }); - - Configure(options => - { - options.DisableTransportSecurityRequirement = true; - }); - - Configure(options => - { - var lifetime = configuration.GetSection("OpenIddict:Lifetime"); - options.AuthorizationCodeLifetime = lifetime.GetValue("AuthorizationCode", options.AuthorizationCodeLifetime); - options.AccessTokenLifetime = lifetime.GetValue("AccessToken", options.AccessTokenLifetime); - options.DeviceCodeLifetime = lifetime.GetValue("DeviceCode", options.DeviceCodeLifetime); - options.IdentityTokenLifetime = lifetime.GetValue("IdentityToken", options.IdentityTokenLifetime); - options.RefreshTokenLifetime = lifetime.GetValue("RefreshToken", options.RefreshTokenLifetime); - options.RefreshTokenReuseLeeway = lifetime.GetValue("RefreshTokenReuseLeeway", options.RefreshTokenReuseLeeway); - options.UserCodeLifetime = lifetime.GetValue("UserCode", options.UserCodeLifetime); - }); - Configure(options => - { - options.PersistentSessionGrantTypes.Add(SmsTokenExtensionGrantConsts.GrantType); - options.PersistentSessionGrantTypes.Add(PortalTokenExtensionGrantConsts.GrantType); - options.PersistentSessionGrantTypes.Add(LinkUserTokenExtensionGrantConsts.GrantType); - options.PersistentSessionGrantTypes.Add(WeChatTokenExtensionGrantConsts.OfficialGrantType); - options.PersistentSessionGrantTypes.Add(WeChatTokenExtensionGrantConsts.MiniProgramGrantType); - options.PersistentSessionGrantTypes.Add(AbpWeChatWorkGlobalConsts.GrantType); - }); - } - - private void ConfigureEndpoints(IServiceCollection services) - { - // 不需要 - //Configure(options => - //{ - // options.EndpointConfigureActions.Add( - // (context) => - // { - // context.Endpoints.MapFallbackToPage("/_Host"); - // }); - //}); - var preActions = services.GetPreConfigureActions(); - - services.AddAbpApiVersioning(options => - { - options.ReportApiVersions = true; - options.AssumeDefaultVersionWhenUnspecified = true; - - //options.ApiVersionReader = new HeaderApiVersionReader("api-version"); //Supports header too - //options.ApiVersionReader = new MediaTypeApiVersionReader(); //Supports accept header too - }, mvcOptions => - { - mvcOptions.ConfigureAbp(preActions.Configure()); - }); - - //services.AddApiVersioning(config => - //{ - // // Specify the default API Version as 1.0 - // config.DefaultApiVersion = new ApiVersion(1, 0); - // // Advertise the API versions supported for the particular endpoint (through 'api-supported-versions' response header which lists all available API versions for that endpoint) - // config.ReportApiVersions = true; - //}); - - //services.AddVersionedApiExplorer(options => - //{ - // // add the versioned api explorer, which also adds IApiVersionDescriptionProvider service - // // note: the specified format code will format the version as "'v'major[.minor][-status]" - // options.GroupNameFormat = "'v'VVV"; - - // // note: this option is only necessary when versioning by url segment. the SubstitutionFormat - // // can also be used to control the format of the API version in route templates - // options.SubstituteApiVersionInUrl = true; - //}); - } - - private void ConfigureKestrelServer() - { - Configure(options => - { - options.Limits.MaxRequestBodySize = null; - options.Limits.MaxRequestBufferSize = null; - }); - } - - private void ConfigureBlobStoring(IConfiguration configuration) - { - Configure(options => - { - options.Containers.ConfigureAll((containerName, containerConfiguration) => - { - containerConfiguration.UseFileSystem(fileSystem => - { - fileSystem.BasePath = Path.Combine(Directory.GetCurrentDirectory(), "blobs"); - }); - - //containerConfiguration.UseMinio(minio => - //{ - // configuration.GetSection("Minio").Bind(minio); - //}); - }); - }); - } - - private void ConfigureBackgroundTasks() - { - Configure(options => - { - options.NodeName = ApplicationName; - options.JobCleanEnabled = true; - options.JobFetchEnabled = true; - options.JobCheckEnabled = true; - }); - } - - private void ConfigureTextTemplating(IConfiguration configuration) - { - if (configuration.GetValue("TextTemplating:IsDynamicStoreEnabled")) - { - Configure(options => - { - options.IsDynamicTemplateDefinitionStoreEnabled = true; - }); - } - } - - private void ConfigureFeatureManagement(IConfiguration configuration) - { - if (configuration.GetValue("FeatureManagement:IsDynamicStoreEnabled")) - { - Configure(options => - { - options.IsDynamicFeatureStoreEnabled = true; - }); - } - Configure(options => - { - options.ProviderPolicies[EditionFeatureValueProvider.ProviderName] = AbpSaasPermissions.Editions.ManageFeatures; - options.ProviderPolicies[TenantFeatureValueProvider.ProviderName] = AbpSaasPermissions.Tenants.ManageFeatures; - }); - } - - private void ConfigureSettingManagement(IConfiguration configuration) - { - if (configuration.GetValue("SettingManagement:IsDynamicStoreEnabled")) - { - Configure(options => - { - options.IsDynamicSettingStoreEnabled = true; - }); - } - } - - private void ConfigureWebhooksManagement(IConfiguration configuration) - { - if (configuration.GetValue("WebhooksManagement:IsDynamicStoreEnabled")) - { - Configure(options => - { - options.IsDynamicWebhookStoreEnabled = true; - }); - } - } - /// - /// 配置数据导出 - /// - 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) - { - if (configuration.GetValue("PermissionManagement:IsDynamicStoreEnabled")) - { - Configure(options => - { - options.IsDynamicPermissionStoreEnabled = true; - }); - } - Configure(options => - { - // Rename IdentityServer.Client.ManagePermissions - // See https://github.com/abpframework/abp/blob/dev/modules/identityserver/src/Volo.Abp.PermissionManagement.Domain.IdentityServer/Volo/Abp/PermissionManagement/IdentityServer/AbpPermissionManagementDomainIdentityServerModule.cs - options.ProviderPolicies[ClientPermissionValueProvider.ProviderName] = AbpOpenIddictPermissions.Applications.ManagePermissions; - - //if (configuration.GetValue("AuthServer:UseOpenIddict")) - //{ - // options.ProviderPolicies[ClientPermissionValueProvider.ProviderName] = AbpOpenIddictPermissions.Applications.ManagePermissions; - //} - //else - //{ - // options.ProviderPolicies[ClientPermissionValueProvider.ProviderName] = AbpIdentityServerPermissions.Clients.ManagePermissions; - //} - }); - } - - private void ConfigureNotificationManagement(IConfiguration configuration) - { - if (configuration.GetValue("NotificationsManagement:IsDynamicStoreEnabled")) - { - Configure(options => - { - options.IsDynamicNotificationsStoreEnabled = true; - }); - } - } - - private void ConfigureDistributedLock(IServiceCollection services, IConfiguration configuration) - { - var distributedLockEnabled = configuration["DistributedLock:IsEnabled"]; - if (distributedLockEnabled.IsNullOrEmpty() || bool.Parse(distributedLockEnabled)) - { - var redis = ConnectionMultiplexer.Connect(configuration["DistributedLock:Redis:Configuration"]); - services.AddSingleton(_ => new RedisDistributedSynchronizationProvider(redis.GetDatabase())); - } - } - - private void ConfigureVirtualFileSystem() - { - Configure(options => - { - options.FileSets.AddEmbedded("LY.MicroService.Applications.Single"); - }); - } - - private void ConfigureIdempotent() - { - Configure(options => - { - options.IsEnabled = true; - options.DefaultTimeout = 0; - }); - } - - private void ConfigureDbContext() - { - Configure(options => - { - // AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);//解决PostgreSql设置为utc时间后无法写入local时区的问题 - // options.UseNpgsql(); - - options.UseMySQL(); - }); - } - - private void ConfigureDataSeeder() - { - Configure(options => - { - options.Resources.Add(new CustomIdentityResources.AvatarUrl()); - }); - } - - private void ConfigureExceptionHandling() - { - // 自定义需要处理的异常 - Configure(options => - { - // 加入需要处理的异常类型 - options.Handlers.Add(); - options.Handlers.Add(); - options.Handlers.Add(); - options.Handlers.Add(); - options.Handlers.Add(); - options.Handlers.Add(); - }); - // 自定义需要发送邮件通知的异常类型 - Configure(options => - { - // 是否发送堆栈信息 - options.SendStackTrace = true; - // 未指定异常接收者的默认接收邮件 - // 指定自己的邮件地址 - }); - - Configure(options => - { - options.SendStackTraceToClients = false; - options.SendExceptionsDetailsToClients = false; - }); - } - - private void ConfigureJsonSerializer(IConfiguration configuration) - { - // 统一时间日期格式 - Configure(options => - { - var jsonConfiguration = configuration.GetSection("Json"); - if (jsonConfiguration.Exists()) - { - jsonConfiguration.Bind(options); - } - }); - // 中文序列化的编码问题 - Configure(options => - { - options.JsonSerializerOptions.Encoder = JavaScriptEncoder.Create(UnicodeRanges.All); - }); - } - - private void ConfigureCaching(IConfiguration configuration) - { - Configure(options => - { - configuration.GetSection("DistributedCache").Bind(options); - }); - - Configure(options => - { - var redisConfig = ConfigurationOptions.Parse(options.Configuration); - options.ConfigurationOptions = redisConfig; - options.InstanceName = configuration["Redis:InstanceName"]; - }); - } - - private void ConfigureMultiTenancy(IConfiguration configuration) - { - // 多租户 - Configure(options => - { - options.IsEnabled = true; - }); - - var tenantResolveCfg = configuration.GetSection("App:Domains"); - if (tenantResolveCfg.Exists()) - { - Configure(options => - { - var domains = tenantResolveCfg.Get(); - foreach (var domain in domains) - { - options.AddDomainTenantResolver(domain); - } - }); - } - } - - private void ConfigureAuditing(IConfiguration configuration) - { - Configure(options => - { - options.ApplicationName = ApplicationName; - // 是否启用实体变更记录 - var allEntitiesSelectorIsEnabled = configuration["Auditing:AllEntitiesSelector"]; - if (allEntitiesSelectorIsEnabled.IsNullOrWhiteSpace() || - (bool.TryParse(allEntitiesSelectorIsEnabled, out var enabled) && enabled)) - { - options.EntityHistorySelectors.AddAllEntities(); - } - }); - } - - private void ConfigureSwagger(IServiceCollection services) - { - // Swagger - services.AddSwaggerGen( - options => - { - options.SwaggerDoc("v1", new OpenApiInfo { Title = "App API", Version = "v1" }); - options.DocInclusionPredicate((docName, description) => true); - options.CustomSchemaIds(type => type.FullName); - options.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme - { - Description = "JWT Authorization header using the Bearer scheme. Example: \"Authorization: Bearer {token}\"", - Name = "Authorization", - In = ParameterLocation.Header, - Scheme = "bearer", - Type = SecuritySchemeType.Http, - BearerFormat = "JWT" - }); - options.AddSecurityRequirement(new OpenApiSecurityRequirement - { - { - new OpenApiSecurityScheme - { - Reference = new OpenApiReference { Type = ReferenceType.SecurityScheme, Id = "Bearer" } - }, - new string[] { } - } - }); - options.OperationFilter(); - }); - } - - private void ConfigureIdentity(IConfiguration configuration) - { - // 增加配置文件定义,在新建租户时需要 - Configure(options => - { - var identityConfiguration = configuration.GetSection("Identity"); - if (identityConfiguration.Exists()) - { - identityConfiguration.Bind(options); - } - }); - Configure(options => - { - options.IsDynamicClaimsEnabled = true; - }); - Configure(options => - { - options.IsCleanupEnabled = true; - }); - } - - private void ConfigureMvcUiTheme() - { - Configure(options => - { - //options.StyleBundles.Configure( - // LeptonXLiteThemeBundles.Styles.Global, - // bundle => - // { - // bundle.AddFiles("/global-styles.css"); - // } - //); - }); - } - - private void ConfigureLocalization() - { - Configure(options => - { - options.Languages.Add(new LanguageInfo("en", "en", "English")); - options.Languages.Add(new LanguageInfo("zh-Hans", "zh-Hans", "简体中文")); - - options - .AddLanguagesMapOrUpdate( - "vue-admin-element-ui", - new NameValue("zh-Hans", "zh"), - new NameValue("en", "en")); - - // vben admin 语言映射 - options - .AddLanguagesMapOrUpdate( - "vben-admin-ui", - new NameValue("zh_CN", "zh-Hans")); - - options.Resources.Get() - .AddBaseTypes( - typeof(IdentityResource), - typeof(AliyunResource), - typeof(TencentCloudResource), - typeof(WeChatResource), - typeof(PlatformResource), - typeof(AbpOpenIddictResource), - typeof(AbpIdentityServerResource)); - - options.UseAllPersistence(); - }); - - Configure(options => - { - var zhHansCultureMapInfo = new CultureMapInfo - { - TargetCulture = "zh-Hans", - SourceCultures = new string[] { "zh", "zh_CN", "zh-CN" } - }; - - options.CulturesMaps.Add(zhHansCultureMapInfo); - options.UiCulturesMaps.Add(zhHansCultureMapInfo); - }); - } - - private void ConfigureWrapper() - { - Configure(options => - { - options.IsEnabled = true; - // options.IsWrapUnauthorizedEnabled = true; - options.IgnoreNamespaces.Add("Elsa"); - }); - } - - private void PreConfigureWrapper() - { - //PreConfigure(options => - //{ - // options.ProxyRequestActions.Add( - // (appid, httprequestmessage) => - // { - // httprequestmessage.Headers.TryAddWithoutValidation(AbpHttpWrapConsts.AbpDontWrapResult, "true"); - // }); - //}); - - PreConfigure(options => - { - options.ProxyClientActions.Add( - (_, _, client) => - { - client.DefaultRequestHeaders.TryAddWithoutValidation(AbpHttpWrapConsts.AbpDontWrapResult, "true"); - }); - }); - } - - private void ConfigureAuditing() - { - Configure(options => - { - // options.IsEnabledForGetRequests = true; - options.ApplicationName = ApplicationName; - }); - } - - private void ConfigureUrls(IConfiguration configuration) - { - Configure(options => - { - var applicationConfiguration = configuration.GetSection("App:Urls:Applications"); - foreach (var appConfig in applicationConfiguration.GetChildren()) - { - options.Applications[appConfig.Key].RootUrl = appConfig["RootUrl"]; - foreach (var urlsConfig in appConfig.GetSection("Urls").GetChildren()) - { - options.Applications[appConfig.Key].Urls[urlsConfig.Key] = urlsConfig.Value; - } - } - }); - } - - private void ConfigureSecurity(IServiceCollection services, IConfiguration configuration, bool isDevelopment = false) - { - Configure(options => - { - options.AutoValidate = false; - }); - - services.Replace(ServiceLifetime.Scoped); - - services.AddAuthentication() - .AddAbpJwtBearer(options => - { - configuration.GetSection("AuthServer").Bind(options); - - options.Events ??= new JwtBearerEvents(); - options.Events.OnMessageReceived = context => - { - 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; - }; - }); - - if (!isDevelopment) - { - var redis = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]); - services - .AddDataProtection() - .SetApplicationName("LINGYUN.Abp.Application") - .PersistKeysToStackExchangeRedis(redis, "LINGYUN.Abp.Application:DataProtection:Protection-Keys"); - } - - services.AddSameSiteCookiePolicy(); - } - - private void ConfigureCors(IServiceCollection services, IConfiguration configuration) - { - services.AddCors(options => - { - options.AddPolicy(DefaultCorsPolicyName, builder => - { - builder - .WithOrigins( - configuration["App:CorsOrigins"] - .Split(",", StringSplitOptions.RemoveEmptyEntries) - .Select(o => o.RemovePostFix("/")) - .ToArray() - ) - .WithAbpExposedHeaders() - .WithAbpWrapExposedHeaders() - .SetIsOriginAllowedToAllowWildcardSubdomains() - .AllowAnyHeader() - .AllowAnyMethod() - .AllowCredentials(); - }); - }); - } - - private void ConfigureWeChat() - { - Configure(options => - { - // 回复文本消息 - options.MapMessage< - LINGYUN.Abp.WeChat.Official.Messages.Models.TextMessage, - TextMessageReplyContributor>(); - // 处理关注事件 - options.MapEvent< - LINGYUN.Abp.WeChat.Official.Messages.Models.UserSubscribeEvent, - UserSubscribeEventContributor>(); - - options.MapMessage< - LINGYUN.Abp.WeChat.Work.Common.Messages.Models.TextMessage, - WeChat.Work.Messages.TextMessageReplyContributor>(); - }); - } -} diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/MicroServiceApplicationsSingleModule.cs b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/MicroServiceApplicationsSingleModule.cs deleted file mode 100644 index ceb61611a..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/MicroServiceApplicationsSingleModule.cs +++ /dev/null @@ -1,394 +0,0 @@ -using LINGYUN.Abp.Account; -using LINGYUN.Abp.Account.Templates; -using LINGYUN.Abp.Aliyun.SettingManagement; -using LINGYUN.Abp.AspNetCore.HttpOverrides; -using LINGYUN.Abp.AspNetCore.Mvc.Idempotent.Wrapper; -using LINGYUN.Abp.AspNetCore.Mvc.Localization; -using LINGYUN.Abp.AspNetCore.Mvc.Wrapper; -using LINGYUN.Abp.Auditing; -using LINGYUN.Abp.AuditLogging.EntityFrameworkCore; -using LINGYUN.Abp.Authentication.QQ; -using LINGYUN.Abp.Authentication.WeChat; -using LINGYUN.Abp.Authorization.OrganizationUnits; -using LINGYUN.Abp.BackgroundTasks; -using LINGYUN.Abp.BackgroundTasks.Activities; -using LINGYUN.Abp.BackgroundTasks.DistributedLocking; -using LINGYUN.Abp.BackgroundTasks.EventBus; -using LINGYUN.Abp.BackgroundTasks.ExceptionHandling; -using LINGYUN.Abp.BackgroundTasks.Jobs; -using LINGYUN.Abp.BackgroundTasks.Notifications; -using LINGYUN.Abp.BackgroundTasks.Quartz; -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.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; -using LINGYUN.Abp.Features.LimitValidation.Redis.Client; -using LINGYUN.Abp.Http.Client.Wrapper; -using LINGYUN.Abp.Identity; -using LINGYUN.Abp.Identity.AspNetCore.Session; -using LINGYUN.Abp.Identity.EntityFrameworkCore; -using LINGYUN.Abp.Identity.Notifications; -using LINGYUN.Abp.Identity.OrganizaztionUnits; -using LINGYUN.Abp.Identity.Session.AspNetCore; -using LINGYUN.Abp.Identity.WeChat; -using LINGYUN.Abp.IdGenerator; -using LINGYUN.Abp.IM.SignalR; -using LINGYUN.Abp.Localization.CultureMap; -using LINGYUN.Abp.Localization.Persistence; -using LINGYUN.Abp.LocalizationManagement; -using LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore; -using LINGYUN.Abp.MessageService; -using LINGYUN.Abp.MessageService.EntityFrameworkCore; -using LINGYUN.Abp.MultiTenancy.Editions; -using LINGYUN.Abp.Notifications; -using LINGYUN.Abp.Notifications.Common; -using LINGYUN.Abp.Notifications.Emailing; -using LINGYUN.Abp.Notifications.EntityFrameworkCore; -using LINGYUN.Abp.Notifications.SignalR; -using LINGYUN.Abp.Notifications.WeChat.MiniProgram; -using LINGYUN.Abp.OpenApi.Authorization; -using LINGYUN.Abp.OpenIddict; -using LINGYUN.Abp.OpenIddict.AspNetCore; -using LINGYUN.Abp.OpenIddict.AspNetCore.Session; -using LINGYUN.Abp.OpenIddict.Portal; -using LINGYUN.Abp.OpenIddict.Sms; -using LINGYUN.Abp.OpenIddict.WeChat; -using LINGYUN.Abp.OpenIddict.WeChat.Work; -using LINGYUN.Abp.OssManagement; -using LINGYUN.Abp.OssManagement.FileSystem; -// using LINGYUN.Abp.OssManagement.Imaging; -using LINGYUN.Abp.OssManagement.SettingManagement; -using LINGYUN.Abp.PermissionManagement; -using LINGYUN.Abp.PermissionManagement.HttpApi; -using LINGYUN.Abp.PermissionManagement.OrganizationUnits; -using LINGYUN.Abp.Saas; -using LINGYUN.Abp.Saas.EntityFrameworkCore; -using LINGYUN.Abp.Serilog.Enrichers.Application; -using LINGYUN.Abp.Serilog.Enrichers.UniqueId; -using LINGYUN.Abp.SettingManagement; -using LINGYUN.Abp.Sms.Aliyun; -using LINGYUN.Abp.TaskManagement; -using LINGYUN.Abp.TaskManagement.EntityFrameworkCore; -using LINGYUN.Abp.Tencent.QQ; -using LINGYUN.Abp.Tencent.SettingManagement; -using LINGYUN.Abp.TextTemplating; -using LINGYUN.Abp.TextTemplating.EntityFrameworkCore; -using LINGYUN.Abp.UI.Navigation; -using LINGYUN.Abp.UI.Navigation.VueVbenAdmin; -using LINGYUN.Abp.Webhooks; -using LINGYUN.Abp.Webhooks.EventBus; -using LINGYUN.Abp.Webhooks.Identity; -using LINGYUN.Abp.Webhooks.Saas; -using LINGYUN.Abp.WebhooksManagement; -using LINGYUN.Abp.WebhooksManagement.EntityFrameworkCore; -using LINGYUN.Abp.WeChat.MiniProgram; -using LINGYUN.Abp.WeChat.Official; -using LINGYUN.Abp.WeChat.Official.Handlers; -using LINGYUN.Abp.WeChat.SettingManagement; -using LINGYUN.Abp.WeChat.Work; -using LINGYUN.Abp.WeChat.Work.Handlers; -using LINGYUN.Platform; -using LINGYUN.Platform.EntityFrameworkCore; -using LINGYUN.Platform.HttpApi; -using LINGYUN.Platform.Settings.VueVbenAdmin; -using LINGYUN.Platform.Theme.VueVbenAdmin; -using Volo.Abp; -using Volo.Abp.Account.Web; -using Volo.Abp.AspNetCore.Authentication.JwtBearer; -using Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy; -using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic; -using Volo.Abp.AspNetCore.Serilog; -using Volo.Abp.Autofac; -using Volo.Abp.Caching.StackExchangeRedis; -using Volo.Abp.Data; -using Volo.Abp.EntityFrameworkCore.PostgreSql; -using Volo.Abp.EventBus; -using Volo.Abp.FeatureManagement.EntityFrameworkCore; -using Volo.Abp.Imaging; -using Volo.Abp.Modularity; -using Volo.Abp.OpenIddict.EntityFrameworkCore; -using Volo.Abp.PermissionManagement.EntityFrameworkCore; -using Volo.Abp.PermissionManagement.Identity; -using Volo.Abp.PermissionManagement.OpenIddict; -using Volo.Abp.SettingManagement; -using Volo.Abp.SettingManagement.EntityFrameworkCore; -using Volo.Abp.Threading; -// using LINGYUN.Abp.Elsa.EntityFrameworkCore.MySql; -using Volo.Abp.EntityFrameworkCore.MySQL; - -namespace PackageName.CompanyName.ProjectName.AIO.Host; - -[DependsOn( - typeof(AbpAccountApplicationModule), - typeof(AbpAccountHttpApiModule), - typeof(AbpAccountWebOpenIddictModule), - typeof(AbpAuditingApplicationModule), - typeof(AbpAuditingHttpApiModule), - typeof(AbpAuditLoggingEntityFrameworkCoreModule), - typeof(AbpCachingManagementStackExchangeRedisModule), - typeof(AbpCachingManagementApplicationModule), - typeof(AbpCachingManagementHttpApiModule), - typeof(AbpIdentityAspNetCoreSessionModule), - typeof(AbpIdentitySessionAspNetCoreModule), - typeof(AbpIdentityNotificationsModule), - typeof(AbpIdentityDomainModule), - typeof(AbpIdentityApplicationModule), - typeof(AbpIdentityHttpApiModule), - typeof(AbpIdentityEntityFrameworkCoreModule), - typeof(AbpLocalizationManagementDomainModule), - typeof(AbpLocalizationManagementApplicationModule), - typeof(AbpLocalizationManagementHttpApiModule), - typeof(AbpLocalizationManagementEntityFrameworkCoreModule), - typeof(AbpSerilogEnrichersApplicationModule), - typeof(AbpSerilogEnrichersUniqueIdModule), - typeof(AbpMessageServiceDomainModule), - typeof(AbpMessageServiceApplicationModule), - typeof(AbpMessageServiceHttpApiModule), - typeof(AbpMessageServiceEntityFrameworkCoreModule), - typeof(AbpNotificationsDomainModule), - typeof(AbpNotificationsApplicationModule), - typeof(AbpNotificationsHttpApiModule), - typeof(AbpNotificationsEntityFrameworkCoreModule), - - //typeof(AbpIdentityServerSessionModule), - //typeof(AbpIdentityServerApplicationModule), - //typeof(AbpIdentityServerHttpApiModule), - //typeof(AbpIdentityServerEntityFrameworkCoreModule), - - typeof(AbpOpenIddictAspNetCoreModule), - typeof(AbpOpenIddictAspNetCoreSessionModule), - typeof(AbpOpenIddictApplicationModule), - typeof(AbpOpenIddictHttpApiModule), - typeof(AbpOpenIddictEntityFrameworkCoreModule), - typeof(AbpOpenIddictSmsModule), - typeof(AbpOpenIddictPortalModule), - typeof(AbpOpenIddictWeChatModule), - typeof(AbpOpenIddictWeChatWorkModule), - - //typeof(AbpOssManagementMinioModule), // 取消注释以使用Minio - typeof(AbpOssManagementFileSystemModule), - // typeof(AbpOssManagementImagingModule), - typeof(AbpOssManagementDomainModule), - typeof(AbpOssManagementApplicationModule), - typeof(AbpOssManagementHttpApiModule), - typeof(AbpOssManagementSettingManagementModule), - typeof(AbpImagingImageSharpModule), - - 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), - typeof(AbpWebhooksSaasModule), - typeof(WebhooksManagementDomainModule), - 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(AbpPermissionManagementDomainOpenIddictModule), - // typeof(AbpPermissionManagementDomainIdentityServerModule), - typeof(AbpPermissionManagementEntityFrameworkCoreModule), - typeof(AbpPermissionManagementDomainOrganizationUnitsModule), // 组织机构权限管理 - - // typeof(AbpEntityFrameworkCorePostgreSqlModule), - typeof(AbpEntityFrameworkCoreMySQLModule), - - typeof(AbpAliyunSmsModule), - typeof(AbpAliyunSettingManagementModule), - - typeof(AbpAuthenticationQQModule), - typeof(AbpAuthenticationWeChatModule), - typeof(AbpAuthorizationOrganizationUnitsModule), - typeof(AbpIdentityOrganizaztionUnitsModule), - - typeof(AbpBackgroundTasksModule), - typeof(AbpBackgroundTasksActivitiesModule), - typeof(AbpBackgroundTasksDistributedLockingModule), - typeof(AbpBackgroundTasksEventBusModule), - typeof(AbpBackgroundTasksExceptionHandlingModule), - 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), - typeof(AbpWeChatOfficialModule), - typeof(AbpWeChatOfficialApplicationModule), - typeof(AbpWeChatOfficialHttpApiModule), - typeof(AbpWeChatWorkModule), - typeof(AbpWeChatWorkApplicationModule), - typeof(AbpWeChatWorkHttpApiModule), - 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(AbpElsaEntityFrameworkCorePostgreSqlModule), - // typeof(AbpElsaModule), - // typeof(AbpElsaServerModule), - // typeof(AbpElsaActivitiesModule), - // typeof(AbpElsaEntityFrameworkCoreModule), - // typeof(AbpElsaEntityFrameworkCoreMySqlModule), - - typeof(AbpExporterMiniExcelModule), - typeof(AbpAspNetCoreMvcUiMultiTenancyModule), - typeof(AbpAspNetCoreSerilogModule), - typeof(AbpHttpClientWrapperModule), - typeof(AbpAspNetCoreMvcWrapperModule), - typeof(AbpAspNetCoreMvcIdempotentWrapperModule), - typeof(AbpAspNetCoreHttpOverridesModule), - typeof(AbpAspNetCoreMvcUiBasicThemeModule), - typeof(AbpEventBusModule), - typeof(AbpAutofacModule) - )] -public partial class MicroServiceApplicationsSingleModule : AbpModule -{ - public override void PreConfigureServices(ServiceConfigurationContext context) - { - var configuration = context.Services.GetConfiguration(); - var hostingEnvironment = context.Services.GetHostingEnvironment(); - - PreConfigureWrapper(); - PreConfigureFeature(); - PreConfigureIdentity(); - PreConfigureApp(configuration); - PreConfigureQuartz(configuration); - PreConfigureAuthServer(configuration); - PreConfigureElsa(context.Services, configuration); - PreConfigureCertificate(configuration, hostingEnvironment); - } - - public override void ConfigureServices(ServiceConfigurationContext context) - { - var hostingEnvironment = context.Services.GetHostingEnvironment(); - var configuration = context.Services.GetConfiguration(); - - ConfigureWeChat(); - ConfigureWrapper(); - ConfigureExporter(); - ConfigureAuditing(); - ConfigureDbContext(); - ConfigureIdempotent(); - ConfigureMvcUiTheme(); - ConfigureDataSeeder(); - ConfigureLocalization(); - ConfigureKestrelServer(); - ConfigureBackgroundTasks(); - ConfigureExceptionHandling(); - ConfigureVirtualFileSystem(); - ConfigureEntityDataProtected(); - ConfigureUrls(configuration); - ConfigureCaching(configuration); - ConfigureAuditing(configuration); - ConfigureIdentity(configuration); - ConfigureAuthServer(configuration); - ConfigureSwagger(context.Services); - ConfigureEndpoints(context.Services); - ConfigureBlobStoring(configuration); - ConfigureMultiTenancy(configuration); - ConfigureJsonSerializer(configuration); - ConfigureTextTemplating(configuration); - ConfigureFeatureManagement(configuration); - ConfigureSettingManagement(configuration); - ConfigureWebhooksManagement(configuration); - ConfigurePermissionManagement(configuration); - ConfigureNotificationManagement(configuration); - ConfigureCors(context.Services, configuration); - ConfigureDistributedLock(context.Services, configuration); - ConfigureSecurity(context.Services, configuration, hostingEnvironment.IsDevelopment()); - } - - public override void OnApplicationInitialization(ApplicationInitializationContext context) - { - AsyncHelper.RunSync(async () => await OnApplicationInitializationAsync(context)); - } - - public async override Task OnApplicationInitializationAsync(ApplicationInitializationContext context) - { - await context.ServiceProvider.GetRequiredService().SeedAsync(); ; - } -} diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Microsoft/Extensions/DependencyInjection/SameSiteCookiesServiceCollectionExtensions.cs b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Microsoft/Extensions/DependencyInjection/SameSiteCookiesServiceCollectionExtensions.cs deleted file mode 100644 index 42108b0eb..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Microsoft/Extensions/DependencyInjection/SameSiteCookiesServiceCollectionExtensions.cs +++ /dev/null @@ -1,67 +0,0 @@ -namespace PackageName.CompanyName.ProjectName.AIO.Host.Microsoft.Extensions.DependencyInjection -{ - public static class SameSiteCookiesServiceCollectionExtensions - { - public static IServiceCollection AddSameSiteCookiePolicy(this IServiceCollection services) - { - services.Configure(options => - { - options.MinimumSameSitePolicy = SameSiteMode.Unspecified; - options.OnAppendCookie = cookieContext => - CheckSameSite(cookieContext.Context, cookieContext.CookieOptions); - options.OnDeleteCookie = cookieContext => - CheckSameSite(cookieContext.Context, cookieContext.CookieOptions); - }); - - return services; - } - - private static void CheckSameSite(HttpContext httpContext, CookieOptions options) - { - if (options.SameSite == SameSiteMode.None) - { - var userAgent = httpContext.Request.Headers["User-Agent"].ToString(); - if (!httpContext.Request.IsHttps || DisallowsSameSiteNone(userAgent)) - { - // For .NET Core < 3.1 set SameSite = (SameSiteMode)(-1) - options.SameSite = SameSiteMode.Unspecified; - } - } - } - - private static bool DisallowsSameSiteNone(string userAgent) - { - // Cover all iOS based browsers here. This includes: - // - Safari on iOS 12 for iPhone, iPod Touch, iPad - // - WkWebview on iOS 12 for iPhone, iPod Touch, iPad - // - Chrome on iOS 12 for iPhone, iPod Touch, iPad - // All of which are broken by SameSite=None, because they use the iOS networking stack - if (userAgent.Contains("CPU iPhone OS 12") || userAgent.Contains("iPad; CPU OS 12")) - { - return true; - } - - // Cover Mac OS X based browsers that use the Mac OS networking stack. This includes: - // - Safari on Mac OS X. - // This does not include: - // - Chrome on Mac OS X - // Because they do not use the Mac OS networking stack. - if (userAgent.Contains("Macintosh; Intel Mac OS X 10_14") && - userAgent.Contains("Version/") && userAgent.Contains("Safari")) - { - return true; - } - - // Cover Chrome 50-69, because some versions are broken by SameSite=None, - // and none in this range require it. - // Note: this covers some pre-Chromium Edge versions, - // but pre-Chromium Edge does not require SameSite=None. - if (userAgent.Contains("Chrome/5") || userAgent.Contains("Chrome/6")) - { - return true; - } - - return false; - } - } -} \ No newline at end of file diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/MultiTenancy/ITenantConfigurationCache.cs b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/MultiTenancy/ITenantConfigurationCache.cs deleted file mode 100644 index daabe255d..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/MultiTenancy/ITenantConfigurationCache.cs +++ /dev/null @@ -1,10 +0,0 @@ -using Volo.Abp.MultiTenancy; - -namespace PackageName.CompanyName.ProjectName.AIO.Host.MultiTenancy; - -public interface ITenantConfigurationCache -{ - Task RefreshAsync(); - - Task> GetTenantsAsync(); -} diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/MultiTenancy/TenantConfigurationCache.cs b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/MultiTenancy/TenantConfigurationCache.cs deleted file mode 100644 index 61f939f97..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/MultiTenancy/TenantConfigurationCache.cs +++ /dev/null @@ -1,59 +0,0 @@ -using LINGYUN.Abp.Saas.Tenants; -using Volo.Abp.Caching; -using Volo.Abp.DependencyInjection; -using Volo.Abp.MultiTenancy; - -namespace PackageName.CompanyName.ProjectName.AIO.Host.MultiTenancy; - -public class TenantConfigurationCache : ITenantConfigurationCache, ITransientDependency -{ - protected ITenantRepository TenantRepository { get; } - protected IDistributedCache TenantCache { get; } - - public TenantConfigurationCache( - ITenantRepository tenantRepository, - IDistributedCache tenantCache) - { - TenantRepository = tenantRepository; - TenantCache = tenantCache; - } - - public async virtual Task RefreshAsync() - { - var cacheKey = GetCacheKey(); - - await TenantCache.RemoveAsync(cacheKey); - } - - public async virtual Task> GetTenantsAsync() - { - return (await GetForCacheItemAsync()).Tenants; - } - - protected async virtual Task GetForCacheItemAsync() - { - var cacheKey = GetCacheKey(); - var cacheItem = await TenantCache.GetAsync(cacheKey); - if (cacheItem == null) - { - var allActiveTenants = await TenantRepository.GetListAsync(); - - cacheItem = new TenantConfigurationCacheItem( - allActiveTenants - .Where(t => t.IsActive) - .Select(t => new TenantConfiguration(t.Id, t.Name) - { - IsActive = t.IsActive, - }).ToList()); - - await TenantCache.SetAsync(cacheKey, cacheItem); - } - - return cacheItem; - } - - protected virtual string GetCacheKey() - { - return "_Abp_Tenant_Configuration"; - } -} diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/MultiTenancy/TenantConfigurationCacheItem.cs b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/MultiTenancy/TenantConfigurationCacheItem.cs deleted file mode 100644 index ac10549e5..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/MultiTenancy/TenantConfigurationCacheItem.cs +++ /dev/null @@ -1,19 +0,0 @@ -using Volo.Abp.MultiTenancy; - -namespace PackageName.CompanyName.ProjectName.AIO.Host.MultiTenancy; - -[IgnoreMultiTenancy] -public class TenantConfigurationCacheItem -{ - public List Tenants { get; set; } - - public TenantConfigurationCacheItem() - { - Tenants = new List(); - } - - public TenantConfigurationCacheItem(List tenants) - { - Tenants = tenants; - } -} diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/PackageName.CompanyName.ProjectName.AIO.Host.csproj b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/PackageName.CompanyName.ProjectName.AIO.Host.csproj deleted file mode 100644 index 136d24605..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/PackageName.CompanyName.ProjectName.AIO.Host.csproj +++ /dev/null @@ -1,276 +0,0 @@ - - - net8.0 - enable - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Pages/Account/Components/ProfileManagementGroup/PersonalInfo/Default.cshtml b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Pages/Account/Components/ProfileManagementGroup/PersonalInfo/Default.cshtml deleted file mode 100644 index aed9202eb..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Pages/Account/Components/ProfileManagementGroup/PersonalInfo/Default.cshtml +++ /dev/null @@ -1,103 +0,0 @@ -@using Volo.Abp.Account.Localization -@using Volo.Abp.Users -@using Microsoft.AspNetCore.Mvc.Localization -@using Microsoft.Extensions.Localization -@using Volo.Abp.Account.Web.Pages.Account.Components.ProfileManagementGroup.PersonalInfo -@using Volo.Abp.AspNetCore.Mvc.UI.Theming -@using Volo.Abp.Data -@using Volo.Abp.Identity.Settings -@using Volo.Abp.Localization -@using Volo.Abp.Settings -@using Volo.Abp.ObjectExtending -@inject IHtmlLocalizer L -@inject ICurrentUser CurrentUser -@inject ISettingProvider SettingManager -@inject IThemeManager ThemeManager -@inject IStringLocalizerFactory StringLocalizerFactory -@model Volo.Abp.Account.Web.Pages.Account.Components.ProfileManagementGroup.PersonalInfo.AccountProfilePersonalInfoManagementGroupViewComponent.PersonalInfoModel -@{ - var isUserNameUpdateEnabled = string.Equals(await SettingManager.GetOrNullAsync(IdentitySettingNames.User.IsUserNameUpdateEnabled), "true", - StringComparison.OrdinalIgnoreCase); - - var isEmailUpdateEnabled = string.Equals(await SettingManager.GetOrNullAsync(IdentitySettingNames.User.IsEmailUpdateEnabled), "true", - StringComparison.OrdinalIgnoreCase); -} - -

@L["PersonalSettings"]


-
- - - - - - - - - - - - - - - - - - - - @if (CurrentUser.EmailVerified) - { - - } - else - { - @**@ - @L["Validation"].Value - } - - - - - - @foreach (var propertyInfo in ObjectExtensionManager.Instance.GetProperties()) - { - var isAllowed = propertyInfo.Configuration.GetOrDefault(IdentityModuleExtensionConsts.ConfigurationNames.AllowUserToEdit); - - if (isAllowed == null || !isAllowed.Equals(true)) - { - continue; - } - - if (!propertyInfo.Name.EndsWith("_Text")) - { - if (propertyInfo.Type.IsEnum || !propertyInfo.Lookup.Url.IsNullOrEmpty()) - { - if (propertyInfo.Type.IsEnum) - { - Model.ExtraProperties.ToEnum(propertyInfo.Name, propertyInfo.Type); - } - - - } - else - { - - } - } - } - - - diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Pages/Account/Components/ProfileManagementGroup/PersonalInfo/Default.js b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Pages/Account/Components/ProfileManagementGroup/PersonalInfo/Default.js deleted file mode 100644 index 55a88e52e..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Pages/Account/Components/ProfileManagementGroup/PersonalInfo/Default.js +++ /dev/null @@ -1,28 +0,0 @@ -(function ($) { - $(function () { - var l = abp.localization.getResource("AbpAccount"); - - $('#PersonalSettingsForm').submit(function (e) { - e.preventDefault(); - - if (!$('#PersonalSettingsForm').valid()) { - return false; - } - - var input = $('#PersonalSettingsForm').serializeFormToObject(); - - volo.abp.account.profile.update(input).then(function (result) { - abp.notify.success(l('PersonalSettingsSaved')); - updateConcurrencyStamp(); - }); - }); - }); - - abp.event.on('passwordChanged', updateConcurrencyStamp); - - function updateConcurrencyStamp(){ - volo.abp.account.profile.get().then(function(profile){ - $("#ConcurrencyStamp").val(profile.concurrencyStamp); - }); - } -})(jQuery); diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Pages/Account/EmailConfirm.cshtml b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Pages/Account/EmailConfirm.cshtml deleted file mode 100644 index d4d8cda0f..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Pages/Account/EmailConfirm.cshtml +++ /dev/null @@ -1,17 +0,0 @@ -@page -@inject IHtmlLocalizer L -@using Microsoft.AspNetCore.Mvc.Localization -@using Volo.Abp.Account.Localization -@model PackageName.CompanyName.ProjectName.AIO.Host.Pages.Account.EmailConfirmModel -@inject Volo.Abp.AspNetCore.Mvc.UI.Layout.IPageLayout PageLayout -
-
-

@L["EmailConfirm"]

-
- - - @L["Cancel"] - - -
-
diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Pages/Account/EmailConfirm.cshtml.cs b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Pages/Account/EmailConfirm.cshtml.cs deleted file mode 100644 index b2ed2b28e..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Pages/Account/EmailConfirm.cshtml.cs +++ /dev/null @@ -1,72 +0,0 @@ -using LINGYUN.Abp.Account; -using Microsoft.AspNetCore.Mvc; -using System.ComponentModel.DataAnnotations; -using Volo.Abp.Account.Localization; -using Volo.Abp.Account.Web.Pages.Account; -using Volo.Abp.Identity; -using Volo.Abp.Validation; - -namespace PackageName.CompanyName.ProjectName.AIO.Host.Pages.Account -{ - public class EmailConfirmModel : AccountPageModel - { - [Required] - [HiddenInput] - [BindProperty(SupportsGet = true)] - public Guid UserId { get; set; } - - [Required] - [HiddenInput] - [BindProperty(SupportsGet = true)] - public string ConfirmToken { get; set; } - - [HiddenInput] - [BindProperty(SupportsGet = true)] - public string ReturnUrl { get; set; } - - [HiddenInput] - [BindProperty(SupportsGet = true)] - public string ReturnUrlHash { get; set; } - - public IMyProfileAppService MyProfileAppService { get; set; } - - public EmailConfirmModel() - { - LocalizationResourceType = typeof(AccountResource); - } - - public async virtual Task OnPostAsync() - { - try - { - ValidateModel(); - - await MyProfileAppService.ConfirmEmailAsync( - new ConfirmEmailInput - { - ConfirmToken = ConfirmToken, - }); - } - catch (AbpIdentityResultException e) - { - if (!string.IsNullOrWhiteSpace(e.Message)) - { - Alerts.Warning(GetLocalizeExceptionMessage(e)); - return Page(); - } - - throw; - } - catch (AbpValidationException) - { - return Page(); - } - - return RedirectToPage("./ConfirmEmailConfirmation", new - { - returnUrl = ReturnUrl, - returnUrlHash = ReturnUrlHash - }); - } - } -} diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Pages/Account/EmailConfirmConfirmation.cshtml b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Pages/Account/EmailConfirmConfirmation.cshtml deleted file mode 100644 index 8ffc6586b..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Pages/Account/EmailConfirmConfirmation.cshtml +++ /dev/null @@ -1,13 +0,0 @@ -@page -@model PackageName.CompanyName.ProjectName.AIO.Host.Pages.Account.EmailConfirmConfirmationModel -@inject Volo.Abp.AspNetCore.Mvc.UI.Layout.IPageLayout PageLayout -@using Microsoft.AspNetCore.Mvc.Localization -@using Volo.Abp.Account.Localization -@inject IHtmlLocalizer L -
-
-

@L["EmailConfirm"]

-

@L["YourEmailIsSuccessfullyConfirm"]

- @L["GoToTheApplication"] -
-
diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Pages/Account/EmailConfirmConfirmation.cshtml.cs b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Pages/Account/EmailConfirmConfirmation.cshtml.cs deleted file mode 100644 index 01f1f0f01..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Pages/Account/EmailConfirmConfirmation.cshtml.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; -using Volo.Abp.Account.Web.Pages.Account; - -namespace PackageName.CompanyName.ProjectName.AIO.Host.Pages.Account; - -[AllowAnonymous] -public class EmailConfirmConfirmationModel : AccountPageModel -{ - [BindProperty(SupportsGet = true)] - public string ReturnUrl { get; set; } - - [BindProperty(SupportsGet = true)] - public string ReturnUrlHash { get; set; } - - public async virtual Task OnGetAsync() - { - ReturnUrl = await GetRedirectUrlAsync(ReturnUrl, ReturnUrlHash); - - return Page(); - } -} diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Pages/Account/SendCode.cshtml b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Pages/Account/SendCode.cshtml deleted file mode 100644 index 8d55fdd34..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Pages/Account/SendCode.cshtml +++ /dev/null @@ -1,26 +0,0 @@ -@page -@using Microsoft.AspNetCore.Mvc.Localization -@using Volo.Abp.Account.Localization -@model PackageName.CompanyName.ProjectName.AIO.Host.Pages.Account.SendCodeModel -@inject IHtmlLocalizer L - -
-
-

@L["TwoFactor"]

-
- - - -
- -
-
- @L["SendVerifyCode"] -
- - @L["Login"] - - -
-
- diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Pages/Account/SendCode.cshtml.cs b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Pages/Account/SendCode.cshtml.cs deleted file mode 100644 index 8155e20f1..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Pages/Account/SendCode.cshtml.cs +++ /dev/null @@ -1,125 +0,0 @@ -using LINGYUN.Abp.Account.Emailing; -using LINGYUN.Abp.Identity.Settings; -using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Mvc.Rendering; -using Volo.Abp; -using Volo.Abp.Account.Localization; -using Volo.Abp.Account.Web.Pages.Account; -using Volo.Abp.Sms; - -namespace PackageName.CompanyName.ProjectName.AIO.Host.Pages.Account -{ - public class SendCodeModel : AccountPageModel - { - [BindProperty] - public SendCodeInputModel Input { get; set; } - - [HiddenInput] - [BindProperty(SupportsGet = true)] - public string ReturnUrl { get; set; } - - [HiddenInput] - [BindProperty(SupportsGet = true)] - public string ReturnUrlHash { get; set; } - - [HiddenInput] - [BindProperty(SupportsGet = true)] - public bool RememberMe { get; set; } - - public IEnumerable Providers { get; set; } - - protected ISmsSender SmsSender { get; } - - protected IAccountEmailVerifySender AccountEmailVerifySender { get; } - - public SendCodeModel( - ISmsSender smsSender, - IAccountEmailVerifySender accountEmailVerifySender) - { - SmsSender = smsSender; - AccountEmailVerifySender = accountEmailVerifySender; - - LocalizationResourceType = typeof(AccountResource); - } - - public virtual async Task OnGetAsync() - { - Input = new SendCodeInputModel(); - - var user = await SignInManager.GetTwoFactorAuthenticationUserAsync(); - if (user == null) - { - // ˫������Ϣ��֤ʧ��,һ�㶼�dz�ʱ�˻����û���Ϣ��� - Alerts.Warning(L["TwoFactorAuthenticationInvaidUser"]); - return Page(); - } - var userFactors = await UserManager.GetValidTwoFactorProvidersAsync(user); - Providers = userFactors.Select(purpose => new SelectListItem { Text = purpose, Value = purpose }).ToList(); - - return Page(); - } - - public virtual async Task OnPostAsync() - { - var user = await SignInManager.GetTwoFactorAuthenticationUserAsync(); - if (user == null) - { - Alerts.Warning(L["TwoFactorAuthenticationInvaidUser"]); - return Page(); - } - - if (Input.SelectedProvider == "Authenticator") - { - // �û�ͨ���ʼ�/�������ӽ�����Ȩҳ�� - return RedirectToPage("VerifyAuthenticatorCode", new - { - returnUrl = ReturnUrl, - returnUrlHash = ReturnUrlHash, - rememberMe = RememberMe - }); - } - // ������֤�� - var code = await UserManager.GenerateTwoFactorTokenAsync(user, Input.SelectedProvider); - if (string.IsNullOrWhiteSpace(code)) - { - Alerts.Warning(L["InvaidGenerateTwoFactorToken"]); - return Page(); - } - - if (Input.SelectedProvider == "Email") - { - await AccountEmailVerifySender - .SendMailLoginVerifyCodeAsync( - code, - user.UserName, - user.Email); - } - else if (Input.SelectedProvider == "Phone") - { - var phoneNumber = await UserManager.GetPhoneNumberAsync(user); - var templateCode = await SettingProvider.GetOrNullAsync(IdentitySettingNames.User.SmsUserSignin); - Check.NotNullOrWhiteSpace(templateCode, nameof(IdentitySettingNames.User.SmsUserSignin)); - - // TODO: �Ժ���չ����ģ�巢�� - var smsMessage = new SmsMessage(phoneNumber, code); - smsMessage.Properties.Add("code", code); - smsMessage.Properties.Add("TemplateCode", templateCode); - - await SmsSender.SendAsync(smsMessage); - } - - return RedirectToPage("VerifyCode", new - { - provider = Input.SelectedProvider, - returnUrl = ReturnUrl, - returnUrlHash = ReturnUrlHash, - rememberMe = RememberMe - }); - } - } - - public class SendCodeInputModel - { - public string SelectedProvider { get; set; } - } -} diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Pages/Account/SendEmailConfirm.cshtml b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Pages/Account/SendEmailConfirm.cshtml deleted file mode 100644 index 8f0dd7030..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Pages/Account/SendEmailConfirm.cshtml +++ /dev/null @@ -1,16 +0,0 @@ -@page -@inject IHtmlLocalizer L -@using Microsoft.AspNetCore.Mvc.Localization -@using Volo.Abp.Account.Localization -@model PackageName.CompanyName.ProjectName.AIO.Host.Pages.Account.SendEmailConfirmModel -@inject Volo.Abp.AspNetCore.Mvc.UI.Layout.IPageLayout PageLayout -
-
-

@L["EmailConfirm"]

-
- - @L["Cancel"] - - -
-
diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Pages/Account/SendEmailConfirm.cshtml.cs b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Pages/Account/SendEmailConfirm.cshtml.cs deleted file mode 100644 index 9d14d5710..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Pages/Account/SendEmailConfirm.cshtml.cs +++ /dev/null @@ -1,73 +0,0 @@ -using LINGYUN.Abp.Account; -using Microsoft.AspNetCore.Mvc; -using Volo.Abp.Account.Localization; -using Volo.Abp.Account.Web.Pages.Account; -using Volo.Abp.Identity; -using Volo.Abp.Validation; - -namespace PackageName.CompanyName.ProjectName.AIO.Host.Pages.Account -{ - public class SendEmailConfirmModel : AccountPageModel - { - [BindProperty(SupportsGet = true)] - public string Email { get; set; } - - [HiddenInput] - [BindProperty(SupportsGet = true)] - public string ReturnUrl { get; set; } - - [HiddenInput] - [BindProperty(SupportsGet = true)] - public string ReturnUrlHash { get; set; } - - public IMyProfileAppService MyProfileAppService { get; set; } - - public SendEmailConfirmModel() - { - LocalizationResourceType = typeof(AccountResource); - } - - public virtual Task OnGetAsync() - { - Email = CurrentUser.Email; - - return Task.FromResult(Page()); - } - - public async virtual Task OnPostAsync() - { - try - { - ValidateModel(); - - await MyProfileAppService.SendEmailConfirmLinkAsync( - new SendEmailConfirmCodeDto - { - Email = Email, - AppName = "MVC", - ReturnUrl = ReturnUrl, - ReturnUrlHash = ReturnUrlHash - }); - } - catch (AbpIdentityResultException e) - { - if (!string.IsNullOrWhiteSpace(e.Message)) - { - Alerts.Warning(GetLocalizeExceptionMessage(e)); - return Page(); - } - - throw; - } - catch (AbpValidationException) - { - return Page(); - } - - return RedirectToPage("~/Account/Manage", new - { - returnUrl = ReturnUrl - }); - } - } -} diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Pages/Account/TwoFactorSupportedLoginModel.cs b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Pages/Account/TwoFactorSupportedLoginModel.cs deleted file mode 100644 index 166f827e9..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Pages/Account/TwoFactorSupportedLoginModel.cs +++ /dev/null @@ -1,63 +0,0 @@ -using Microsoft.AspNetCore.Authentication; -using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.Options; -using Volo.Abp.Account.Web; -using Volo.Abp.Account.Web.Pages.Account; -using Volo.Abp.DependencyInjection; -using Volo.Abp.Identity; -using Volo.Abp.OpenIddict; -using IdentityOptions = Microsoft.AspNetCore.Identity.IdentityOptions; - -namespace PackageName.CompanyName.ProjectName.AIO.Host.Pages.Account -{ - /// - /// 重写登录模型,实现双因素登录 - /// - [Dependency(ReplaceServices = true)] - [ExposeServices(typeof(LoginModel), typeof(OpenIddictSupportedLoginModel))] - public class TwoFactorSupportedLoginModel : OpenIddictSupportedLoginModel - { - public TwoFactorSupportedLoginModel( - IAuthenticationSchemeProvider schemeProvider, - IOptions accountOptions, - IOptions identityOptions, - IdentityDynamicClaimsPrincipalContributorCache identityDynamicClaimsPrincipalContributorCache, - AbpOpenIddictRequestHelper openIddictRequestHelper) - : base(schemeProvider, accountOptions, identityOptions, identityDynamicClaimsPrincipalContributorCache, openIddictRequestHelper) - { - - } - - protected async override Task> GetExternalProviders() - { - var providers = await base.GetExternalProviders(); - - foreach (var provider in providers) - { - var localizedDisplayName = L[provider.DisplayName]; - if (localizedDisplayName.ResourceNotFound) - { - localizedDisplayName = L["AuthenticationScheme:" + provider.DisplayName]; - } - - if (!localizedDisplayName.ResourceNotFound) - { - provider.DisplayName = localizedDisplayName.Value; - } - } - - return providers; - } - - protected override Task TwoFactorLoginResultAsync() - { - // 重定向双因素认证页面 - return Task.FromResult(RedirectToPage("SendCode", new - { - returnUrl = ReturnUrl, - returnUrlHash = ReturnUrlHash, - rememberMe = LoginInput.RememberMe - })); - } - } -} diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Pages/Account/UseRecoveryCode.cshtml b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Pages/Account/UseRecoveryCode.cshtml deleted file mode 100644 index 1936197c0..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Pages/Account/UseRecoveryCode.cshtml +++ /dev/null @@ -1,4 +0,0 @@ -@page -@model PackageName.CompanyName.ProjectName.AIO.Host.Pages.Account.UseRecoveryCodeModel -@{ -} diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Pages/Account/UseRecoveryCode.cshtml.cs b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Pages/Account/UseRecoveryCode.cshtml.cs deleted file mode 100644 index c8ccca339..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Pages/Account/UseRecoveryCode.cshtml.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Microsoft.AspNetCore.Mvc.RazorPages; - -namespace PackageName.CompanyName.ProjectName.AIO.Host.Pages.Account -{ - public class UseRecoveryCodeModel : PageModel - { - public void OnGet() - { - } - } -} diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Pages/Account/VerifyAuthenticatorCode.cshtml b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Pages/Account/VerifyAuthenticatorCode.cshtml deleted file mode 100644 index 2b14e2168..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Pages/Account/VerifyAuthenticatorCode.cshtml +++ /dev/null @@ -1,26 +0,0 @@ -@page -@using Microsoft.AspNetCore.Mvc.Localization -@using Volo.Abp.Account.Localization -@model PackageName.CompanyName.ProjectName.AIO.Host.Pages.Account.VerifyAuthenticatorCodeModel -@inject IHtmlLocalizer L -
-
-
- - -
- - - -
-
- - -
- @L["VerifyAuthenticatorCode"] - - @L["Login"] - -
-
-
\ No newline at end of file diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Pages/Account/VerifyAuthenticatorCode.cshtml.cs b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Pages/Account/VerifyAuthenticatorCode.cshtml.cs deleted file mode 100644 index 899e3df30..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Pages/Account/VerifyAuthenticatorCode.cshtml.cs +++ /dev/null @@ -1,59 +0,0 @@ -using Microsoft.AspNetCore.Mvc; -using System.ComponentModel.DataAnnotations; -using Volo.Abp.Account.Web.Pages.Account; - -namespace PackageName.CompanyName.ProjectName.AIO.Host.Pages.Account -{ - public class VerifyAuthenticatorCodeModel : AccountPageModel - { - [BindProperty] - public VerifyAuthenticatorCodeInputModel Input { get; set; } - - [HiddenInput] - [BindProperty(SupportsGet = true)] - public string ReturnUrl { get; set; } - - [HiddenInput] - [BindProperty(SupportsGet = true)] - public string ReturnUrlHash { get; set; } - - [BindProperty(SupportsGet = true)] - public bool RememberBrowser { get; set; } - - [HiddenInput] - public bool RememberMe { get; set; } - - public virtual IActionResult OnGet() - { - Input = new VerifyAuthenticatorCodeInputModel(); - - return Page(); - } - - public virtual async Task OnPostAsync() - { - var result = await SignInManager.TwoFactorAuthenticatorSignInAsync(Input.VerifyCode, RememberMe, RememberBrowser); - if (result.Succeeded) - { - return await RedirectSafelyAsync(ReturnUrl, ReturnUrlHash); - } - if (result.IsLockedOut) - { - Logger.LogWarning(7, "User account locked out."); - Alerts.Warning(L["UserLockedOutMessage"]); - return Page(); - } - else - { - Alerts.Danger(L["TwoFactorAuthenticationInvaidUser"]);// TODO: ����״̬��Ľ�� - return Page(); - } - } - } - - public class VerifyAuthenticatorCodeInputModel - { - [Required] - public string VerifyCode { get; set; } - } -} diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Pages/Account/VerifyCode.cshtml b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Pages/Account/VerifyCode.cshtml deleted file mode 100644 index 44d45b36e..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Pages/Account/VerifyCode.cshtml +++ /dev/null @@ -1,29 +0,0 @@ -@page -@inject IHtmlLocalizer L -@using Microsoft.AspNetCore.Mvc.Localization -@using Volo.Abp.Account.Localization -@model PackageName.CompanyName.ProjectName.AIO.Host.Pages.Account.VerifyCodeModel -
-
-
- - - - -
- -
- - - - - -
- @L["VerifyAuthenticatorCode"] -
- - @L["ReSendVerifyCode"] - -
-
-
diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Pages/Account/VerifyCode.cshtml.cs b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Pages/Account/VerifyCode.cshtml.cs deleted file mode 100644 index 169c48eda..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Pages/Account/VerifyCode.cshtml.cs +++ /dev/null @@ -1,90 +0,0 @@ -using Microsoft.AspNetCore.Mvc; -using System.ComponentModel.DataAnnotations; -using Volo.Abp.Account.Localization; -using Volo.Abp.Account.Web.Pages.Account; - -namespace PackageName.CompanyName.ProjectName.AIO.Host.Pages.Account -{ - public class VerifyCodeModel : AccountPageModel - { - [BindProperty] - public VerifyCodeInputModel Input { get; set; } - /// - /// ˫������֤�ṩ���� - /// - [HiddenInput] - [BindProperty(SupportsGet = true)] - public string Provider { get; set; } - /// - /// �ض���Url - /// - [HiddenInput] - [BindProperty(SupportsGet = true)] - public string ReturnUrl { get; set; } - /// - /// - /// - [HiddenInput] - [BindProperty(SupportsGet = true)] - public string ReturnUrlHash { get; set; } - /// - /// �Ƿ��ס��¼״̬ - /// - [HiddenInput] - [BindProperty(SupportsGet = true)] - public bool RememberMe { get; set; } - - public VerifyCodeModel() - { - LocalizationResourceType = typeof(AccountResource); - } - - public virtual IActionResult OnGet() - { - Input = new VerifyCodeInputModel(); - - return Page(); - } - - public virtual async Task OnPostAsync() - { - // ��֤�û���¼״̬ - var user = await SignInManager.GetTwoFactorAuthenticationUserAsync(); - if (user == null) - { - Alerts.Warning(L["TwoFactorAuthenticationInvaidUser"]); - return Page(); - } - // ˫���ص�¼ - var result = await SignInManager.TwoFactorSignInAsync(Provider, Input.VerifyCode, RememberMe, Input.RememberBrowser); - if (result.Succeeded) - { - return await RedirectSafelyAsync(ReturnUrl, ReturnUrlHash); - } - if (result.IsLockedOut) - { - Logger.LogWarning(7, "User account locked out."); - Alerts.Warning(L["UserLockedOutMessage"]); - return Page(); - } - else - { - Alerts.Danger(L["TwoFactorAuthenticationInvaidUser"]);// TODO: ����״̬��Ľ�� - return Page(); - } - } - } - - public class VerifyCodeInputModel - { - /// - /// �Ƿ���������м�ס��¼״̬ - /// - public bool RememberBrowser { get; set; } - /// - /// ���͵���֤�� - /// - [Required] - public string VerifyCode { get; set; } - } -} diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Pages/Index.cshtml b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Pages/Index.cshtml deleted file mode 100644 index c149bd95d..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Pages/Index.cshtml +++ /dev/null @@ -1,36 +0,0 @@ -@page -@using Microsoft.AspNetCore.Mvc.TagHelpers -@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Alert -@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Grid -@using Volo.Abp.Users -@model PackageName.CompanyName.ProjectName.AIO.Host.Pages.IndexModel -@inject ICurrentUser CurrentUser -@if (CurrentUser.IsAuthenticated) -{ -
- - - - Logout - - -

@CurrentUser.UserName

-
@CurrentUser.Email
-
- Roles: @CurrentUser.Roles.JoinAsString(", ") -
- Claims:
- @Html.Raw(CurrentUser.GetAllClaims().Select(c => $"{c.Type}={c.Value}").JoinAsString("
")) -
-
-
-
-} - -@if (!CurrentUser.IsAuthenticated) -{ -
-

- Login -
-} \ No newline at end of file diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Pages/Index.cshtml.cs b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Pages/Index.cshtml.cs deleted file mode 100644 index 7047bc406..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Pages/Index.cshtml.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Volo.Abp.AspNetCore.Mvc.UI.RazorPages; - -namespace PackageName.CompanyName.ProjectName.AIO.Host.Pages -{ - public class IndexModel : AbpPageModel - { - public void OnGet() - { - } - } -} \ No newline at end of file diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Pages/_ViewImports.cshtml b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Pages/_ViewImports.cshtml deleted file mode 100644 index c1da1f5f1..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Pages/_ViewImports.cshtml +++ /dev/null @@ -1,4 +0,0 @@ -@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers -@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI -@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bootstrap -@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bundling \ No newline at end of file diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Program.cs b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Program.cs deleted file mode 100644 index 3daf07fe4..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Program.cs +++ /dev/null @@ -1,82 +0,0 @@ -using LINGYUN.Abp.Identity.Session.AspNetCore; -using PackageName.CompanyName.ProjectName.AIO.Host; -using Microsoft.AspNetCore.Cors; -using Serilog; -using Volo.Abp.IO; -using Volo.Abp.Modularity.PlugIns; - -var builder = WebApplication.CreateBuilder(args); -builder.Services.AddCors(options => -{ - options.AddDefaultPolicy(policy => - { - policy - .WithOrigins( - builder.Configuration["App:CorsOrigins"] - .Split(",", StringSplitOptions.RemoveEmptyEntries) - .Select(o => o.RemovePostFix("/")) - .ToArray() - ) - .WithAbpExposedHeaders() - .WithAbpWrapExposedHeaders() - .SetIsOriginAllowedToAllowWildcardSubdomains() - .AllowAnyHeader() - .AllowAnyMethod() - .AllowCredentials(); - }); -}); -builder.Host.AddAppSettingsSecretsJson() - .UseAutofac() - .UseSerilog((context, provider, config) => - { - config.ReadFrom.Configuration(context.Configuration); - }); - -await builder.AddApplicationAsync(options => -{ - MicroServiceApplicationsSingleModule.ApplicationName = Environment.GetEnvironmentVariable("APPLICATION_NAME") - ?? MicroServiceApplicationsSingleModule.ApplicationName; - options.ApplicationName = MicroServiceApplicationsSingleModule.ApplicationName; - options.Configuration.UserSecretsId = Environment.GetEnvironmentVariable("APPLICATION_USER_SECRETS_ID"); - options.Configuration.UserSecretsAssembly = typeof(MicroServiceApplicationsSingleModule).Assembly; - var pluginFolder = Path.Combine( - Directory.GetCurrentDirectory(), "Modules"); - DirectoryHelper.CreateIfNotExists(pluginFolder); - options.PlugInSources.AddFolder( - pluginFolder, - SearchOption.AllDirectories); -}); - -var app = builder.Build(); - -await app.InitializeApplicationAsync(); - -app.UseForwardedHeaders(); -if (app.Environment.IsDevelopment()) -{ - app.UseDeveloperExceptionPage(); -} -// app.UseAbpExceptionHandling(); -app.UseCookiePolicy(); -app.UseMapRequestLocalization(); -app.UseCorrelationId(); -app.UseStaticFiles(); -app.UseRouting(); -app.UseCors(); -app.UseAuthentication(); -app.UseMultiTenancy(); -app.UseUnitOfWork(); -app.UseAbpOpenIddictValidation(); -app.UseAbpSession(); -app.UseDynamicClaims(); -app.UseAuthorization(); -app.UseSwagger(); -app.UseSwaggerUI(options => -{ - options.SwaggerEndpoint("/swagger/v1/swagger.json", "Support App API"); -}); -app.UseAuditing(); -app.UseAbpSerilogEnrichers(); -app.UseConfiguredEndpoints(); - -await app.RunAsync(); diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Properties/launchSettings.json b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Properties/launchSettings.json deleted file mode 100644 index 337677308..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/Properties/launchSettings.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:19139", - "sslPort": 0 - } - }, - "profiles": { - "LY.MicroService.Applications.Single": { - "commandName": "Project", - "dotnetRunMessages": true, - "launchBrowser": false, - "applicationUrl": "http://0.0.0.0:30001", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Production" - } - }, - "LY.MicroService.Applications.Single.Development": { - "commandName": "Project", - "dotnetRunMessages": true, - "launchBrowser": false, - "applicationUrl": "http://0.0.0.0:30000", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - } - } -} diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/TenantHeaderParamter.cs b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/TenantHeaderParamter.cs deleted file mode 100644 index a4218a9c4..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/TenantHeaderParamter.cs +++ /dev/null @@ -1,35 +0,0 @@ -using Microsoft.Extensions.Options; -using Microsoft.OpenApi.Models; -using Swashbuckle.AspNetCore.SwaggerGen; -using Volo.Abp.AspNetCore.MultiTenancy; -using Volo.Abp.MultiTenancy; - -namespace PackageName.CompanyName.ProjectName.AIO.Host; - -public class TenantHeaderParamter : IOperationFilter -{ - private readonly AbpMultiTenancyOptions _multiTenancyOptions; - private readonly AbpAspNetCoreMultiTenancyOptions _aspNetCoreMultiTenancyOptions; - public TenantHeaderParamter( - IOptions multiTenancyOptions, - IOptions aspNetCoreMultiTenancyOptions) - { - _multiTenancyOptions = multiTenancyOptions.Value; - _aspNetCoreMultiTenancyOptions = aspNetCoreMultiTenancyOptions.Value; - } - - public void Apply(OpenApiOperation operation, OperationFilterContext context) - { - if (_multiTenancyOptions.IsEnabled) - { - operation.Parameters = operation.Parameters ?? new List(); - operation.Parameters.Add(new OpenApiParameter - { - Name = _aspNetCoreMultiTenancyOptions.TenantKey, - In = ParameterLocation.Header, - Description = "Tenant Id in http header", - Required = false - }); - } - } -} diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/WeChat/Official/Messages/TextMessageReplyContributor.cs b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/WeChat/Official/Messages/TextMessageReplyContributor.cs deleted file mode 100644 index 31aafda51..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/WeChat/Official/Messages/TextMessageReplyContributor.cs +++ /dev/null @@ -1,21 +0,0 @@ -using LINGYUN.Abp.WeChat.Common.Messages.Handlers; -using LINGYUN.Abp.WeChat.Official.Messages.Models; -using LINGYUN.Abp.WeChat.Official.Services; - -namespace PackageName.CompanyName.ProjectName.AIO.Host.WeChat.Official.Messages; -/// -/// 文本消息客服回复 -/// -public class TextMessageReplyContributor : IMessageHandleContributor -{ - public async virtual Task HandleAsync(MessageHandleContext context) - { - var messageSender = context.ServiceProvider.GetRequiredService(); - - await messageSender.SendAsync( - new LINGYUN.Abp.WeChat.Official.Services.Models.TextMessageModel( - context.Message.FromUserName, - new LINGYUN.Abp.WeChat.Official.Services.Models.TextMessage( - context.Message.Content))); - } -} diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/WeChat/Official/Messages/UserSubscribeEventContributor.cs b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/WeChat/Official/Messages/UserSubscribeEventContributor.cs deleted file mode 100644 index 806302c0d..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/WeChat/Official/Messages/UserSubscribeEventContributor.cs +++ /dev/null @@ -1,21 +0,0 @@ -using LINGYUN.Abp.WeChat.Common.Messages.Handlers; -using LINGYUN.Abp.WeChat.Official.Messages.Models; -using LINGYUN.Abp.WeChat.Official.Services; - -namespace PackageName.CompanyName.ProjectName.AIO.Host.WeChat.Official.Messages; -/// -/// 用户关注回复消息 -/// -public class UserSubscribeEventContributor : IEventHandleContributor -{ - public async virtual Task HandleAsync(MessageHandleContext context) - { - var messageSender = context.ServiceProvider.GetRequiredService(); - - await messageSender.SendAsync( - new LINGYUN.Abp.WeChat.Official.Services.Models.TextMessageModel( - context.Message.FromUserName, - new LINGYUN.Abp.WeChat.Official.Services.Models.TextMessage( - "感谢您的关注, 点击菜单了解更多."))); - } -} diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/WeChat/Work/Messages/TextMessageReplyContributor.cs b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/WeChat/Work/Messages/TextMessageReplyContributor.cs deleted file mode 100644 index f85f858a1..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/WeChat/Work/Messages/TextMessageReplyContributor.cs +++ /dev/null @@ -1,24 +0,0 @@ -using LINGYUN.Abp.WeChat.Common.Messages.Handlers; -using LINGYUN.Abp.WeChat.Work.Common.Messages.Models; -using LINGYUN.Abp.WeChat.Work.Messages; - -namespace PackageName.CompanyName.ProjectName.AIO.Host.WeChat.Work.Messages; -/// -/// 文本消息客服回复 -/// -public class TextMessageReplyContributor : IMessageHandleContributor -{ - public async virtual Task HandleAsync(MessageHandleContext context) - { - var messageSender = context.ServiceProvider.GetRequiredService(); - - await messageSender.SendAsync( - new LINGYUN.Abp.WeChat.Work.Messages.Models.WeChatWorkTextMessage( - context.Message.AgentId.ToString(), - new LINGYUN.Abp.WeChat.Work.Messages.Models.TextMessage( - context.Message.Content)) - { - ToUser = context.Message.FromUserName, - }); - } -} diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/appsettings.Development.json b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/appsettings.Development.json deleted file mode 100644 index 4f753c08e..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/appsettings.Development.json +++ /dev/null @@ -1,249 +0,0 @@ -{ - "App": { - "ShowPii": true, - "SelfUrl": "http://127.0.0.1:30001/", - "CorsOrigins": "http://127.0.0.1:3100,http://127.0.0.1:30001", - "Urls": { - "Applications": { - "MVC": { - "RootUrl": "http://127.0.0.1:30001/", - "Urls": { - "Abp.Account.EmailConfirm": "Account/EmailConfirm", - "Abp.Account.EmailVerifyLogin": "Account/VerifyCode" - } - }, - "STS": { - "RootUrl": "http://127.0.0.1:30001/" - }, - "VueVbenAdmin": { - "RootUrl": "http://127.0.0.1:3100", - "Urls": { - "Abp.Account.EmailConfirm": "account/email-confirm" - } - } - } - } - }, - "Auditing": { - "AllEntitiesSelector": true - }, - "DistributedCache": { - "HideErrors": true, - "KeyPrefix": "LINGYUN.Abp.Application", - "GlobalCacheEntryOptions": { - "SlidingExpiration": "30:00:00", - "AbsoluteExpirationRelativeToNow": "60:00:00" - } - }, - "ConnectionStrings": { - "Default": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456;SslMode=None"//Mysql -// "Default": "Host=127.0.0.1;Database=Platform-V70;Username=postgres;Password=123456;"//Postgres - }, - "DistributedLock": { - "IsEnabled": true, - "Redis": { - "Configuration": "127.0.0.1,defaultDatabase=14" - } - }, - "Elsa": { - "Features": { - "DefaultPersistence": { - "Enabled": true, - "ConnectionStringIdentifier": "Default", - "EntityFrameworkCore": { - "MySql": { - "Enabled": true - } - } - }, - "Console": true, - "Http": true, - "Email": true, - "TemporalQuartz": true, - "JavaScriptActivities": true, - "UserTask": true, - "Conductor": true, - "Telnyx": true, - "BlobStoring": true, - "Emailing": true, - "Notification": true, - "Sms": true, - "IM": true, - "PublishWebhook": true, - "Webhooks": { - "Enabled": true, - "ConnectionStringIdentifier": "Default", - "EntityFrameworkCore": { - "MySql": { - "Enabled": true - } - } - }, - "WorkflowSettings": { - "Enabled": true, - "ConnectionStringIdentifier": "Default", - "EntityFrameworkCore": { - "MySql": { - "Enabled": true - } - } - } - }, - "Server": { - "BaseUrl": "http://127.0.0.1:30000" - } - }, - "Quartz": { - "UsePersistentStore": false, - "Properties": { - "quartz.jobStore.dataSource": "tkm", - "quartz.jobStore.type": "Quartz.Impl.AdoJobStore.JobStoreTX,Quartz", - "quartz.dataSource.tkm.connectionStringName": "Default", - "quartz.jobStore.driverDelegateType": "Quartz.Impl.AdoJobStore.MySQLDelegate,Quartz", - "quartz.dataSource.tkm.connectionString": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456", - "quartz.dataSource.tkm.provider": "MySqlConnector", -// "quartz.jobStore.driverDelegateType": "Quartz.Impl.AdoJobStore.PostgreSQLDelegate,Quartz", -// "quartz.dataSource.tkm.connectionString": "Host=127.0.0.1;Database=Platform-V70;Username=postgres;Password=123456;", -// "quartz.dataSource.tkm.provider": "Npgsql", - "quartz.jobStore.clustered": "true", - "quartz.serializer.type": "json" - } - }, - "Redis": { - "IsEnabled": true, - "Configuration": "127.0.0.1,defaultDatabase=15", - "InstanceName": "LINGYUN.Abp.Application" - }, - "Features": { - "Validation": { - "Redis": { - "Configuration": "127.0.0.1,defaultDatabase=13", - "InstanceName": "LINGYUN.Abp.Application" - } - } - }, - "AuthServer": { - "UseOpenIddict": true, - "Authority": "http://127.0.0.1:30001/", - "Audience": "lingyun-abp-application", - "RequireHttpsMetadata": false, - "SwaggerClientId": "InternalServiceClient", - "SwaggerClientSecret": "1q2w3E*" - }, - "IdentityServer": { - "Clients": { - "VueAdmin": { - "ClientId": "vue-admin-client", - "RootUrl": "http://127.0.0.1:3100/" - }, - "InternalService": { - "ClientId": "InternalServiceClient" - } - } - }, - "OpenIddict": { - "Applications": { - "VueAdmin": { - "ClientId": "vue-admin-client", - "RootUrl": "http://127.0.0.1:3100/" - }, - "InternalService": { - "ClientId": "InternalServiceClient" - } - }, - "Lifetime": { - "AuthorizationCode": "00:05:00", - "AccessToken": "14:00:00", - "DeviceCode": "00:10:00", - "IdentityToken": "00:20:00", - "RefreshToken": "14:00:00", - "RefreshTokenReuseLeeway": "00:00:30", - "UserCode": "00:10:00" - } - }, - "Identity": { - "Password": { - "RequiredLength": 6, - "RequiredUniqueChars": 0, - "RequireNonAlphanumeric": false, - "RequireLowercase": false, - "RequireUppercase": false, - "RequireDigit": false - }, - "Lockout": { - "AllowedForNewUsers": false, - "LockoutDuration": 5, - "MaxFailedAccessAttempts": 5 - }, - "SignIn": { - "RequireConfirmedEmail": false, - "RequireConfirmedPhoneNumber": false - } - }, - "FeatureManagement": { - "IsDynamicStoreEnabled": true - }, - "SettingManagement": { - "IsDynamicStoreEnabled": true - }, - "PermissionManagement": { - "IsDynamicStoreEnabled": true - }, - "TextTemplating": { - "IsDynamicStoreEnabled": true - }, - "WebhooksManagement": { - "IsDynamicStoreEnabled": true - }, - "Logging": { - "Serilog": { - "Elasticsearch": { - "IndexFormat": "abp.dev.logging-{0:yyyy.MM.dd}" - } - } - }, - "AuditLogging": { - "Elasticsearch": { - "IndexPrefix": "abp.dev.auditing" - } - }, - "Elasticsearch": { - "NodeUris": "http://127.0.0.1:9200" - }, - "Minio": { - "WithSSL": false, - "BucketName": "blobs", - "EndPoint": "127.0.0.1:19000", - "AccessKey": "ZD43kNpimiJf9mCuomTP", - "SecretKey": "w8IqMgi4Tnz0DGzN8jZ7IJWq7OEdbUnAU0jlZxQK", - "CreateBucketIfNotExists": false - }, - "Serilog": { - "MinimumLevel": { - "Default": "Information", - "Override": { - "System": "Warning", - "Microsoft": "Warning", - "DotNetCore": "Warning" - } - }, - "WriteTo": [ - { - "Name": "Console", - "Args": { - "restrictedToMinimumLevel": "Debug", - "outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss} [{Level:u3}] [{SourceContext}] [{ProcessId}] [{ThreadId}] - {Message:lj}{NewLine}{Exception}" - } - }, - { - "Name": "Elasticsearch", - "Args": { - "nodeUris": "http://127.0.0.1:9200", - "indexFormat": "abp.dev.logging-{0:yyyy.MM.dd}", - "autoRegisterTemplate": true, - "autoRegisterTemplateVersion": "ESv7" - } - } - ] - } -} diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/appsettings.json b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/appsettings.json deleted file mode 100644 index ff9beea3e..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/appsettings.json +++ /dev/null @@ -1,89 +0,0 @@ -{ - "Clock": { - "Kind": "Local" - }, - "Forwarded": { - "ForwardedHeaders": "XForwardedFor,XForwardedProto" - }, - "StringEncryption": { - "DefaultPassPhrase": "s46c5q55nxpeS8Ra", - "InitVectorBytes": "s83ng0abvd02js84", - "DefaultSalt": "sf&5)s3#" - }, - "Json": { - "OutputDateTimeFormat": "yyyy-MM-dd HH:mm:ss", - "InputDateTimeFormats": [ - "yyyy-MM-dd HH:mm:ss", - "yyyy-MM-ddTHH:mm:ss" - ] - }, - "AllowedHosts": "*", - "Hosting": { - "BasePath": "" - }, - "Serilog": { - "MinimumLevel": { - "Default": "Information", - "Override": { - "System": "Warning", - "Microsoft": "Warning", - "DotNetCore": "Information" - } - }, - "Enrich": [ "FromLogContext", "WithProcessId", "WithThreadId", "WithEnvironmentName", "WithMachineName", "WithApplicationName", "WithUniqueId" ], - "WriteTo": [ - { - "Name": "Console", - "Args": { - "restrictedToMinimumLevel": "Debug", - "outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss} [{Level:u3}] [{SourceContext}] [{ProcessId}] [{ThreadId}] - {Message:lj}{NewLine}{Exception}" - } - }, - { - "Name": "File", - "Args": { - "path": "Logs/Debug-.log", - "restrictedToMinimumLevel": "Debug", - "rollingInterval": "Day", - "outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss} [{Level:u3}] [{SourceContext}] [{ProcessId}] [{ThreadId}] - {Message:lj}{NewLine}{Exception}" - } - }, - { - "Name": "File", - "Args": { - "path": "Logs/Info-.log", - "restrictedToMinimumLevel": "Information", - "rollingInterval": "Day", - "outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss} [{Level:u3}] [{SourceContext}] [{ProcessId}] [{ThreadId}] - {Message:lj}{NewLine}{Exception}" - } - }, - { - "Name": "File", - "Args": { - "path": "Logs/Warn-.log", - "restrictedToMinimumLevel": "Warning", - "rollingInterval": "Day", - "outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss} [{Level:u3}] [{SourceContext}] [{ProcessId}] [{ThreadId}] - {Message:lj}{NewLine}{Exception}" - } - }, - { - "Name": "File", - "Args": { - "path": "Logs/Error-.log", - "restrictedToMinimumLevel": "Error", - "rollingInterval": "Day", - "outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss} [{Level:u3}] [{SourceContext}] [{ProcessId}] [{ThreadId}] - {Message:lj}{NewLine}{Exception}" - } - }, - { - "Name": "File", - "Args": { - "path": "Logs/Fatal-.log", - "restrictedToMinimumLevel": "Fatal", - "rollingInterval": "Day", - "outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss} [{Level:u3}] [{SourceContext}] [{ProcessId}] [{ThreadId}] - {Message:lj}{NewLine}{Exception}" - } - } - ] - } -} diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/gulpfile.js b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/gulpfile.js deleted file mode 100644 index bec4d578f..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.AIO.Host/gulpfile.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict"; - -var gulp = require("gulp"), - path = require('path'), - copyResources = require('./node_modules/@abp/aspnetcore.mvc.ui/gulp/copy-resources.js'); - -exports.default = function(done){ - copyResources(path.resolve('./')); - done(); -}; \ No newline at end of file diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.DbMigrator/DbMigratorHostedService.cs b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.DbMigrator/DbMigratorHostedService.cs deleted file mode 100644 index dd8a07ea4..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.DbMigrator/DbMigratorHostedService.cs +++ /dev/null @@ -1,53 +0,0 @@ -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; -using PackageName.CompanyName.ProjectName.EntityFrameworkCore; -using Serilog; -using Volo.Abp; -using Volo.Abp.Data; - -namespace PackageName.CompanyName.ProjectName.DbMigrator; - -public class DbMigratorHostedService : IHostedService -{ - private readonly IHostApplicationLifetime _hostApplicationLifetime; - private readonly IConfiguration _configuration; - - public DbMigratorHostedService( - IHostApplicationLifetime hostApplicationLifetime, - IConfiguration configuration) - { - _hostApplicationLifetime = hostApplicationLifetime; - _configuration = configuration; - } - - public async Task StartAsync(CancellationToken cancellationToken) - { - using var application = await AbpApplicationFactory - .CreateAsync(options => - { - options.Configuration.UserSecretsId = Environment.GetEnvironmentVariable("APPLICATION_USER_SECRETS_ID"); - options.Configuration.UserSecretsAssembly = typeof(DbMigratorHostedService).Assembly; - options.Services.ReplaceConfiguration(_configuration); - options.UseAutofac(); - options.Services.AddLogging(c => c.AddSerilog()); - options.AddDataMigrationEnvironment(); - }); - await application.InitializeAsync(); - - await application - .ServiceProvider - .GetRequiredService() - .CheckAndApplyDatabaseMigrationsAsync(); - - await application.ShutdownAsync(); - - _hostApplicationLifetime.StopApplication(); - } - - public Task StopAsync(CancellationToken cancellationToken) - { - return Task.CompletedTask; - } -} - diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.DbMigrator/FodyWeavers.xml b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.DbMigrator/FodyWeavers.xml deleted file mode 100644 index 1715698cc..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.DbMigrator/FodyWeavers.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.DbMigrator/FodyWeavers.xsd b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.DbMigrator/FodyWeavers.xsd deleted file mode 100644 index 11da52550..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.DbMigrator/FodyWeavers.xsd +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - '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/templates/content/host/PackageName.CompanyName.ProjectName.DbMigrator/PackageName.CompanyName.ProjectName.DbMigrator.csproj b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.DbMigrator/PackageName.CompanyName.ProjectName.DbMigrator.csproj deleted file mode 100644 index b125867ab..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.DbMigrator/PackageName.CompanyName.ProjectName.DbMigrator.csproj +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - Exe - net8.0 - enable - enable - - - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - - - - - - - - - - - - - - - diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.DbMigrator/PackageNameCompanyNameProjectNameDbMigratorModule.cs b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.DbMigrator/PackageNameCompanyNameProjectNameDbMigratorModule.cs deleted file mode 100644 index 18b109f71..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.DbMigrator/PackageNameCompanyNameProjectNameDbMigratorModule.cs +++ /dev/null @@ -1,13 +0,0 @@ -using PackageName.CompanyName.ProjectName.EntityFrameworkCore; -using Volo.Abp.Autofac; -using Volo.Abp.Modularity; - -namespace PackageName.CompanyName.ProjectName.DbMigrator; - -[DependsOn( - typeof(AbpAutofacModule), - typeof(ProjectNameEntityFrameworkCoreModule) - )] -public class PackageNameCompanyNameProjectNameDbMigratorModule : AbpModule -{ -} diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.DbMigrator/Program.cs b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.DbMigrator/Program.cs deleted file mode 100644 index 087267054..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.DbMigrator/Program.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; -using Microsoft.Extensions.Logging; -using Serilog; -using Serilog.Events; - -namespace PackageName.CompanyName.ProjectName.DbMigrator; - -public class Program -{ - public async static Task Main(string[] args) - { - Log.Logger = new LoggerConfiguration() - .MinimumLevel.Information() - .MinimumLevel.Override("Microsoft", LogEventLevel.Warning) - .MinimumLevel.Override("Volo.Abp", LogEventLevel.Warning) -#if DEBUG - .MinimumLevel.Override("PackageName.CompanyName.ProjectName", LogEventLevel.Debug) -#else - .MinimumLevel.Override("PackageName.CompanyName.ProjectName", LogEventLevel.Information) -#endif - .Enrich.FromLogContext() - .WriteTo.File("Logs/logs.txt") - .WriteTo.Console() - .CreateLogger(); - - await CreateHostBuilder(args).RunConsoleAsync(); - } - - public static IHostBuilder CreateHostBuilder(string[] args) - { - return Host.CreateDefaultBuilder(args) - .AddAppSettingsSecretsJson() - .ConfigureLogging((context, logging) => logging.ClearProviders()) - .ConfigureServices((hostContext, services) => - { - services.AddHostedService(); - }); - } -} diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.DbMigrator/appsettings.Development.json b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.DbMigrator/appsettings.Development.json deleted file mode 100644 index 17a01bb6a..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.DbMigrator/appsettings.Development.json +++ /dev/null @@ -1,147 +0,0 @@ -{ - "AgileConfig": { - "IsEnabled": false, - "env": "DEV", - "appId": "PackageName.CompanyName.ProjectName", - "secret": "1q2w3E*", - "nodes": "http://127.0.0.1:15000", - "name": "PackageName.CompanyName.ProjectName", - "tag": "PackageName.CompanyName.ProjectName" - }, - "Auditing": { - "AllEntitiesSelector": true - }, - "DistributedCache": { - "HideErrors": true, - "KeyPrefix": "LINGYUN.Abp.Application", - "GlobalCacheEntryOptions": { - "SlidingExpiration": "30:00:00", - "AbsoluteExpirationRelativeToNow": "60:00:00" - } - }, - "ConnectionStrings": { - "Default": "Server=127.0.0.1;Database=ProjectName;User Id=root;Password=123456", - "ProjectName": "Server=127.0.0.1;Database=ProjectName;User Id=root;Password=123456", - "AbpSaas": "Server=127.0.0.1;Database=ProjectName;User Id=root;Password=123456", - "AbpFeatureManagement": "Server=127.0.0.1;Database=ProjectName;User Id=root;Password=123456", - "AbpPermissionManagement": "Server=127.0.0.1;Database=ProjectName;User Id=root;Password=123456", - "AbpSettingManagement": "Server=127.0.0.1;Database=ProjectName;User Id=root;Password=123456", - "AbpLocalizationManagement": "Server=127.0.0.1;Database=ProjectName;User Id=root;Password=123456", - "AbpTextTemplating": "Server=127.0.0.1;Database=ProjectName;User Id=root;Password=123456" - }, - "DistributedLock": { - "IsEnabled": true, - "Redis": { - "Configuration": "127.0.0.1,defaultDatabase=15" - } - }, - "OpenTelemetry": { - "IsEnabled": true, - "ZipKin": { - "Endpoint": "http://127.0.0.1:9411/api/v2/spans" - } - }, - "RemoteServices": {}, - "IdentityClients": { - "InternalServiceClient": { - "Authority": "http://127.0.0.1:44385", - "RequireHttps": false, - "GrantType": "client_credentials", - "Scope": "lingyun-abp-application", - "ClientId": "InternalServiceClient", - "ClientSecret": "1q2w3E*" - } - }, - "CAP": { - "EventBus": { - "DefaultGroupName": "ProjectName", - "GroupNamePrefix": "Dev", - "Version": "v1", - "FailedRetryInterval": 300, - "FailedRetryCount": 10 - }, - "MySql": { - "TableNamePrefix": "ProjectName_cap", - "ConnectionString": "Server=127.0.0.1;Database=ProjectName;User Id=root;Password=123456" - }, - "SqlServer": { - "TableNamePrefix": "ProjectName_cap", - "ConnectionString": "Server=127.0.0.1;Database=ProjectName;User Id=root;Password=123456" - }, - "Sqlite": { - "TableNamePrefix": "ProjectName_cap", - "ConnectionString": "Data Source=./cap.db" - }, - "Oracle": { - "TableNamePrefix": "ProjectName_cap", - "ConnectionString": "Data Source=ProjectName;Integrated Security=yes;" - }, - "PostgreSql": { - "TableNamePrefix": "ProjectName_cap", - "ConnectionString": "Host=localhost;Port=5432;Database=ProjectName;User ID=root;Password=123456;" - }, - "RabbitMQ": { - "HostName": "127.0.0.1", - "Port": 5672, - "UserName": "admin", - "Password": "123456", - "ExchangeName": "LINGYUN.Abp.Application", - "VirtualHost": "/" - } - }, - "Redis": { - "Configuration": "127.0.0.1,defaultDatabase=10", - "InstanceName": "LINGYUN.Abp.Application" - }, - "AuthServer": { - "Authority": "http://127.0.0.1:44385/", - "Audience": "lingyun-abp-application", - "MapInboundClaims": false, - "RequireHttpsMetadata": false, - "SwaggerClientId": "InternalServiceClient", - "SwaggerClientSecret": "1q2w3E*" - }, - "Logging": { - "Serilog": { - "Elasticsearch": { - "IndexFormat": "abp.dev.logging-{0:yyyy.MM.dd}" - } - } - }, - "AuditLogging": { - "Elasticsearch": { - "IndexPrefix": "abp.dev.auditing" - } - }, - "Elasticsearch": { - "NodeUris": "http://127.0.0.1:9200" - }, - "Serilog": { - "MinimumLevel": { - "Default": "Debug", - "Override": { - "System": "Warning", - "Microsoft": "Warning", - "DotNetCore": "Debug" - } - }, - "WriteTo": [ - { - "Name": "Console", - "Args": { - "restrictedToMinimumLevel": "Debug", - "outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss} [{Level:u3}] [{SourceContext}] [{ProcessId}] [{ThreadId}] - {Message:lj}{NewLine}{Exception}" - } - }, - { - "Name": "Elasticsearch", - "Args": { - "nodeUris": "http://127.0.0.1:9200", - "indexFormat": "abp.dev.logging-{0:yyyy.MM.dd}", - "autoRegisterTemplate": true, - "autoRegisterTemplateVersion": "ESv7" - } - } - ] - } -} diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.DbMigrator/appsettings.json b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.DbMigrator/appsettings.json deleted file mode 100644 index d3d63c269..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.DbMigrator/appsettings.json +++ /dev/null @@ -1,80 +0,0 @@ -{ - "StringEncryption": { - "DefaultPassPhrase": "s46c5q55nxpeS8Ra", - "InitVectorBytes": "s83ng0abvd02js84", - "DefaultSalt": "sf&5)s3#" - }, - "AllowedHosts": "*", - "Serilog": { - "MinimumLevel": { - "Default": "Debug", - "Override": { - "Microsoft.EntityFrameworkCore": "Debug", - "System": "Information", - "Microsoft": "Information" - } - }, - "Enrich": [ "FromLogContext", "WithProcessId", "WithThreadId", "WithEnvironmentName", "WithMachineName", "WithApplicationName", "WithUniqueId" ], - "WriteTo": [ - { - "Name": "Console", - "Args": { - "initialMinimumLevel": "Verbose", - "standardErrorFromLevel": "Verbose", - "restrictedToMinimumLevel": "Verbose", - "outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss} [{Level:u3}] [{SourceContext}] [{ProcessId}] [{ThreadId}] - {Message:lj}{NewLine}{Exception}" - } - }, - { - "Name": "File", - "Args": { - "path": "Logs/Debug-.log", - "restrictedToMinimumLevel": "Debug", - "rollingInterval": "Day", - "fileSizeLimitBytes": 5242880, - "outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss} [{Level:u3}] [{SourceContext}] [{ProcessId}] [{ThreadId}] - {Message:lj}{NewLine}{Exception}" - } - }, - { - "Name": "File", - "Args": { - "path": "Logs/Info-.log", - "restrictedToMinimumLevel": "Information", - "rollingInterval": "Day", - "fileSizeLimitBytes": 5242880, - "outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss} [{Level:u3}] [{SourceContext}] [{ProcessId}] [{ThreadId}] - {Message:lj}{NewLine}{Exception}" - } - }, - { - "Name": "File", - "Args": { - "path": "Logs/Warn-.log", - "restrictedToMinimumLevel": "Warning", - "rollingInterval": "Day", - "fileSizeLimitBytes": 5242880, - "outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss} [{Level:u3}] [{SourceContext}] [{ProcessId}] [{ThreadId}] - {Message:lj}{NewLine}{Exception}" - } - }, - { - "Name": "File", - "Args": { - "path": "Logs/Error-.log", - "restrictedToMinimumLevel": "Error", - "rollingInterval": "Day", - "fileSizeLimitBytes": 5242880, - "outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss} [{Level:u3}] [{SourceContext}] [{ProcessId}] [{ThreadId}] - {Message:lj}{NewLine}{Exception}" - } - }, - { - "Name": "File", - "Args": { - "path": "Logs/Fatal-.log", - "restrictedToMinimumLevel": "Fatal", - "rollingInterval": "Day", - "fileSizeLimitBytes": 5242880, - "outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss} [{Level:u3}] [{SourceContext}] [{ProcessId}] [{ThreadId}] - {Message:lj}{NewLine}{Exception}" - } - } - ] - } -} diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/Controllers/HomeController.cs b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/Controllers/HomeController.cs deleted file mode 100644 index f38f64d84..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/Controllers/HomeController.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Microsoft.AspNetCore.Mvc; -using Volo.Abp.AspNetCore.Mvc; - -namespace PackageName.CompanyName.ProjectName.Controllers; - -public class HomeController : AbpController -{ - public IActionResult Index() - { - return Redirect("/swagger/index.html"); - } -} diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/Dockerfile b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/Dockerfile deleted file mode 100644 index b4aa6925f..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/Dockerfile +++ /dev/null @@ -1,57 +0,0 @@ -FROM mcr.microsoft.com/dotnet/aspnet:8.0 -LABEL maintainer="colin.in@foxmail.com" -WORKDIR /app - -COPY . /app - -## 设置服务器时区. -## 建议在外部(如docker-compose.yml)中定义 -## Set server time zone. -## Suggest defining it externally (such as Docker Compose. yml) -#ENV TZ=Asia/Shanghai -#RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo '$TZ' > /etc/timezone - - -## 解决连接SqlServer TLS版本过高问题. -## 如果数据提供者是SqlServer, 且兼容性版本在120及以下,需要手动取消注释. -## The version of connection SqlServer TLS is too high. -## If the data provider is SqlServer and the compatibility version is 120 and below, manual annotation needs to be cancelled. - -#RUN sed -i 's/\[openssl_init\]/# \[openssl_init\]/g' /etc/ssl/openssl.cnf -#RUN sed -i '$a\[openssl_init]' /etc/ssl/openssl.cnf -#RUN sed -i '$a\providers = provider_sect' /etc/ssl/openssl.cnf -#RUN sed -i '$a\ssl_conf = ssl_sect' /etc/ssl/openssl.cnf - # -#RUN sed -i '$a\[provider_sect]' /etc/ssl/openssl.cnf -#RUN sed -i '$a\default = default_sect' /etc/ssl/openssl.cnf -#RUN sed -i '$a\legacy = legacy_sect' /etc/ssl/openssl.cnf - # -#RUN sed -i '$a\[default_sect]' /etc/ssl/openssl.cnf -#RUN sed -i '$a\activate = 1' /etc/ssl/openssl.cnf - # -#RUN sed -i '$a\[legacy_sect]' /etc/ssl/openssl.cnf -#RUN sed -i '$a\activate = 1' /etc/ssl/openssl.cnf - # -#RUN sed -i '$a\[ssl_sect]' /etc/ssl/openssl.cnf -#RUN sed -i '$a\system_default = system_default_sect' /etc/ssl/openssl.cnf - # -#RUN sed -i '$a\[system_default_sect]' /etc/ssl/openssl.cnf -#RUN sed -i '$a\CipherString = DEFAULT:@SECLEVEL=0' /etc/ssl/openssl.cnf - -## 阿里源 -#RUN sed -i "s@http://deb.debian.org@http://mirrors.aliyun.com@g" /etc/apt/sources.list.d/debian.sources -#RUN apt-get clean -#RUN apt-get update - -## .NET 8.0 默认使用8080端口,变更为80端口需要环境变量ASPNETCORE_HTTP_PORTS=80 -## .NET 8.0 defaults to port 8080, changing to port 80 requires the environment variable ASPNETCORE.HTTP-PORTS=80 -# EXPOSE 8080/tcp -EXPOSE 80/tcp - -VOLUME [ "./app/Logs" ] -VOLUME [ "./app/Modules" ] - -RUN apt update -RUN apt install wget -y - -ENTRYPOINT ["dotnet", "PackageName.CompanyName.ProjectName.HttpApi.Host.dll"] diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/PackageName.CompanyName.ProjectName.HttpApi.Host.csproj b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/PackageName.CompanyName.ProjectName.HttpApi.Host.csproj deleted file mode 100644 index 92df8c8a2..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/PackageName.CompanyName.ProjectName.HttpApi.Host.csproj +++ /dev/null @@ -1,76 +0,0 @@ - - - - net8.0 - PackageName.CompanyName.ProjectName - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/Program.cs b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/Program.cs deleted file mode 100644 index 69122a822..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/Program.cs +++ /dev/null @@ -1,65 +0,0 @@ -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; -using Serilog; -using System; -using System.IO; -using System.Linq; -using System.Threading.Tasks; -using Volo.Abp.IO; -using Volo.Abp.Modularity.PlugIns; - -namespace PackageName.CompanyName.ProjectName; - -public class Program -{ - public async static Task Main(string[] args) - { - try - { - Console.Title = "Web.Host"; - Log.Information("Starting web host."); - - var builder = WebApplication.CreateBuilder(args); - builder.Host.AddAppSettingsSecretsJson() - .UseAutofac() - .ConfigureAppConfiguration((context, config) => - { - var configuration = config.Build(); - var agileConfigEnabled = configuration["AgileConfig:IsEnabled"]; - if (agileConfigEnabled.IsNullOrEmpty() || bool.Parse(agileConfigEnabled)) - { - config.AddAgileConfig(new AgileConfig.Client.ConfigClient(configuration)); - } - }) - .UseSerilog((context, provider, config) => - { - config.ReadFrom.Configuration(context.Configuration); - }); - await builder.AddApplicationAsync(options => - { - ProjectNameHttpApiHostModule.ApplicationName = Environment.GetEnvironmentVariable("APPLICATION_NAME") - ?? ProjectNameHttpApiHostModule.ApplicationName; - options.ApplicationName = ProjectNameHttpApiHostModule.ApplicationName; - // 搜索 Modules 目录下所有文件作为插件 - // 取消显示引用所有其他项目的模块,改为通过插件的形式引用 - var pluginFolder = Path.Combine( - Directory.GetCurrentDirectory(), "Modules"); - DirectoryHelper.CreateIfNotExists(pluginFolder); - options.PlugInSources.AddFolder( - pluginFolder, - SearchOption.AllDirectories); - }); - var app = builder.Build(); - await app.InitializeApplicationAsync(); - await app.RunAsync(); - return 0; - } - finally - { - Log.CloseAndFlush(); - } - } -} diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/ProjectNameHttpApiHostModule.Configure.cs b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/ProjectNameHttpApiHostModule.Configure.cs deleted file mode 100644 index 74de35a22..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/ProjectNameHttpApiHostModule.Configure.cs +++ /dev/null @@ -1,445 +0,0 @@ -using DotNetCore.CAP; -using LINGYUN.Abp.Dapr.Client.ClientProxying; -using LINGYUN.Abp.Dapr.Client.DynamicProxying; -using LINGYUN.Abp.ExceptionHandling; -using LINGYUN.Abp.ExceptionHandling.Emailing; -using LINGYUN.Abp.Localization.CultureMap; -using LINGYUN.Abp.Localization.Persistence; -using LINGYUN.Abp.Serilog.Enrichers.Application; -using LINGYUN.Abp.Serilog.Enrichers.UniqueId; -using LINGYUN.Abp.Wrapper; -using Medallion.Threading; -using Medallion.Threading.Redis; -using Microsoft.AspNetCore.Authentication.JwtBearer; -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Cors; -using Microsoft.AspNetCore.DataProtection; -using Microsoft.AspNetCore.Routing; -using Microsoft.Extensions.Caching.StackExchangeRedis; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Options; -using Microsoft.OpenApi.Models; -using OpenTelemetry.Metrics; -using OpenTelemetry.Resources; -using OpenTelemetry.Trace; -using PackageName.CompanyName.ProjectName.Localization; -using StackExchange.Redis; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text.Encodings.Web; -using System.Text.Unicode; -using Volo.Abp; -using Volo.Abp.AspNetCore.Mvc; -using Volo.Abp.AspNetCore.Mvc.AntiForgery; -using Volo.Abp.Auditing; -using Volo.Abp.Caching; -using Volo.Abp.EntityFrameworkCore; -using Volo.Abp.GlobalFeatures; -using Volo.Abp.Http.Client; -using Volo.Abp.Json; -using Volo.Abp.Json.SystemTextJson; -using Volo.Abp.Localization; -using Volo.Abp.MultiTenancy; -using Volo.Abp.Security.Claims; -using Volo.Abp.Threading; -using Volo.Abp.VirtualFileSystem; -using static IdentityModel.ClaimComparer; - -namespace PackageName.CompanyName.ProjectName; - -public partial class ProjectNameHttpApiHostModule -{ - public static string ApplicationName { get; set; } = "ProjectNameService"; - private const string DefaultCorsPolicyName = "Default"; - private static readonly OneTimeRunner OneTimeRunner = new(); - - private void PreConfigureFeature() - { - OneTimeRunner.Run(() => - { - GlobalFeatureManager.Instance.Modules.Editions().EnableAll(); - }); - } - - private void PreConfigureApp() - { - AbpSerilogEnrichersConsts.ApplicationName = ApplicationName; - - PreConfigure(options => - { - // 以开放端口区别 - options.SnowflakeIdOptions.WorkerId = 5; - options.SnowflakeIdOptions.WorkerIdBits = 5; - options.SnowflakeIdOptions.DatacenterId = 1; - }); - } - - private void PreConfigureCAP(IConfiguration configuration) - { - PreConfigure(options => - { - options -#if MySQL - .UseMySql(sqlOptions => - { - configuration.GetSection("CAP:MySql").Bind(sqlOptions); - }) -#elif SqlServer - .UseSqlServer(sqlOptions => - { - configuration.GetSection("CAP:SqlServer").Bind(sqlOptions); - }) -#elif Sqlite - .UseSqlite(sqlOptions => - { - configuration.GetSection("CAP:Sqlite").Bind(sqlOptions); - }) -#elif Oracle || OracleDevart - .UseOracle(sqlOptions => - { - configuration.GetSection("CAP:Oracle").Bind(sqlOptions); - }) -#elif PostgreSql - .UsePostgreSql(sqlOptions => - { - configuration.GetSection("CAP:PostgreSql").Bind(sqlOptions); - }) -#endif - .UseRabbitMQ(rabbitMQOptions => - { - configuration.GetSection("CAP:RabbitMQ").Bind(rabbitMQOptions); - }) - .UseDashboard(); - }); - } - - private void ConfigureJsonSerializer(IConfiguration configuration) - { - // 统一时间日期格式 - Configure(options => - { - var jsonConfiguration = configuration.GetSection("Json"); - if (jsonConfiguration.Exists()) - { - jsonConfiguration.Bind(options); - } - }); - // 中文序列化的编码问题 - Configure(options => - { - options.JsonSerializerOptions.Encoder = JavaScriptEncoder.Create(UnicodeRanges.All); - }); - } - - private void ConfigureDistributedLock(IServiceCollection services, IConfiguration configuration) - { - var distributedLockIsEnabled = configuration["DistributedLock:IsEnabled"]; - if (distributedLockIsEnabled.IsNullOrWhiteSpace() || bool.Parse(distributedLockIsEnabled)) - { - var redis = ConnectionMultiplexer.Connect(configuration["DistributedLock:Redis:Configuration"]); - services.AddSingleton(_ => new RedisDistributedSynchronizationProvider(redis.GetDatabase())); - } - } - - private void ConfigureOpenTelemetry(IServiceCollection services, IConfiguration configuration) - { - var openTelemetryEnabled = configuration["OpenTelemetry:IsEnabled"]; - if (openTelemetryEnabled.IsNullOrEmpty() || bool.Parse(openTelemetryEnabled)) - { - services.AddOpenTelemetry() - .ConfigureResource(resource => - { - resource.AddService(ApplicationName); - }) - .WithTracing(tracing => - { - tracing.AddHttpClientInstrumentation(); - tracing.AddAspNetCoreInstrumentation(); - tracing.AddCapInstrumentation(); - tracing.AddEntityFrameworkCoreInstrumentation(); - tracing.AddSource(ApplicationName); - - var tracingOtlpEndpoint = configuration["OpenTelemetry:Otlp:Endpoint"]; - if (!tracingOtlpEndpoint.IsNullOrWhiteSpace()) - { - tracing.AddOtlpExporter(otlpOptions => - { - otlpOptions.Endpoint = new Uri(tracingOtlpEndpoint); - }); - return; - } - - var zipkinEndpoint = configuration["OpenTelemetry:ZipKin:Endpoint"]; - if (!zipkinEndpoint.IsNullOrWhiteSpace()) - { - tracing.AddZipkinExporter(zipKinOptions => - { - zipKinOptions.Endpoint = new Uri(zipkinEndpoint); - }); - return; - } - }) - .WithMetrics(metrics => - { - metrics.AddRuntimeInstrumentation(); - metrics.AddHttpClientInstrumentation(); - metrics.AddAspNetCoreInstrumentation(); - }); - } - } - - private void ConfigureExceptionHandling() - { - // 自定义需要处理的异常 - Configure(options => - { - // 加入需要处理的异常类型 - options.Handlers.Add(); - options.Handlers.Add(); - options.Handlers.Add(); - options.Handlers.Add(); - options.Handlers.Add(); - options.Handlers.Add(); - }); - // 自定义需要发送邮件通知的异常类型 - Configure(options => - { - // 是否发送堆栈信息 - options.SendStackTrace = true; - // 未指定异常接收者的默认接收邮件 - // 指定自己的邮件地址 - }); - } - - private void ConfigureIdentity(IConfiguration configuration) - { - Configure(options => - { - options.IsDynamicClaimsEnabled = true; - var refreshClaimsUrl = configuration["App:RefreshClaimsUrl"]; - if (!refreshClaimsUrl.IsNullOrWhiteSpace()) - { - options.RemoteRefreshUrl = refreshClaimsUrl + options.RemoteRefreshUrl; - } - }); - } - - private void ConfigureAuditing(IConfiguration configuration) - { - Configure(options => - { - options.ApplicationName = ApplicationName; - // 是否启用实体变更记录 - var allEntitiesSelectorIsEnabled = configuration["Auditing:AllEntitiesSelector"]; - if (allEntitiesSelectorIsEnabled.IsNullOrWhiteSpace() || bool.Parse(allEntitiesSelectorIsEnabled)) - { - options.EntityHistorySelectors.AddAllEntities(); - } - }); - } - - private void ConfigureCaching(IConfiguration configuration) - { - Configure(options => - { - configuration.GetSection("DistributedCache").Bind(options); - }); - - Configure(options => - { - var redisConfig = ConfigurationOptions.Parse(options.Configuration); - options.ConfigurationOptions = redisConfig; - options.InstanceName = configuration["Redis:InstanceName"]; - }); - } - - private void ConfigureMvc(IServiceCollection services, IConfiguration configuration) - { - Configure(options => - { - options.ExposeIntegrationServices = true; - }); - - Configure(options => - { - options.EndpointConfigureActions.Add((builder) => - { - builder.Endpoints.MapHealthChecks(configuration["App:HealthChecks"] ?? "/healthz"); - }); - }); - - services.AddHealthChecks(); - } - - private void ConfigureVirtualFileSystem() - { - Configure(options => - { - options.FileSets.AddEmbedded("PackageName.CompanyName.ProjectName"); - }); - } - - private void ConfigureMultiTenancy(IConfiguration configuration) - { - // 多租户 - Configure(options => - { - options.IsEnabled = true; - }); - - var tenantResolveCfg = configuration.GetSection("App:Domains"); - if (tenantResolveCfg.Exists()) - { - Configure(options => - { - var domains = tenantResolveCfg.Get(); - foreach (var domain in domains) - { - options.AddDomainTenantResolver(domain); - } - }); - } - } - - private void ConfigureSwagger(IServiceCollection services) - { - // Swagger - services.AddSwaggerGen( - options => - { - options.SwaggerDoc("v1", new OpenApiInfo { Title = "ProjectName API", Version = "v1" }); - options.DocInclusionPredicate((docName, description) => true); - options.CustomSchemaIds(type => type.FullName); - options.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme - { - Description = "JWT Authorization header using the Bearer scheme. Example: \"Authorization: Bearer {token}\"", - Name = "Authorization", - In = ParameterLocation.Header, - Scheme = "bearer", - Type = SecuritySchemeType.Http, - BearerFormat = "JWT" - }); - options.AddSecurityRequirement(new OpenApiSecurityRequirement - { - { - new OpenApiSecurityScheme - { - Reference = new OpenApiReference { Type = ReferenceType.SecurityScheme, Id = "Bearer" } - }, - new string[] { } - } - }); - options.OperationFilter(); - }); - } - - private void ConfigureLocalization() - { - // 支持本地化语言类型 - Configure(options => - { - options.Languages.Add(new LanguageInfo("en", "en", "English")); - options.Languages.Add(new LanguageInfo("zh-Hans", "zh-Hans", "简体中文")); - }); - - Configure(options => - { - // 持久化本地化资源 - options.SaveStaticLocalizationsToPersistence = true; - options.AddPersistenceResource(); - }); - - Configure(options => - { - var zhHansCultureMapInfo = new CultureMapInfo - { - TargetCulture = "zh-Hans", - SourceCultures = new string[] { "zh", "zh_CN", "zh-CN" } - }; - - options.CulturesMaps.Add(zhHansCultureMapInfo); - options.UiCulturesMaps.Add(zhHansCultureMapInfo); - }); - } - - private void ConfigureSecurity(IServiceCollection services, IConfiguration configuration, bool isDevelopment = false) - { - Configure(options => - { - // options.AutoValidate = false; - // options.AutoValidateFilter = (type) => !type.Namespace.Contains("elsa", StringComparison.CurrentCultureIgnoreCase); - }); - - services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) - .AddJwtBearer(options => - { - configuration.GetSection("AuthServer").Bind(options); - }); - - if (!isDevelopment) - { - var redis = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]); - services - .AddDataProtection() - .SetApplicationName("LINGYUN.Abp.Application") - .PersistKeysToStackExchangeRedis(redis, "LINGYUN.Abp.Application:DataProtection:Protection-Keys"); - } - } - - private void ConfigureCors(IServiceCollection services, IConfiguration configuration) - { - services.AddCors(options => - { - options.AddPolicy(DefaultCorsPolicyName, builder => - { - builder - .WithOrigins( - configuration["App:CorsOrigins"] - .Split(",", StringSplitOptions.RemoveEmptyEntries) - .Select(o => o.RemovePostFix("/")) - .ToArray() - ) - .WithAbpExposedHeaders() - .WithAbpWrapExposedHeaders() - .SetIsOriginAllowedToAllowWildcardSubdomains() - .AllowAnyHeader() - .AllowAnyMethod() - .AllowCredentials(); - }); - }); - } - - private void ConfigureWrapper() - { - Configure(options => - { - // 取消注释包装结果 - options.IsEnabled = true; - }); - } - - private void PreConfigureWrapper() - { - PreConfigure(options => - { - // http服务间调用发送不需要包装结果的请求头 - options.ProxyClientActions.Add( - (_, _, client) => - { - client.DefaultRequestHeaders.TryAddWithoutValidation(AbpHttpWrapConsts.AbpDontWrapResult, "true"); - }); - }); - - PreConfigure(options => - { - // dapr服务间调用发送不需要包装结果的请求头 - options.ProxyRequestActions.Add( - (appId, httpRequestMessage) => - { - httpRequestMessage.Headers.TryAddWithoutValidation(AbpHttpWrapConsts.AbpDontWrapResult, "true"); - }); - }); - } -} diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/ProjectNameHttpApiHostModule.cs b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/ProjectNameHttpApiHostModule.cs deleted file mode 100644 index 0419712fb..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/ProjectNameHttpApiHostModule.cs +++ /dev/null @@ -1,127 +0,0 @@ -using LINGYUN.Abp.AspNetCore.Mvc.Wrapper; -using LINGYUN.Abp.AuditLogging.Elasticsearch; -using LINGYUN.Abp.EventBus.CAP; -using LINGYUN.Abp.ExceptionHandling.Emailing; -using LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore; -using LINGYUN.Abp.TextTemplating.EntityFrameworkCore; -using LINGYUN.Abp.Saas.EntityFrameworkCore; -using LINGYUN.Abp.Serilog.Enrichers.Application; -using LINGYUN.Abp.Serilog.Enrichers.UniqueId; -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; -using PackageName.CompanyName.ProjectName.EntityFrameworkCore; -using PackageName.CompanyName.ProjectName.SettingManagement; -using Volo.Abp; -using Volo.Abp.AspNetCore.Authentication.JwtBearer; -using Volo.Abp.AspNetCore.MultiTenancy; -using Volo.Abp.AspNetCore.Serilog; -using Volo.Abp.Autofac; -using Volo.Abp.Caching.StackExchangeRedis; -using Volo.Abp.DistributedLocking; -using Volo.Abp.FeatureManagement.EntityFrameworkCore; -using Volo.Abp.Http.Client.IdentityModel.Web; -using Volo.Abp.Modularity; -using Volo.Abp.PermissionManagement.EntityFrameworkCore; -using Volo.Abp.SettingManagement.EntityFrameworkCore; -using Volo.Abp.Swashbuckle; -using LINGYUN.Abp.AspNetCore.HttpOverrides; -using LINGYUN.Abp.Identity.Session.AspNetCore; - -namespace PackageName.CompanyName.ProjectName; - -[DependsOn( - typeof(AbpSerilogEnrichersApplicationModule), - typeof(AbpSerilogEnrichersUniqueIdModule), - typeof(AbpAuditLoggingElasticsearchModule), - typeof(AbpAspNetCoreSerilogModule), - typeof(ProjectNameApplicationModule), - typeof(ProjectNameHttpApiModule), - typeof(ProjectNameEntityFrameworkCoreModule), - typeof(ProjectNameSettingManagementModule), - typeof(AbpEmailingExceptionHandlingModule), - typeof(AbpCAPEventBusModule), - typeof(AbpHttpClientIdentityModelWebModule), - typeof(AbpAspNetCoreMultiTenancyModule), - typeof(AbpSaasEntityFrameworkCoreModule), - typeof(AbpFeatureManagementEntityFrameworkCoreModule), - typeof(AbpPermissionManagementEntityFrameworkCoreModule), - typeof(AbpSettingManagementEntityFrameworkCoreModule), - typeof(AbpLocalizationManagementEntityFrameworkCoreModule), - typeof(AbpTextTemplatingEntityFrameworkCoreModule), - typeof(AbpAspNetCoreAuthenticationJwtBearerModule), - typeof(AbpCachingStackExchangeRedisModule), - typeof(AbpDistributedLockingModule), - typeof(AbpAspNetCoreMvcWrapperModule), - typeof(AbpAspNetCoreHttpOverridesModule), - typeof(AbpIdentitySessionAspNetCoreModule), - typeof(AbpSwashbuckleModule), - typeof(AbpAutofacModule) - )] -public partial class ProjectNameHttpApiHostModule : AbpModule -{ - public override void PreConfigureServices(ServiceConfigurationContext context) - { - var configuration = context.Services.GetConfiguration(); - - PreConfigureApp(); - PreConfigureWrapper(); - PreConfigureFeature(); - PreConfigureCAP(configuration); - } - - public override void ConfigureServices(ServiceConfigurationContext context) - { - var hostingEnvironment = context.Services.GetHostingEnvironment(); - var configuration = context.Services.GetConfiguration(); - - ConfigureWrapper(); - ConfigureLocalization(); - ConfigureExceptionHandling(); - ConfigureVirtualFileSystem(); - ConfigureCaching(configuration); - ConfigureAuditing(configuration); - ConfigureIdentity(configuration); - ConfigureMultiTenancy(configuration); - ConfigureJsonSerializer(configuration); - ConfigureSwagger(context.Services); - ConfigureMvc(context.Services, configuration); - ConfigureCors(context.Services, configuration); - ConfigureOpenTelemetry(context.Services, configuration); - ConfigureDistributedLock(context.Services, configuration); - ConfigureSecurity(context.Services, configuration, hostingEnvironment.IsDevelopment()); - } - - public override void OnApplicationInitialization(ApplicationInitializationContext context) - { - var app = context.GetApplicationBuilder(); - var env = context.GetEnvironment(); - - app.UseForwardedHeaders(); - app.UseMapRequestLocalization(); - app.UseCorrelationId(); - app.UseStaticFiles(); - app.UseRouting(); - app.UseCors(); - app.UseAuthentication(); - app.UseJwtTokenMiddleware(); - app.UseMultiTenancy(); - app.UseAbpSession(); - app.UseDynamicClaims(); - app.UseAuthorization(); - app.UseSwagger(); - app.UseAbpSwaggerUI(options => - { - options.SwaggerEndpoint("/swagger/v1/swagger.json", "Support ProjectName API"); - - var configuration = context.GetConfiguration(); - options.OAuthClientId(configuration["AuthServer:SwaggerClientId"]); - options.OAuthClientSecret(configuration["AuthServer:SwaggerClientSecret"]); - options.OAuthScopes("ProjectName"); - }); - app.UseAuditing(); - app.UseAbpSerilogEnrichers(); - app.UseConfiguredEndpoints(); - } -} diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/Properties/launchSettings.json b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/Properties/launchSettings.json deleted file mode 100644 index bfc8f50b6..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/Properties/launchSettings.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:20890", - "sslPort": 0 - } - }, - "profiles": { - "PackageName.CompanyName.ProjectName.HttpApi.Host": { - "commandName": "Project", - "launchBrowser": false, - "dotnetRunMessages": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - }, - "applicationUrl": "http://127.0.0.1:5000" - }, - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": false, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - } - } -} \ No newline at end of file diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/TenantHeaderParamter.cs b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/TenantHeaderParamter.cs deleted file mode 100644 index 265c287de..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/TenantHeaderParamter.cs +++ /dev/null @@ -1,31 +0,0 @@ -using Microsoft.Extensions.Options; -using Microsoft.OpenApi.Models; -using Swashbuckle.AspNetCore.SwaggerGen; -using System.Collections.Generic; -using Volo.Abp.MultiTenancy; - -namespace PackageName.CompanyName.ProjectName; - -public class TenantHeaderParamter : IOperationFilter -{ - private readonly AbpMultiTenancyOptions _options; - public TenantHeaderParamter( - IOptions options) - { - _options = options.Value; - } - public void Apply(OpenApiOperation operation, OperationFilterContext context) - { - if (_options.IsEnabled) - { - operation.Parameters = operation.Parameters ?? new List(); - operation.Parameters.Add(new OpenApiParameter - { - Name = TenantResolverConsts.DefaultTenantKey, - In = ParameterLocation.Header, - Description = "Tenant Id/Name", - Required = false - }); - } - } -} diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/appsettings.Development.json b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/appsettings.Development.json deleted file mode 100644 index f1c0abd6e..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/appsettings.Development.json +++ /dev/null @@ -1,153 +0,0 @@ -{ - "AgileConfig": { - "IsEnabled": false, - "env": "DEV", - "appId": "PackageName.CompanyName.ProjectName", - "secret": "1q2w3E*", - "nodes": "http://127.0.0.1:15000", - "name": "PackageName.CompanyName.ProjectName", - "tag": "PackageName.CompanyName.ProjectName" - }, - "App": { - "CorsOrigins": "http://127.0.0.1:30000", - "RefreshClaimsUrl": "http://127.0.0.1:30015/", - "HealthChecks": "/healthz" - }, - "Auditing": { - "AllEntitiesSelector": true - }, - "DistributedCache": { - "HideErrors": true, - "KeyPrefix": "LINGYUN.Abp.Application", - "GlobalCacheEntryOptions": { - "SlidingExpiration": "30:00:00", - "AbsoluteExpirationRelativeToNow": "60:00:00" - } - }, - "ConnectionStrings": { - "Default": "Server=127.0.0.1;Database=ProjectName;User Id=root;Password=123456", - "ProjectName": "Server=127.0.0.1;Database=ProjectName;User Id=root;Password=123456", - "AbpSaas": "Server=127.0.0.1;Database=ProjectName;User Id=root;Password=123456", - "AbpFeatureManagement": "Server=127.0.0.1;Database=ProjectName;User Id=root;Password=123456", - "AbpPermissionManagement": "Server=127.0.0.1;Database=ProjectName;User Id=root;Password=123456", - "AbpSettingManagement": "Server=127.0.0.1;Database=ProjectName;User Id=root;Password=123456", - "AbpLocalizationManagement": "Server=127.0.0.1;Database=ProjectName;User Id=root;Password=123456", - "AbpTextTemplating": "Server=127.0.0.1;Database=ProjectName;User Id=root;Password=123456" - }, - "DistributedLock": { - "IsEnabled": true, - "Redis": { - "Configuration": "127.0.0.1,defaultDatabase=15" - } - }, - "OpenTelemetry": { - "IsEnabled": true, - "ZipKin": { - "Endpoint": "http://127.0.0.1:9411/api/v2/spans" - } - }, - "RemoteServices": {}, - "IdentityClients": { - "InternalServiceClient": { - "Authority": "http://127.0.0.1:44385", - "RequireHttps": false, - "MapInboundClaims": false, - "GrantType": "client_credentials", - "Scope": "lingyun-abp-application", - "ClientId": "InternalServiceClient", - "ClientSecret": "1q2w3E*" - } - }, - "CAP": { - "EventBus": { - "DefaultGroupName": "ProjectName", - "GroupNamePrefix": "Dev", - "Version": "v1", - "FailedRetryInterval": 300, - "FailedRetryCount": 10 - }, - "MySql": { - "TableNamePrefix": "ProjectName_cap", - "ConnectionString": "Server=127.0.0.1;Database=ProjectName;User Id=root;Password=123456" - }, - "SqlServer": { - "TableNamePrefix": "ProjectName_cap", - "ConnectionString": "Server=127.0.0.1;Database=ProjectName;User Id=root;Password=123456" - }, - "Sqlite": { - "TableNamePrefix": "ProjectName_cap", - "ConnectionString": "Data Source=./cap.db" - }, - "Oracle": { - "TableNamePrefix": "ProjectName_cap", - "ConnectionString": "Data Source=ProjectName;Integrated Security=yes;" - }, - "PostgreSql": { - "TableNamePrefix": "ProjectName_cap", - "ConnectionString": "Host=localhost;Port=5432;Database=ProjectName;User ID=root;Password=123456;" - }, - "RabbitMQ": { - "HostName": "127.0.0.1", - "Port": 5672, - "UserName": "admin", - "Password": "123456", - "ExchangeName": "LINGYUN.Abp.Application", - "VirtualHost": "/" - } - }, - "Redis": { - "Configuration": "127.0.0.1,defaultDatabase=10", - "InstanceName": "LINGYUN.Abp.Application" - }, - "AuthServer": { - "Authority": "http://127.0.0.1:44385/", - "Audience": "lingyun-abp-application", - "MapInboundClaims": false, - "RequireHttpsMetadata": false, - "SwaggerClientId": "InternalServiceClient", - "SwaggerClientSecret": "1q2w3E*" - }, - "Logging": { - "Serilog": { - "Elasticsearch": { - "IndexFormat": "abp.dev.logging-{0:yyyy.MM.dd}" - } - } - }, - "AuditLogging": { - "Elasticsearch": { - "IndexPrefix": "abp.dev.auditing" - } - }, - "Elasticsearch": { - "NodeUris": "http://127.0.0.1:9200" - }, - "Serilog": { - "MinimumLevel": { - "Default": "Debug", - "Override": { - "System": "Warning", - "Microsoft": "Warning", - "DotNetCore": "Debug" - } - }, - "WriteTo": [ - { - "Name": "Console", - "Args": { - "restrictedToMinimumLevel": "Debug", - "outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss} [{Level:u3}] [{SourceContext}] [{ProcessId}] [{ThreadId}] - {Message:lj}{NewLine}{Exception}" - } - }, - { - "Name": "Elasticsearch", - "Args": { - "nodeUris": "http://127.0.0.1:9200", - "indexFormat": "abp.dev.logging-{0:yyyy.MM.dd}", - "autoRegisterTemplate": true, - "autoRegisterTemplateVersion": "ESv7" - } - } - ] - } -} diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/appsettings.json b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/appsettings.json deleted file mode 100644 index 21ae8a60f..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/appsettings.json +++ /dev/null @@ -1,88 +0,0 @@ -{ - "Clock": { - "Kind": "Local" - }, - "Forwarded": { - "ForwardedHeaders": "XForwardedFor,XForwardedProto" - }, - "StringEncryption": { - "DefaultPassPhrase": "s46c5q55nxpeS8Ra", - "InitVectorBytes": "s83ng0abvd02js84", - "DefaultSalt": "sf&5)s3#" - }, - "Json": { - "OutputDateTimeFormat": "yyyy-MM-dd HH:mm:ss", - "InputDateTimeFormats": [ - "yyyy-MM-dd HH:mm:ss", - "yyyy-MM-ddTHH:mm:ss" - ] - }, - "AllowedHosts": "*", - "Serilog": { - "MinimumLevel": { - "Default": "Debug", - "Override": { - "Microsoft.EntityFrameworkCore": "Debug", - "System": "Information", - "Microsoft": "Information" - } - }, - "Enrich": [ "FromLogContext", "WithProcessId", "WithThreadId", "WithEnvironmentName", "WithMachineName", "WithApplicationName", "WithUniqueId" ], - "WriteTo": [ - { - "Name": "Console", - "Args": { - "initialMinimumLevel": "Verbose", - "standardErrorFromLevel": "Verbose", - "restrictedToMinimumLevel": "Verbose", - "outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss} [{Level:u3}] [{SourceContext}] [{ProcessId}] [{ThreadId}] - {Message:lj}{NewLine}{Exception}" - } - }, - { - "Name": "File", - "Args": { - "path": "Logs/Debug-.log", - "restrictedToMinimumLevel": "Debug", - "rollingInterval": "Day", - "outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss} [{Level:u3}] [{SourceContext}] [{ProcessId}] [{ThreadId}] - {Message:lj}{NewLine}{Exception}" - } - }, - { - "Name": "File", - "Args": { - "path": "Logs/Info-.log", - "restrictedToMinimumLevel": "Information", - "rollingInterval": "Day", - "outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss} [{Level:u3}] [{SourceContext}] [{ProcessId}] [{ThreadId}] - {Message:lj}{NewLine}{Exception}" - } - }, - { - "Name": "File", - "Args": { - "path": "Logs/Warn-.log", - "restrictedToMinimumLevel": "Warning", - "rollingInterval": "Day", - "outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss} [{Level:u3}] [{SourceContext}] [{ProcessId}] [{ThreadId}] - {Message:lj}{NewLine}{Exception}" - } - }, - { - "Name": "File", - "Args": { - "path": "Logs/Error-.log", - "restrictedToMinimumLevel": "Error", - "rollingInterval": "Day", - "outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss} [{Level:u3}] [{SourceContext}] [{ProcessId}] [{ThreadId}] - {Message:lj}{NewLine}{Exception}" - } - }, - { - "Name": "File", - "Args": { - "path": "Logs/Fatal-.log", - "restrictedToMinimumLevel": "Fatal", - "rollingInterval": "Day", - "outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss} [{Level:u3}] [{SourceContext}] [{ProcessId}] [{ThreadId}] - {Message:lj}{NewLine}{Exception}" - } - } - ] - } -} diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/dapr.sh b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/dapr.sh deleted file mode 100644 index 01a8eb036..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/dapr.sh +++ /dev/null @@ -1 +0,0 @@ -dapr run --app-id ProjectName --app-port 5000 -H 3500 -- dotnet run --no-build \ No newline at end of file diff --git a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/generate-proxy.sh b/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/generate-proxy.sh deleted file mode 100644 index 45013ae98..000000000 --- a/aspnet-core/templates/content/host/PackageName.CompanyName.ProjectName.HttpApi.Host/generate-proxy.sh +++ /dev/null @@ -1,2 +0,0 @@ -cd ../src/PackageName.CompanyName.ProjectName.HttpApi.Client -abp generate-proxy -t csharp -m ProjectName -url http://127.0.0.1:5000/ --without-contracts \ No newline at end of file diff --git a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Application.Contracts/FodyWeavers.xml b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Application.Contracts/FodyWeavers.xml deleted file mode 100644 index 1715698cc..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Application.Contracts/FodyWeavers.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Application.Contracts/FodyWeavers.xsd b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Application.Contracts/FodyWeavers.xsd deleted file mode 100644 index 11da52550..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Application.Contracts/FodyWeavers.xsd +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - '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/templates/content/src/PackageName.CompanyName.ProjectName.Application.Contracts/PackageName.CompanyName.ProjectName.Application.Contracts.csproj b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Application.Contracts/PackageName.CompanyName.ProjectName.Application.Contracts.csproj deleted file mode 100644 index 87d603432..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Application.Contracts/PackageName.CompanyName.ProjectName.Application.Contracts.csproj +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - netstandard2.0;netstandard2.1;net8.0 - PackageName.CompanyName.ProjectName.Application.Contracts - PackageName.CompanyName.ProjectName.Application.Contracts - false - false - false - - - - - - - - - - - - - - - diff --git a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Application.Contracts/PackageName/CompanyName/ProjectName/Features/ProjectNameFeatureDefinitionProvider.cs b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Application.Contracts/PackageName/CompanyName/ProjectName/Features/ProjectNameFeatureDefinitionProvider.cs deleted file mode 100644 index 0dd18f176..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Application.Contracts/PackageName/CompanyName/ProjectName/Features/ProjectNameFeatureDefinitionProvider.cs +++ /dev/null @@ -1,18 +0,0 @@ -using PackageName.CompanyName.ProjectName.Localization; -using Volo.Abp.Features; -using Volo.Abp.Localization; - -namespace PackageName.CompanyName.ProjectName.Features; - -public class ProjectNameFeatureDefinitionProvider : FeatureDefinitionProvider -{ - public override void Define(IFeatureDefinitionContext context) - { - var group = context.AddGroup(ProjectNameFeatureNames.GroupName, L("Features:ProjectName")); - } - - private static ILocalizableString L(string name) - { - return LocalizableString.Create(name); - } -} diff --git a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Application.Contracts/PackageName/CompanyName/ProjectName/Features/ProjectNameFeatureNames.cs b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Application.Contracts/PackageName/CompanyName/ProjectName/Features/ProjectNameFeatureNames.cs deleted file mode 100644 index 4af07a047..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Application.Contracts/PackageName/CompanyName/ProjectName/Features/ProjectNameFeatureNames.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace PackageName.CompanyName.ProjectName.Features; - -public static class ProjectNameFeatureNames -{ - public const string GroupName = "ProjectName"; -} diff --git a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Application.Contracts/PackageName/CompanyName/ProjectName/IProjectNameDynamicQueryableAppService.cs b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Application.Contracts/PackageName/CompanyName/ProjectName/IProjectNameDynamicQueryableAppService.cs deleted file mode 100644 index 6cb9ead42..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Application.Contracts/PackageName/CompanyName/ProjectName/IProjectNameDynamicQueryableAppService.cs +++ /dev/null @@ -1,10 +0,0 @@ -using LINGYUN.Abp.Dynamic.Queryable; - -namespace PackageName.CompanyName.ProjectName; -/// -/// 提供动态查询接口定义 -/// -/// 实体dto类型 -public interface IProjectNameDynamicQueryableAppService : IDynamicQueryableAppService -{ -} diff --git a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Application.Contracts/PackageName/CompanyName/ProjectName/Permissions/ProjectNamePermissionDefinitionProvider.cs b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Application.Contracts/PackageName/CompanyName/ProjectName/Permissions/ProjectNamePermissionDefinitionProvider.cs deleted file mode 100644 index 4a170551b..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Application.Contracts/PackageName/CompanyName/ProjectName/Permissions/ProjectNamePermissionDefinitionProvider.cs +++ /dev/null @@ -1,22 +0,0 @@ -using PackageName.CompanyName.ProjectName.Localization; -using Volo.Abp.Authorization.Permissions; -using Volo.Abp.Localization; - -namespace PackageName.CompanyName.ProjectName.Permissions; - -public class ProjectNamePermissionDefinitionProvider : PermissionDefinitionProvider -{ - public override void Define(IPermissionDefinitionContext context) - { - var group = context.AddGroup(ProjectNamePermissions.GroupName, L("Permission:ProjectName")); - - group.AddPermission( - ProjectNamePermissions.ManageSettings, - L("Permission:ManageSettings")); - } - - private static LocalizableString L(string name) - { - return LocalizableString.Create(name); - } -} diff --git a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Application.Contracts/PackageName/CompanyName/ProjectName/Permissions/ProjectNamePermissions.cs b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Application.Contracts/PackageName/CompanyName/ProjectName/Permissions/ProjectNamePermissions.cs deleted file mode 100644 index 98a957ff9..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Application.Contracts/PackageName/CompanyName/ProjectName/Permissions/ProjectNamePermissions.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace PackageName.CompanyName.ProjectName.Permissions; - -public static class ProjectNamePermissions -{ - public const string GroupName = "ProjectName"; - - public const string ManageSettings = GroupName + ".ManageSettings"; -} diff --git a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Application.Contracts/PackageName/CompanyName/ProjectName/ProjectNameApplicationContractsModule.cs b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Application.Contracts/PackageName/CompanyName/ProjectName/ProjectNameApplicationContractsModule.cs deleted file mode 100644 index 9899a0c97..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Application.Contracts/PackageName/CompanyName/ProjectName/ProjectNameApplicationContractsModule.cs +++ /dev/null @@ -1,17 +0,0 @@ -using LINGYUN.Abp.Dynamic.Queryable; -using Volo.Abp.Application; -using Volo.Abp.Authorization; -using Volo.Abp.Features; -using Volo.Abp.Modularity; - -namespace PackageName.CompanyName.ProjectName; - -[DependsOn( - typeof(AbpFeaturesModule), - typeof(AbpAuthorizationModule), - typeof(AbpDddApplicationContractsModule), - typeof(AbpDynamicQueryableApplicationContractsModule), - typeof(ProjectNameDomainSharedModule))] -public class ProjectNameApplicationContractsModule : AbpModule -{ -} diff --git a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Application.Contracts/PackageName/CompanyName/ProjectName/ProjectNameRemoteServiceConsts.cs b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Application.Contracts/PackageName/CompanyName/ProjectName/ProjectNameRemoteServiceConsts.cs deleted file mode 100644 index ef949b273..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Application.Contracts/PackageName/CompanyName/ProjectName/ProjectNameRemoteServiceConsts.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace PackageName.CompanyName.ProjectName; - -public static class ProjectNameRemoteServiceConsts -{ - public const string RemoteServiceName = "ProjectName"; - public const string ModuleName = "ProjectName"; -} diff --git a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Application/FodyWeavers.xml b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Application/FodyWeavers.xml deleted file mode 100644 index 1715698cc..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Application/FodyWeavers.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Application/FodyWeavers.xsd b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Application/FodyWeavers.xsd deleted file mode 100644 index 11da52550..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Application/FodyWeavers.xsd +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - '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/templates/content/src/PackageName.CompanyName.ProjectName.Application/PackageName.CompanyName.ProjectName.Application.csproj b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Application/PackageName.CompanyName.ProjectName.Application.csproj deleted file mode 100644 index d376fcd4a..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Application/PackageName.CompanyName.ProjectName.Application.csproj +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - net8.0 - PackageName.CompanyName.ProjectName.Application - PackageName.CompanyName.ProjectName.Application - false - false - false - - - - - - - - - - - - - - diff --git a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Application/PackageName/CompanyName/ProjectName/ProjectNameAppServiceBase.cs b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Application/PackageName/CompanyName/ProjectName/ProjectNameAppServiceBase.cs deleted file mode 100644 index 458c4dd29..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Application/PackageName/CompanyName/ProjectName/ProjectNameAppServiceBase.cs +++ /dev/null @@ -1,13 +0,0 @@ -using PackageName.CompanyName.ProjectName.Localization; -using Volo.Abp.Application.Services; - -namespace PackageName.CompanyName.ProjectName; - -public abstract class ProjectNameAppServiceBase : ApplicationService -{ - protected ProjectNameAppServiceBase() - { - LocalizationResource = typeof(ProjectNameResource); - ObjectMapperContext = typeof(ProjectNameApplicationModule); - } -} diff --git a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Application/PackageName/CompanyName/ProjectName/ProjectNameApplicationMapperProfile.cs b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Application/PackageName/CompanyName/ProjectName/ProjectNameApplicationMapperProfile.cs deleted file mode 100644 index b16e2bc1b..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Application/PackageName/CompanyName/ProjectName/ProjectNameApplicationMapperProfile.cs +++ /dev/null @@ -1,10 +0,0 @@ -using AutoMapper; - -namespace PackageName.CompanyName.ProjectName; - -public class ProjectNameApplicationMapperProfile : Profile -{ - public ProjectNameApplicationMapperProfile() - { - } -} diff --git a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Application/PackageName/CompanyName/ProjectName/ProjectNameApplicationModule.cs b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Application/PackageName/CompanyName/ProjectName/ProjectNameApplicationModule.cs deleted file mode 100644 index 723aa233e..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Application/PackageName/CompanyName/ProjectName/ProjectNameApplicationModule.cs +++ /dev/null @@ -1,27 +0,0 @@ -using LINGYUN.Abp.Dynamic.Queryable; -using Microsoft.Extensions.DependencyInjection; -using Volo.Abp.Application; -using Volo.Abp.Authorization; -using Volo.Abp.AutoMapper; -using Volo.Abp.Modularity; - -namespace PackageName.CompanyName.ProjectName; - -[DependsOn( - typeof(AbpAuthorizationModule), - typeof(AbpDddApplicationModule), - typeof(ProjectNameDomainModule), - typeof(ProjectNameApplicationContractsModule), - typeof(AbpDynamicQueryableApplicationModule))] -public class ProjectNameApplicationModule : AbpModule -{ - public override void ConfigureServices(ServiceConfigurationContext context) - { - context.Services.AddAutoMapperObjectMapper(); - - Configure(options => - { - options.AddProfile(validate: true); - }); - } -} diff --git a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Application/PackageName/CompanyName/ProjectName/ProjectNameDynamicQueryableAppServiceBase.cs b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Application/PackageName/CompanyName/ProjectName/ProjectNameDynamicQueryableAppServiceBase.cs deleted file mode 100644 index 36e98d204..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Application/PackageName/CompanyName/ProjectName/ProjectNameDynamicQueryableAppServiceBase.cs +++ /dev/null @@ -1,19 +0,0 @@ -using LINGYUN.Abp.Dynamic.Queryable; -using PackageName.CompanyName.ProjectName.Localization; - -namespace PackageName.CompanyName.ProjectName; -/// -/// 提供动态查询接口实现 -/// -/// 实体类型 -/// 实体dto类型 -public abstract class ProjectNameDynamicQueryableAppServiceBase : - DynamicQueryableAppService, - IProjectNameDynamicQueryableAppService -{ - protected ProjectNameDynamicQueryableAppServiceBase() - { - LocalizationResource = typeof(ProjectNameResource); - ObjectMapperContext = typeof(ProjectNameApplicationModule); - } -} diff --git a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Application/System/Linq/Expressions/ExpressionFuncExtensions.cs b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Application/System/Linq/Expressions/ExpressionFuncExtensions.cs deleted file mode 100644 index fd7a017ea..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Application/System/Linq/Expressions/ExpressionFuncExtensions.cs +++ /dev/null @@ -1,32 +0,0 @@ -using Volo.Abp.Specifications; - -namespace System.Linq.Expressions; - -internal static class ExpressionFuncExtensions -{ - public static Expression> AndIf( - this Expression> first, - bool condition, - Expression> second) - { - if (condition) - { - return ExpressionFuncExtender.And(first, second); - } - - return first; - } - - public static Expression> OrIf( - this Expression> first, - bool condition, - Expression> second) - { - if (condition) - { - return ExpressionFuncExtender.Or(first, second); - } - - return first; - } -} diff --git a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Dapr.Client/FodyWeavers.xml b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Dapr.Client/FodyWeavers.xml deleted file mode 100644 index 1715698cc..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Dapr.Client/FodyWeavers.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Dapr.Client/FodyWeavers.xsd b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Dapr.Client/FodyWeavers.xsd deleted file mode 100644 index 11da52550..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Dapr.Client/FodyWeavers.xsd +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - '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/templates/content/src/PackageName.CompanyName.ProjectName.Dapr.Client/PackageName.CompanyName.ProjectName.Dapr.Client.csproj b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Dapr.Client/PackageName.CompanyName.ProjectName.Dapr.Client.csproj deleted file mode 100644 index 4372fdff4..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Dapr.Client/PackageName.CompanyName.ProjectName.Dapr.Client.csproj +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - net8.0 - - - - - - - - - - - - diff --git a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Dapr.Client/PackageName/CompanyName/ProjectName/ProjectNameDaprClientModule.cs b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Dapr.Client/PackageName/CompanyName/ProjectName/ProjectNameDaprClientModule.cs deleted file mode 100644 index 81707fa2f..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Dapr.Client/PackageName/CompanyName/ProjectName/ProjectNameDaprClientModule.cs +++ /dev/null @@ -1,18 +0,0 @@ -using LINGYUN.Abp.Dapr.Client; -using Microsoft.Extensions.DependencyInjection; -using Volo.Abp.Modularity; - -namespace PackageName.CompanyName.ProjectName; - -[DependsOn( - typeof(AbpDaprClientModule), - typeof(ProjectNameApplicationContractsModule))] -public class ProjectNameDaprClientModule : AbpModule -{ - public override void ConfigureServices(ServiceConfigurationContext context) - { - context.Services.AddStaticDaprClientProxies( - typeof(ProjectNameApplicationContractsModule).Assembly, - ProjectNameRemoteServiceConsts.RemoteServiceName); - } -} diff --git a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Domain.Shared/FodyWeavers.xml b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Domain.Shared/FodyWeavers.xml deleted file mode 100644 index 1715698cc..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Domain.Shared/FodyWeavers.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Domain.Shared/FodyWeavers.xsd b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Domain.Shared/FodyWeavers.xsd deleted file mode 100644 index 11da52550..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Domain.Shared/FodyWeavers.xsd +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - '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/templates/content/src/PackageName.CompanyName.ProjectName.Domain.Shared/PackageName.CompanyName.ProjectName.Domain.Shared.csproj b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Domain.Shared/PackageName.CompanyName.ProjectName.Domain.Shared.csproj deleted file mode 100644 index b9172c86a..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Domain.Shared/PackageName.CompanyName.ProjectName.Domain.Shared.csproj +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - netstandard2.0;netstandard2.1;net8.0 - PackageName.CompanyName.ProjectName.Domain.Shared - PackageName.CompanyName.ProjectName.Domain.Shared - false - false - false - - - - - - - - - - - - - - - - - - diff --git a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Domain.Shared/PackageName/CompanyName/ProjectName/Localization/ProjectNameResource.cs b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Domain.Shared/PackageName/CompanyName/ProjectName/Localization/ProjectNameResource.cs deleted file mode 100644 index 11db159c1..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Domain.Shared/PackageName/CompanyName/ProjectName/Localization/ProjectNameResource.cs +++ /dev/null @@ -1,8 +0,0 @@ -using Volo.Abp.Localization; - -namespace PackageName.CompanyName.ProjectName.Localization; - -[LocalizationResourceName("ProjectName")] -public class ProjectNameResource -{ -} diff --git a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Domain.Shared/PackageName/CompanyName/ProjectName/Localization/Resources/en.json b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Domain.Shared/PackageName/CompanyName/ProjectName/Localization/Resources/en.json deleted file mode 100644 index a529d6960..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Domain.Shared/PackageName/CompanyName/ProjectName/Localization/Resources/en.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "culture": "en", - "texts": { - "Features:ProjectName": "ProjectName", - "Permission:ProjectName": "ProjectName", - "Permission:ManageSettings": "Manage Settings" - } -} \ No newline at end of file diff --git a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Domain.Shared/PackageName/CompanyName/ProjectName/Localization/Resources/zh-Hans.json b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Domain.Shared/PackageName/CompanyName/ProjectName/Localization/Resources/zh-Hans.json deleted file mode 100644 index e2af58de8..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Domain.Shared/PackageName/CompanyName/ProjectName/Localization/Resources/zh-Hans.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "culture": "zh-Hans", - "texts": { - "Features:ProjectName": "ProjectName", - "Permission:ProjectName": "ProjectName", - "Permission:ManageSettings": "管理设置" - } -} \ No newline at end of file diff --git a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Domain.Shared/PackageName/CompanyName/ProjectName/ObjectExtending/ProjectNameModuleExtensionConfiguration.cs b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Domain.Shared/PackageName/CompanyName/ProjectName/ObjectExtending/ProjectNameModuleExtensionConfiguration.cs deleted file mode 100644 index 6ce706932..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Domain.Shared/PackageName/CompanyName/ProjectName/ObjectExtending/ProjectNameModuleExtensionConfiguration.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using Volo.Abp.ObjectExtending.Modularity; - -namespace PackageName.CompanyName.ProjectName.ObjectExtending; - -public class ProjectNameModuleExtensionConfiguration : ModuleExtensionConfiguration -{ - public ProjectNameModuleExtensionConfiguration ConfigureProjectName( - Action configureAction) - { - return this.ConfigureEntity( - ProjectNameModuleExtensionConsts.EntityNames.Entity, - configureAction - ); - } -} diff --git a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Domain.Shared/PackageName/CompanyName/ProjectName/ObjectExtending/ProjectNameModuleExtensionConfigurationDictionaryExtensions.cs b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Domain.Shared/PackageName/CompanyName/ProjectName/ObjectExtending/ProjectNameModuleExtensionConfigurationDictionaryExtensions.cs deleted file mode 100644 index d59e7c515..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Domain.Shared/PackageName/CompanyName/ProjectName/ObjectExtending/ProjectNameModuleExtensionConfigurationDictionaryExtensions.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using Volo.Abp.ObjectExtending.Modularity; - -namespace PackageName.CompanyName.ProjectName.ObjectExtending; - -public static class ProjectNameModuleExtensionConfigurationDictionaryExtensions -{ - public static ModuleExtensionConfigurationDictionary ConfigureProjectName( - this ModuleExtensionConfigurationDictionary modules, - Action configureAction) - { - return modules.ConfigureModule( - ProjectNameModuleExtensionConsts.ModuleName, - configureAction - ); - } -} diff --git a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Domain.Shared/PackageName/CompanyName/ProjectName/ObjectExtending/ProjectNameModuleExtensionConsts.cs b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Domain.Shared/PackageName/CompanyName/ProjectName/ObjectExtending/ProjectNameModuleExtensionConsts.cs deleted file mode 100644 index dd5e13da8..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Domain.Shared/PackageName/CompanyName/ProjectName/ObjectExtending/ProjectNameModuleExtensionConsts.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace PackageName.CompanyName.ProjectName.ObjectExtending; - -public static class ProjectNameModuleExtensionConsts -{ - public const string ModuleName = "ProjectName"; - - public static class EntityNames - { - public const string Entity = "Entity"; - } -} diff --git a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Domain.Shared/PackageName/CompanyName/ProjectName/ProjectNameDomainSharedModule.cs b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Domain.Shared/PackageName/CompanyName/ProjectName/ProjectNameDomainSharedModule.cs deleted file mode 100644 index 7473c7453..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Domain.Shared/PackageName/CompanyName/ProjectName/ProjectNameDomainSharedModule.cs +++ /dev/null @@ -1,32 +0,0 @@ -using PackageName.CompanyName.ProjectName.Localization; -using Volo.Abp.Localization; -using Volo.Abp.Localization.ExceptionHandling; -using Volo.Abp.Modularity; -using Volo.Abp.VirtualFileSystem; - -namespace PackageName.CompanyName.ProjectName; - -[DependsOn( - typeof(AbpLocalizationModule))] -public class ProjectNameDomainSharedModule : AbpModule -{ - public override void ConfigureServices(ServiceConfigurationContext context) - { - Configure(options => - { - options.FileSets.AddEmbedded(); - }); - - Configure(options => - { - options.Resources - .Add() - .AddVirtualJson("/PackageName/CompanyName/ProjectName/Localization/Resources"); - }); - - Configure(options => - { - options.MapCodeNamespace(ProjectNameErrorCodes.Namespace, typeof(ProjectNameResource)); - }); - } -} diff --git a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Domain.Shared/PackageName/CompanyName/ProjectName/ProjectNameErrorCodes.cs b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Domain.Shared/PackageName/CompanyName/ProjectName/ProjectNameErrorCodes.cs deleted file mode 100644 index 7a652e651..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Domain.Shared/PackageName/CompanyName/ProjectName/ProjectNameErrorCodes.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace PackageName.CompanyName.ProjectName; - -public static class ProjectNameErrorCodes -{ - public const string Namespace = "ProjectName"; -} diff --git a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Domain/FodyWeavers.xml b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Domain/FodyWeavers.xml deleted file mode 100644 index 1715698cc..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Domain/FodyWeavers.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Domain/FodyWeavers.xsd b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Domain/FodyWeavers.xsd deleted file mode 100644 index 11da52550..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Domain/FodyWeavers.xsd +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - '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/templates/content/src/PackageName.CompanyName.ProjectName.Domain/PackageName.CompanyName.ProjectName.Domain.csproj b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Domain/PackageName.CompanyName.ProjectName.Domain.csproj deleted file mode 100644 index b8f035091..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Domain/PackageName.CompanyName.ProjectName.Domain.csproj +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - net8.0 - PackageName.CompanyName.ProjectName.Domain - PackageName.CompanyName.ProjectName.Domain - false - false - false - - - - - - - - - - - - - - - diff --git a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Domain/PackageName/CompanyName/ProjectName/IProjectNameBasicRepository.cs b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Domain/PackageName/CompanyName/ProjectName/IProjectNameBasicRepository.cs deleted file mode 100644 index 290e09398..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Domain/PackageName/CompanyName/ProjectName/IProjectNameBasicRepository.cs +++ /dev/null @@ -1,54 +0,0 @@ -using LINGYUN.Abp.DataProtection; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; -using Volo.Abp.Domain.Entities; -using Volo.Abp.Specifications; - -namespace PackageName.CompanyName.ProjectName; -/// -/// 基本仓储接口 -/// -/// 实体类型 -/// 实体主键类型 -public interface IProjectNameBasicRepository : IDataProtectionRepository - where TEntity : class, IEntity -{ - /// - /// 获取过滤后的实体数量 - /// - /// - /// - /// - Task GetCountAsync( - ISpecification specification, - CancellationToken cancellationToken = default); - /// - /// 获取过滤后的实体列表(分页) - /// - /// - /// - /// - /// - /// - /// - Task> GetListAsync( - ISpecification specification, - string sorting = nameof(IEntity.Id), - int maxResultCount = 10, - int skipCount = 0, - CancellationToken cancellationToken = default); - /// - /// 获取过滤后的实体列表 - /// - /// - /// - /// - /// - /// - Task> GetListAsync( - ISpecification specification, - string sorting = nameof(IEntity.Id), - int maxResultCount = 10, - CancellationToken cancellationToken = default); -} diff --git a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Domain/PackageName/CompanyName/ProjectName/ProjectNameDbProperties.cs b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Domain/PackageName/CompanyName/ProjectName/ProjectNameDbProperties.cs deleted file mode 100644 index 5cd27642b..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Domain/PackageName/CompanyName/ProjectName/ProjectNameDbProperties.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace PackageName.CompanyName.ProjectName; - -public static class ProjectNameDbProperties -{ - public static string DbTablePrefix { get; set; } = "ProjectName_"; - - public static string DbSchema { get; set; } = null; - - - public const string ConnectionStringName = "ProjectName"; -} diff --git a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Domain/PackageName/CompanyName/ProjectName/ProjectNameDomainMapperProfile.cs b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Domain/PackageName/CompanyName/ProjectName/ProjectNameDomainMapperProfile.cs deleted file mode 100644 index b2cc42748..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Domain/PackageName/CompanyName/ProjectName/ProjectNameDomainMapperProfile.cs +++ /dev/null @@ -1,11 +0,0 @@ -using AutoMapper; - -namespace PackageName.CompanyName.ProjectName; - -public class ProjectNameDomainMapperProfile : Profile -{ - public ProjectNameDomainMapperProfile() - { - - } -} diff --git a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Domain/PackageName/CompanyName/ProjectName/ProjectNameDomainModule.cs b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Domain/PackageName/CompanyName/ProjectName/ProjectNameDomainModule.cs deleted file mode 100644 index 715c1c3b2..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Domain/PackageName/CompanyName/ProjectName/ProjectNameDomainModule.cs +++ /dev/null @@ -1,45 +0,0 @@ -using LINGYUN.Abp.DataProtection; -using Microsoft.Extensions.DependencyInjection; -using PackageName.CompanyName.ProjectName.ObjectExtending; -using Volo.Abp.AutoMapper; -using Volo.Abp.Domain.Entities.Events.Distributed; -using Volo.Abp.Modularity; -using Volo.Abp.ObjectExtending.Modularity; -using Volo.Abp.Threading; - -namespace PackageName.CompanyName.ProjectName; - -[DependsOn( - typeof(AbpAutoMapperModule), - typeof(AbpDataProtectionModule), - typeof(ProjectNameDomainSharedModule))] -public class ProjectNameDomainModule : AbpModule -{ - private static readonly OneTimeRunner OneTimeRunner = new(); - public override void ConfigureServices(ServiceConfigurationContext context) - { - context.Services.AddAutoMapperObjectMapper(); - - Configure(options => - { - options.AddProfile(validate: true); - }); - - Configure(options => - { - }); - } - - public override void PostConfigureServices(ServiceConfigurationContext context) - { - OneTimeRunner.Run(() => - { - // 扩展实体配置 - //ModuleExtensionConfigurationHelper.ApplyEntityConfigurationToEntity( - // ProjectNameModuleExtensionConsts.ModuleName, - // ProjectNameModuleExtensionConsts.EntityNames.Entity, - // typeof(Entity) - //); - }); - } -} diff --git a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Domain/PackageName/CompanyName/ProjectName/Settings/ProjectNameSettingDefinitionProvider.cs b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Domain/PackageName/CompanyName/ProjectName/Settings/ProjectNameSettingDefinitionProvider.cs deleted file mode 100644 index 3845b6ba7..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Domain/PackageName/CompanyName/ProjectName/Settings/ProjectNameSettingDefinitionProvider.cs +++ /dev/null @@ -1,10 +0,0 @@ -using Volo.Abp.Settings; - -namespace PackageName.CompanyName.ProjectName.Settings; - -public class ProjectNameSettingDefinitionProvider : SettingDefinitionProvider -{ - public override void Define(ISettingDefinitionContext context) - { - } -} diff --git a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Domain/PackageName/CompanyName/ProjectName/Settings/ProjectNameSettings.cs b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Domain/PackageName/CompanyName/ProjectName/Settings/ProjectNameSettings.cs deleted file mode 100644 index 5d6afce6c..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Domain/PackageName/CompanyName/ProjectName/Settings/ProjectNameSettings.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace PackageName.CompanyName.ProjectName.Settings; - -public static class ProjectNameSettings -{ - public const string GroupName = "ProjectName"; -} diff --git a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Domain/System/Linq/Expressions/ExpressionFuncExtensions.cs b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Domain/System/Linq/Expressions/ExpressionFuncExtensions.cs deleted file mode 100644 index 74e3c828a..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.Domain/System/Linq/Expressions/ExpressionFuncExtensions.cs +++ /dev/null @@ -1,32 +0,0 @@ -using Volo.Abp.Specifications; - -namespace System.Linq.Expressions; - -internal static class ExpressionFuncExtensions -{ - public static Expression> AndIf( - this Expression> first, - bool condition, - Expression> second) - { - if (condition) - { - return ExpressionFuncExtender.And(first, second); - } - - return first; - } - - public static Expression> OrIf( - this Expression> first, - bool condition, - Expression> second) - { - if (condition) - { - return ExpressionFuncExtender.Or(first, second); - } - - return first; - } -} diff --git a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.EntityFrameworkCore/FodyWeavers.xml b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.EntityFrameworkCore/FodyWeavers.xml deleted file mode 100644 index 1715698cc..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.EntityFrameworkCore/FodyWeavers.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.EntityFrameworkCore/FodyWeavers.xsd b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.EntityFrameworkCore/FodyWeavers.xsd deleted file mode 100644 index 11da52550..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.EntityFrameworkCore/FodyWeavers.xsd +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - '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/templates/content/src/PackageName.CompanyName.ProjectName.EntityFrameworkCore/PackageName.CompanyName.ProjectName.EntityFrameworkCore.csproj b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.EntityFrameworkCore/PackageName.CompanyName.ProjectName.EntityFrameworkCore.csproj deleted file mode 100644 index 7c2260bd8..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.EntityFrameworkCore/PackageName.CompanyName.ProjectName.EntityFrameworkCore.csproj +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - net8.0 - PackageName.CompanyName.ProjectName.EntityFrameworkCore - PackageName.CompanyName.ProjectName.EntityFrameworkCore - false - false - false - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - - - - - - - - - - - diff --git a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.EntityFrameworkCore/PackageName/CompanyName/ProjectName/EntityFrameworkCore/EfCoreProjectNameRepository.cs b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.EntityFrameworkCore/PackageName/CompanyName/ProjectName/EntityFrameworkCore/EfCoreProjectNameRepository.cs deleted file mode 100644 index 2d68cf660..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.EntityFrameworkCore/PackageName/CompanyName/ProjectName/EntityFrameworkCore/EfCoreProjectNameRepository.cs +++ /dev/null @@ -1,77 +0,0 @@ -using LINGYUN.Abp.DataProtection; -using LINGYUN.Abp.DataProtection.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Linq.Dynamic.Core; -using System.Threading; -using System.Threading.Tasks; -using Volo.Abp.Domain.Entities; -using Volo.Abp.EntityFrameworkCore; -using Volo.Abp.Specifications; - -namespace PackageName.CompanyName.ProjectName.EntityFrameworkCore; -/// -/// 实现基本接口 -/// -/// 实体类型 -/// 实体主键类型 -public abstract class EfCoreProjectNameRepository : - EfCoreDataProtectionRepository, - IProjectNameBasicRepository - where TEntity : class, IEntity -{ - protected EfCoreProjectNameRepository( - IDbContextProvider dbContextProvider, - IDataAuthorizationService dataAuthorizationService, - IEntityTypeFilterBuilder entityTypeFilterBuilder) - : base(dbContextProvider, dataAuthorizationService, entityTypeFilterBuilder) - { - } - - public async virtual Task GetCountAsync( - ISpecification specification, - CancellationToken cancellationToken = default) - { - return await (await GetDbSetAsync()) - .Where(specification.ToExpression()) - .CountAsync(GetCancellationToken(cancellationToken)); - } - - public async virtual Task> GetListAsync( - ISpecification specification, - string sorting = nameof(IEntity.Id), - int maxResultCount = 10, - int skipCount = 0, - CancellationToken cancellationToken = default) - { - return await (await GetDbSetAsync()) - .Where(specification.ToExpression()) - .OrderBy(GetSortingOrDefault(sorting)) - .PageBy(skipCount, maxResultCount) - .ToListAsync(GetCancellationToken(cancellationToken)); - } - - public async virtual Task> GetListAsync( - ISpecification specification, - string sorting = nameof(IEntity.Id), - int maxResultCount = 10, - CancellationToken cancellationToken = default) - { - return await (await GetDbSetAsync()) - .Where(specification.ToExpression()) - .OrderBy(GetSortingOrDefault(sorting)) - .Take(maxResultCount) - .ToListAsync(GetCancellationToken(cancellationToken)); - } - - protected virtual string GetSortingOrDefault(string sorting = nameof(IEntity.Id)) - { - if (sorting.IsNullOrWhiteSpace()) - { - return nameof(IEntity.Id); - } - return sorting; - } -} diff --git a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.EntityFrameworkCore/PackageName/CompanyName/ProjectName/EntityFrameworkCore/IProjectNameDbContext.cs b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.EntityFrameworkCore/PackageName/CompanyName/ProjectName/EntityFrameworkCore/IProjectNameDbContext.cs deleted file mode 100644 index b9abdef0c..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.EntityFrameworkCore/PackageName/CompanyName/ProjectName/EntityFrameworkCore/IProjectNameDbContext.cs +++ /dev/null @@ -1,9 +0,0 @@ -using Volo.Abp.Data; -using Volo.Abp.EntityFrameworkCore; - -namespace PackageName.CompanyName.ProjectName.EntityFrameworkCore; - -[ConnectionStringName(ProjectNameDbProperties.ConnectionStringName)] -public interface IProjectNameDbContext : IEfCoreDbContext -{ -} diff --git a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.EntityFrameworkCore/PackageName/CompanyName/ProjectName/EntityFrameworkCore/ProjectNameDbContext.cs b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.EntityFrameworkCore/PackageName/CompanyName/ProjectName/EntityFrameworkCore/ProjectNameDbContext.cs deleted file mode 100644 index 3b7ad579f..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.EntityFrameworkCore/PackageName/CompanyName/ProjectName/EntityFrameworkCore/ProjectNameDbContext.cs +++ /dev/null @@ -1,21 +0,0 @@ -using LINGYUN.Abp.DataProtection.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore; -using Volo.Abp.Data; - -namespace PackageName.CompanyName.ProjectName.EntityFrameworkCore; - -[ConnectionStringName(ProjectNameDbProperties.ConnectionStringName)] -public class ProjectNameDbContext : AbpDataProtectionDbContext, IProjectNameDbContext -{ - public ProjectNameDbContext( - DbContextOptions options) : base(options) - { - } - - protected override void OnModelCreating(ModelBuilder modelBuilder) - { - base.OnModelCreating(modelBuilder); - - modelBuilder.ConfigureProjectName(); - } -} diff --git a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.EntityFrameworkCore/PackageName/CompanyName/ProjectName/EntityFrameworkCore/ProjectNameDbContextFactory.cs b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.EntityFrameworkCore/PackageName/CompanyName/ProjectName/EntityFrameworkCore/ProjectNameDbContextFactory.cs deleted file mode 100644 index 04338731b..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.EntityFrameworkCore/PackageName/CompanyName/ProjectName/EntityFrameworkCore/ProjectNameDbContextFactory.cs +++ /dev/null @@ -1,49 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Design; -using Microsoft.Extensions.Configuration; -using System.IO; - -namespace PackageName.CompanyName.ProjectName.EntityFrameworkCore; -public class ProjectNameDbContextFactory : IDesignTimeDbContextFactory -{ - public ProjectNameDbContext CreateDbContext(string[] args) - { - var configuration = BuildConfiguration(); - var connectionString = configuration.GetConnectionString("ProjectName"); - - DbContextOptionsBuilder builder = null; - -#if MySQL - builder = new DbContextOptionsBuilder() - .UseMySql(connectionString, ServerVersion.AutoDetect(connectionString)); -#elif SqlServer - builder = new DbContextOptionsBuilder() - .UseSqlServer(connectionString); -#elif Sqlite - builder = new DbContextOptionsBuilder() - .UseSqlite(connectionString); -#elif Oracle - builder = new DbContextOptionsBuilder() - .UseOracle(connectionString); -#elif OracleDevart - builder = (DbContextOptionsBuilder) new DbContextOptionsBuilder() - .UseOracle(connectionString); -#elif PostgreSql - builder = new DbContextOptionsBuilder() - .UseNpgsql(connectionString); -#endif - - return new ProjectNameDbContext(builder!.Options); - } - - private static IConfigurationRoot BuildConfiguration() - { - var builder = new ConfigurationBuilder() - .SetBasePath(Path.Combine(Directory.GetCurrentDirectory(), "../PackageName.CompanyName.ProjectName.DbMigrator/")) - .AddJsonFile("appsettings.json", optional: false) - .AddJsonFile("appsettings.Development.json", optional: true); - - return builder.Build(); - } -} - diff --git a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.EntityFrameworkCore/PackageName/CompanyName/ProjectName/EntityFrameworkCore/ProjectNameDbContextModelCreatingExtensions.cs b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.EntityFrameworkCore/PackageName/CompanyName/ProjectName/EntityFrameworkCore/ProjectNameDbContextModelCreatingExtensions.cs deleted file mode 100644 index f812977e6..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.EntityFrameworkCore/PackageName/CompanyName/ProjectName/EntityFrameworkCore/ProjectNameDbContextModelCreatingExtensions.cs +++ /dev/null @@ -1,21 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using System; -using Volo.Abp; - -namespace PackageName.CompanyName.ProjectName.EntityFrameworkCore; - -public static class ProjectNameDbContextModelCreatingExtensions -{ - public static void ConfigureProjectName( - this ModelBuilder builder, - Action optionsAction = null) - { - Check.NotNull(builder, nameof(builder)); - - var options = new ProjectNameModelBuilderConfigurationOptions( - ProjectNameDbProperties.DbTablePrefix, - ProjectNameDbProperties.DbSchema - ); - optionsAction?.Invoke(options); - } -} diff --git a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.EntityFrameworkCore/PackageName/CompanyName/ProjectName/EntityFrameworkCore/ProjectNameDbMigrationEventHandler.cs b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.EntityFrameworkCore/PackageName/CompanyName/ProjectName/EntityFrameworkCore/ProjectNameDbMigrationEventHandler.cs deleted file mode 100644 index 74a4a39bc..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.EntityFrameworkCore/PackageName/CompanyName/ProjectName/EntityFrameworkCore/ProjectNameDbMigrationEventHandler.cs +++ /dev/null @@ -1,36 +0,0 @@ -using Microsoft.Extensions.Logging; -using System; -using System.Threading.Tasks; -using Volo.Abp.Data; -using Volo.Abp.DistributedLocking; -using Volo.Abp.EntityFrameworkCore.Migrations; -using Volo.Abp.EventBus.Distributed; -using Volo.Abp.MultiTenancy; -using Volo.Abp.Uow; - -namespace PackageName.CompanyName.ProjectName.EntityFrameworkCore; - -public class ProjectNameDbMigrationEventHandler : EfCoreDatabaseMigrationEventHandlerBase -{ - protected IDataSeeder DataSeeder { get; } - - public ProjectNameDbMigrationEventHandler( - IDataSeeder dataSeeder, - ITenantStore tenantStore, - ICurrentTenant currentTenant, - IUnitOfWorkManager unitOfWorkManager, - IAbpDistributedLock abpDistributedLock, - IDistributedEventBus distributedEventBus, - ILoggerFactory loggerFactory) - : base( - ConnectionStringNameAttribute.GetConnStringName(), - currentTenant, unitOfWorkManager, tenantStore, abpDistributedLock, distributedEventBus, loggerFactory) - { - DataSeeder = dataSeeder; - } - - protected async override Task SeedAsync(Guid? tenantId) - { - await DataSeeder.SeedAsync(tenantId); - } -} diff --git a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.EntityFrameworkCore/PackageName/CompanyName/ProjectName/EntityFrameworkCore/ProjectNameDbMigrationService.cs b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.EntityFrameworkCore/PackageName/CompanyName/ProjectName/EntityFrameworkCore/ProjectNameDbMigrationService.cs deleted file mode 100644 index e64bc081a..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.EntityFrameworkCore/PackageName/CompanyName/ProjectName/EntityFrameworkCore/ProjectNameDbMigrationService.cs +++ /dev/null @@ -1,58 +0,0 @@ -using LINGYUN.Abp.Data.DbMigrator; -using LINGYUN.Abp.Saas.Tenants; -using Microsoft.Extensions.Logging; -using System; -using System.Linq; -using System.Threading.Tasks; -using Volo.Abp.Data; -using Volo.Abp.DependencyInjection; -using Volo.Abp.DistributedLocking; -using Volo.Abp.EventBus.Distributed; -using Volo.Abp.MultiTenancy; -using Volo.Abp.Uow; - -namespace PackageName.CompanyName.ProjectName.EntityFrameworkCore; - -public class ProjectNameDbMigrationService : EfCoreRuntimeDbMigratorBase, ITransientDependency -{ - protected IDataSeeder DataSeeder { get; } - protected IDbSchemaMigrator DbSchemaMigrator { get; } - protected ITenantRepository TenantRepository { get; } - - public ProjectNameDbMigrationService( - IDataSeeder dataSeeder, - IDbSchemaMigrator dbSchemaMigrator, - ITenantRepository tenantRepository, - ICurrentTenant currentTenant, - IUnitOfWorkManager unitOfWorkManager, - IServiceProvider serviceProvider, - IAbpDistributedLock abpDistributedLock, - IDistributedEventBus distributedEventBus, - ILoggerFactory loggerFactory) - : base( - ConnectionStringNameAttribute.GetConnStringName(), - unitOfWorkManager, serviceProvider, currentTenant, abpDistributedLock, distributedEventBus, loggerFactory) - { - DataSeeder = dataSeeder; - DbSchemaMigrator = dbSchemaMigrator; - TenantRepository = tenantRepository; - } - - protected async override Task LockAndApplyDatabaseMigrationsAsync() - { - await base.LockAndApplyDatabaseMigrationsAsync(); - - var tenants = await TenantRepository.GetListAsync(); - foreach (var tenant in tenants.Where(x => x.IsActive)) - { - await LockAndApplyDatabaseWithTenantMigrationsAsync(tenant.Id); - } - } - - protected async override Task SeedAsync() - { - Logger.LogInformation($"Executing {(!CurrentTenant.IsAvailable ? "host" : CurrentTenant.Name ?? CurrentTenant.GetId().ToString())} database seed..."); - - await DataSeeder.SeedAsync(CurrentTenant.Id); - } -} \ No newline at end of file diff --git a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.EntityFrameworkCore/PackageName/CompanyName/ProjectName/EntityFrameworkCore/ProjectNameEfCoreQueryableExtensions.cs b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.EntityFrameworkCore/PackageName/CompanyName/ProjectName/EntityFrameworkCore/ProjectNameEfCoreQueryableExtensions.cs deleted file mode 100644 index eb9a9214b..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.EntityFrameworkCore/PackageName/CompanyName/ProjectName/EntityFrameworkCore/ProjectNameEfCoreQueryableExtensions.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace PackageName.CompanyName.ProjectName.EntityFrameworkCore; - -public static class ProjectNameEfCoreQueryableExtensions -{ - // 在此聚合仓储服务的扩展方法 -} diff --git a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.EntityFrameworkCore/PackageName/CompanyName/ProjectName/EntityFrameworkCore/ProjectNameEntityFrameworkCoreModule.cs b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.EntityFrameworkCore/PackageName/CompanyName/ProjectName/EntityFrameworkCore/ProjectNameEntityFrameworkCoreModule.cs deleted file mode 100644 index d88c1eb17..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.EntityFrameworkCore/PackageName/CompanyName/ProjectName/EntityFrameworkCore/ProjectNameEntityFrameworkCoreModule.cs +++ /dev/null @@ -1,76 +0,0 @@ -using LINGYUN.Abp.Data.DbMigrator; -using LINGYUN.Abp.DataProtection.EntityFrameworkCore; -using LINGYUN.Abp.Saas.EntityFrameworkCore; -using Microsoft.Extensions.DependencyInjection; -using Volo.Abp.EntityFrameworkCore; -using Volo.Abp.Modularity; -#if MySQL -using Volo.Abp.EntityFrameworkCore.MySQL; -#elif SqlServer -using Volo.Abp.EntityFrameworkCore.SqlServer; -using Microsoft.EntityFrameworkCore.Infrastructure; -#elif Sqlite -using Volo.Abp.EntityFrameworkCore.Sqlite; -#elif Oracle -using Volo.Abp.EntityFrameworkCore.Oracle; -#elif OracleDevart -using Volo.Abp.EntityFrameworkCore.Oracle.Devart; -#elif PostgreSql -using Volo.Abp.EntityFrameworkCore.PostgreSql; -#endif - -namespace PackageName.CompanyName.ProjectName.EntityFrameworkCore; - -[DependsOn( - typeof(ProjectNameDomainModule), - typeof(AbpDataDbMigratorModule), - typeof(AbpDataProtectionEntityFrameworkCoreModule), -#if MySQL - typeof(AbpEntityFrameworkCoreMySQLModule), -#elif SqlServer - typeof(AbpEntityFrameworkCoreSqlServerModule), -#elif Sqlite - typeof(AbpEntityFrameworkCoreSqliteModule), -#elif Oracle - typeof(AbpEntityFrameworkCoreOracleModule), -#elif OracleDevart - typeof(AbpEntityFrameworkCoreOracleDevartModule), -#elif PostgreSql - typeof(AbpEntityFrameworkCorePostgreSqlModule), -#endif - typeof(AbpSaasEntityFrameworkCoreModule))] -public class ProjectNameEntityFrameworkCoreModule : AbpModule -{ - public override void ConfigureServices(ServiceConfigurationContext context) - { - // 配置Ef - Configure(options => - { -#if MySQL - options.UseMySQL(); - options.UseMySQL(); -#elif SqlServer - options.UseSqlServer(); - options.UseSqlServer(builder => - { - // see https://learn.microsoft.com/en-us/sql/t-sql/statements/alter-database-transact-sql-compatibility-level?view=sql-server-ver16 - // builder.UseCompatibilityLevel(150); - }); -#elif Sqlite - options.UseSqlite(); - options.UseSqlite(); -#elif Oracle || OracleDevart - options.UseOracle(); - options.UseOracle(); -#elif PostgreSql - options.UseNpgsql(); - options.UseNpgsql(); -#endif - }); - - context.Services.AddAbpDbContext(options => - { - options.AddDefaultRepositories(); - }); - } -} diff --git a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.EntityFrameworkCore/PackageName/CompanyName/ProjectName/EntityFrameworkCore/ProjectNameModelBuilderConfigurationOptions.cs b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.EntityFrameworkCore/PackageName/CompanyName/ProjectName/EntityFrameworkCore/ProjectNameModelBuilderConfigurationOptions.cs deleted file mode 100644 index ba62d48a8..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.EntityFrameworkCore/PackageName/CompanyName/ProjectName/EntityFrameworkCore/ProjectNameModelBuilderConfigurationOptions.cs +++ /dev/null @@ -1,17 +0,0 @@ -using JetBrains.Annotations; -using Volo.Abp.EntityFrameworkCore.Modeling; - -namespace PackageName.CompanyName.ProjectName.EntityFrameworkCore; - -public class ProjectNameModelBuilderConfigurationOptions : AbpModelBuilderConfigurationOptions -{ - public ProjectNameModelBuilderConfigurationOptions( - [NotNull] string tablePrefix = "", - [CanBeNull] string schema = null) - : base( - tablePrefix, - schema) - { - - } -} diff --git a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.HttpApi.Client/FodyWeavers.xml b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.HttpApi.Client/FodyWeavers.xml deleted file mode 100644 index 1715698cc..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.HttpApi.Client/FodyWeavers.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.HttpApi.Client/FodyWeavers.xsd b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.HttpApi.Client/FodyWeavers.xsd deleted file mode 100644 index 11da52550..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.HttpApi.Client/FodyWeavers.xsd +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - '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/templates/content/src/PackageName.CompanyName.ProjectName.HttpApi.Client/PackageName.CompanyName.ProjectName.HttpApi.Client.csproj b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.HttpApi.Client/PackageName.CompanyName.ProjectName.HttpApi.Client.csproj deleted file mode 100644 index 6d85b6452..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.HttpApi.Client/PackageName.CompanyName.ProjectName.HttpApi.Client.csproj +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - netstandard2.0;netstandard2.1;net8.0 - PackageName.CompanyName.ProjectName.HttpApi.Client - PackageName.CompanyName.ProjectName.HttpApi.Client - false - false - false - - - - - - - - - - - - diff --git a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.HttpApi.Client/PackageName/CompanyName/ProjectName/ProjectNameHttpApiClientModule.cs b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.HttpApi.Client/PackageName/CompanyName/ProjectName/ProjectNameHttpApiClientModule.cs deleted file mode 100644 index f6cb1e324..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.HttpApi.Client/PackageName/CompanyName/ProjectName/ProjectNameHttpApiClientModule.cs +++ /dev/null @@ -1,18 +0,0 @@ -using Microsoft.Extensions.DependencyInjection; -using Volo.Abp.Http.Client; -using Volo.Abp.Modularity; - -namespace PackageName.CompanyName.ProjectName; - -[DependsOn( - typeof(AbpHttpClientModule), - typeof(ProjectNameApplicationContractsModule))] -public class ProjectNameHttpApiClientModule : AbpModule -{ - public override void ConfigureServices(ServiceConfigurationContext context) - { - context.Services.AddStaticHttpClientProxies( - typeof(ProjectNameApplicationContractsModule).Assembly, - ProjectNameRemoteServiceConsts.RemoteServiceName); - } -} diff --git a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.HttpApi/FodyWeavers.xml b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.HttpApi/FodyWeavers.xml deleted file mode 100644 index 1715698cc..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.HttpApi/FodyWeavers.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.HttpApi/FodyWeavers.xsd b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.HttpApi/FodyWeavers.xsd deleted file mode 100644 index 11da52550..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.HttpApi/FodyWeavers.xsd +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - '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/templates/content/src/PackageName.CompanyName.ProjectName.HttpApi/PackageName.CompanyName.ProjectName.HttpApi.csproj b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.HttpApi/PackageName.CompanyName.ProjectName.HttpApi.csproj deleted file mode 100644 index b8a73da64..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.HttpApi/PackageName.CompanyName.ProjectName.HttpApi.csproj +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - net8.0 - PackageName.CompanyName.ProjectName.HttpApi - PackageName.CompanyName.ProjectName.HttpApi - false - false - false - - - - - - - - - - - - - diff --git a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.HttpApi/PackageName/CompanyName/ProjectName/ProjectNameControllerBase.cs b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.HttpApi/PackageName/CompanyName/ProjectName/ProjectNameControllerBase.cs deleted file mode 100644 index 6797f475c..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.HttpApi/PackageName/CompanyName/ProjectName/ProjectNameControllerBase.cs +++ /dev/null @@ -1,12 +0,0 @@ -using PackageName.CompanyName.ProjectName.Localization; -using Volo.Abp.AspNetCore.Mvc; - -namespace PackageName.CompanyName.ProjectName; - -public abstract class ProjectNameControllerBase : AbpControllerBase -{ - protected ProjectNameControllerBase() - { - LocalizationResource = typeof(ProjectNameResource); - } -} diff --git a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.HttpApi/PackageName/CompanyName/ProjectName/ProjectNameDynamicQueryableControllerBase.cs b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.HttpApi/PackageName/CompanyName/ProjectName/ProjectNameDynamicQueryableControllerBase.cs deleted file mode 100644 index 865145f86..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.HttpApi/PackageName/CompanyName/ProjectName/ProjectNameDynamicQueryableControllerBase.cs +++ /dev/null @@ -1,17 +0,0 @@ -using LINGYUN.Abp.Dynamic.Queryable; -using PackageName.CompanyName.ProjectName.Localization; - -namespace PackageName.CompanyName.ProjectName; -/// -/// 提供动态查询控制器实现 -/// -/// 实体dto类型 -public abstract class ProjectNameDynamicQueryableControllerBase : DynamicQueryableControllerBase -{ - protected ProjectNameDynamicQueryableControllerBase( - IDynamicQueryableAppService service) - : base(service) - { - LocalizationResource = typeof(ProjectNameResource); - } -} diff --git a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.HttpApi/PackageName/CompanyName/ProjectName/ProjectNameHttpApiModule.cs b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.HttpApi/PackageName/CompanyName/ProjectName/ProjectNameHttpApiModule.cs deleted file mode 100644 index 90dccd31c..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.HttpApi/PackageName/CompanyName/ProjectName/ProjectNameHttpApiModule.cs +++ /dev/null @@ -1,42 +0,0 @@ -using PackageName.CompanyName.ProjectName.Localization; -using Microsoft.Extensions.DependencyInjection; -using Volo.Abp.AspNetCore.Mvc; -using Volo.Abp.AspNetCore.Mvc.Localization; -using Volo.Abp.Localization; -using Volo.Abp.Modularity; -using Volo.Abp.Validation.Localization; -using LINGYUN.Abp.Dynamic.Queryable; - -namespace PackageName.CompanyName.ProjectName; - -[DependsOn( - typeof(AbpAspNetCoreMvcModule), - typeof(ProjectNameApplicationContractsModule), - typeof(AbpDynamicQueryableHttpApiModule))] -public class ProjectNameHttpApiModule : AbpModule -{ - public override void PreConfigureServices(ServiceConfigurationContext context) - { - PreConfigure(mvcBuilder => - { - mvcBuilder.AddApplicationPartIfNotExists(typeof(ProjectNameHttpApiModule).Assembly); - }); - - PreConfigure(options => - { - options.AddAssemblyResource( - typeof(ProjectNameResource), - typeof(ProjectNameApplicationContractsModule).Assembly); - }); - } - - public override void ConfigureServices(ServiceConfigurationContext context) - { - Configure(options => - { - options.Resources - .Get() - .AddBaseTypes(typeof(AbpValidationResource)); - }); - } -} diff --git a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.SettingManagement/FodyWeavers.xml b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.SettingManagement/FodyWeavers.xml deleted file mode 100644 index 1715698cc..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.SettingManagement/FodyWeavers.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.SettingManagement/FodyWeavers.xsd b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.SettingManagement/FodyWeavers.xsd deleted file mode 100644 index 11da52550..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.SettingManagement/FodyWeavers.xsd +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - '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/templates/content/src/PackageName.CompanyName.ProjectName.SettingManagement/PackageName.CompanyName.ProjectName.SettingManagement.csproj b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.SettingManagement/PackageName.CompanyName.ProjectName.SettingManagement.csproj deleted file mode 100644 index 66aa001bd..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.SettingManagement/PackageName.CompanyName.ProjectName.SettingManagement.csproj +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - net8.0 - PackageName.CompanyName.ProjectName.SettingManagement - PackageName.CompanyName.ProjectName.SettingManagement - false - false - false - - - - - - - - - - - - - - - diff --git a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.SettingManagement/PackageName/CompanyName/ProjectName/SettingManagement/IProjectNameSettingAppService.cs b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.SettingManagement/PackageName/CompanyName/ProjectName/SettingManagement/IProjectNameSettingAppService.cs deleted file mode 100644 index 308135ed0..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.SettingManagement/PackageName/CompanyName/ProjectName/SettingManagement/IProjectNameSettingAppService.cs +++ /dev/null @@ -1,7 +0,0 @@ -using LINGYUN.Abp.SettingManagement; - -namespace PackageName.CompanyName.ProjectName.SettingManagement; - -public interface IProjectNameSettingAppService : ISettingAppService, IUserSettingAppService -{ -} diff --git a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.SettingManagement/PackageName/CompanyName/ProjectName/SettingManagement/ProjectNameSettingAppService.cs b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.SettingManagement/PackageName/CompanyName/ProjectName/SettingManagement/ProjectNameSettingAppService.cs deleted file mode 100644 index 619fdd3ab..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.SettingManagement/PackageName/CompanyName/ProjectName/SettingManagement/ProjectNameSettingAppService.cs +++ /dev/null @@ -1,106 +0,0 @@ -using LINGYUN.Abp.SettingManagement; -using Microsoft.AspNetCore.Authorization; -using PackageName.CompanyName.ProjectName.Permissions; -using PackageName.CompanyName.ProjectName.Localization; -using System.Threading.Tasks; -using Volo.Abp.Application.Services; -using Volo.Abp.Features; -using Volo.Abp.MultiTenancy; -using Volo.Abp.SettingManagement; -using Volo.Abp.Settings; -using Volo.Abp.Users; - -namespace PackageName.CompanyName.ProjectName.SettingManagement; - -public class ProjectNameSettingAppService : ApplicationService, IProjectNameSettingAppService -{ - protected ISettingManager SettingManager { get; } - protected ISettingDefinitionManager SettingDefinitionManager { get; } - - public ProjectNameSettingAppService( - ISettingManager settingManager, - ISettingDefinitionManager settingDefinitionManager) - { - SettingManager = settingManager; - SettingDefinitionManager = settingDefinitionManager; - LocalizationResource = typeof(ProjectNameResource); - } - - public virtual async Task GetAllForCurrentTenantAsync() - { - return await GetAllForProviderAsync(TenantSettingValueProvider.ProviderName, CurrentTenant.GetId().ToString()); - } - - [Authorize] - public virtual async Task GetAllForCurrentUserAsync() - { - return await GetAllForProviderAsync(UserSettingValueProvider.ProviderName, CurrentUser.GetId().ToString()); - } - - public virtual async Task GetAllForGlobalAsync() - { - return await GetAllForProviderAsync(GlobalSettingValueProvider.ProviderName, null); - } - - [Authorize(ProjectNamePermissions.ManageSettings)] - public virtual async Task SetCurrentTenantAsync(UpdateSettingsDto input) - { - // 增加特性检查 - await CheckFeatureAsync(); - - if (CurrentTenant.IsAvailable) - { - foreach (var setting in input.Settings) - { - await SettingManager.SetForTenantAsync(CurrentTenant.GetId(), setting.Name, setting.Value); - } - - await CurrentUnitOfWork.SaveChangesAsync(); - } - } - - [Authorize] - public virtual async Task SetCurrentUserAsync(UpdateSettingsDto input) - { - // 增加特性检查 - await CheckFeatureAsync(); - - foreach (var setting in input.Settings) - { - await SettingManager.SetForCurrentUserAsync(setting.Name, setting.Value); - } - - await CurrentUnitOfWork.SaveChangesAsync(); - } - - [Authorize(ProjectNamePermissions.ManageSettings)] - public virtual async Task SetGlobalAsync(UpdateSettingsDto input) - { - // 增加特性检查 - await CheckFeatureAsync(); - - foreach (var setting in input.Settings) - { - await SettingManager.SetGlobalAsync(setting.Name, setting.Value); - } - - await CurrentUnitOfWork.SaveChangesAsync(); - } - - - protected virtual async Task CheckFeatureAsync() - { - await FeatureChecker.CheckEnabledAsync(SettingManagementFeatures.Enable); - } - - protected virtual async Task GetAllForProviderAsync(string providerName, string providerKey) - { - var settingGroups = new SettingGroupResult(); - - //TODO: 当前项目所有配置项在此定义返回 - - await Task.CompletedTask; - - return settingGroups; - } -} diff --git a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.SettingManagement/PackageName/CompanyName/ProjectName/SettingManagement/ProjectNameSettingController.cs b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.SettingManagement/PackageName/CompanyName/ProjectName/SettingManagement/ProjectNameSettingController.cs deleted file mode 100644 index 58df5fe31..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.SettingManagement/PackageName/CompanyName/ProjectName/SettingManagement/ProjectNameSettingController.cs +++ /dev/null @@ -1,69 +0,0 @@ -using Asp.Versioning; -using LINGYUN.Abp.SettingManagement; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; -using PackageName.CompanyName.ProjectName.Permissions; -using System.Threading.Tasks; -using Volo.Abp; -using Volo.Abp.AspNetCore.Mvc; - -namespace PackageName.CompanyName.ProjectName.SettingManagement; - -[RemoteService(Name = ProjectNameRemoteServiceConsts.RemoteServiceName)] -[ApiVersion("2.0")] -[Area(ProjectNameRemoteServiceConsts.ModuleName)] -[Route("api/ProjectName/settings")] -public class ProjectNameSettingController : AbpController, IProjectNameSettingAppService -{ - private readonly IProjectNameSettingAppService _settingAppService; - public ProjectNameSettingController(IProjectNameSettingAppService settingAppService) - { - _settingAppService = settingAppService; - } - - [Authorize(ProjectNamePermissions.ManageSettings)] - [HttpPut] - [Route("by-current-tenant")] - public virtual async Task SetCurrentTenantAsync(UpdateSettingsDto input) - { - await _settingAppService.SetCurrentTenantAsync(input); - } - - [HttpGet] - [Route("by-current-tenant")] - public virtual async Task GetAllForCurrentTenantAsync() - { - return await _settingAppService.GetAllForCurrentTenantAsync(); - } - - [Authorize] - [HttpPut] - [Route("by-current-user")] - public virtual async Task SetCurrentUserAsync(UpdateSettingsDto input) - { - await _settingAppService.SetCurrentTenantAsync(input); - } - - [Authorize] - [HttpGet] - [Route("by-current-user")] - public virtual async Task GetAllForCurrentUserAsync() - { - return await _settingAppService.GetAllForCurrentTenantAsync(); - } - - [Authorize(ProjectNamePermissions.ManageSettings)] - [HttpPut] - [Route("by-global")] - public virtual async Task SetGlobalAsync(UpdateSettingsDto input) - { - await _settingAppService.SetGlobalAsync(input); - } - - [HttpGet] - [Route("by-global")] - public virtual async Task GetAllForGlobalAsync() - { - return await _settingAppService.GetAllForGlobalAsync(); - } -} diff --git a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.SettingManagement/PackageName/CompanyName/ProjectName/SettingManagement/ProjectNameSettingManagementModule.cs b/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.SettingManagement/PackageName/CompanyName/ProjectName/SettingManagement/ProjectNameSettingManagementModule.cs deleted file mode 100644 index 09eb20393..000000000 --- a/aspnet-core/templates/content/src/PackageName.CompanyName.ProjectName.SettingManagement/PackageName/CompanyName/ProjectName/SettingManagement/ProjectNameSettingManagementModule.cs +++ /dev/null @@ -1,22 +0,0 @@ -using LINGYUN.Abp.SettingManagement; -using Microsoft.Extensions.DependencyInjection; -using Volo.Abp.AspNetCore.Mvc; -using Volo.Abp.Modularity; -using Volo.Abp.SettingManagement; - -namespace PackageName.CompanyName.ProjectName.SettingManagement; - -[DependsOn( - typeof(AbpSettingManagementApplicationContractsModule), - typeof(AbpAspNetCoreMvcModule), - typeof(AbpSettingManagementDomainModule))] -public class ProjectNameSettingManagementModule : AbpModule -{ - public override void PreConfigureServices(ServiceConfigurationContext context) - { - PreConfigure(mvcBuilder => - { - mvcBuilder.AddApplicationPartIfNotExists(typeof(ProjectNameSettingManagementModule).Assembly); - }); - } -} diff --git a/aspnet-core/templates/content/tests/PackageName.CompanyName.ProjectName.Application.Tests/PackageName.CompanyName.ProjectName.Application.Tests.csproj b/aspnet-core/templates/content/tests/PackageName.CompanyName.ProjectName.Application.Tests/PackageName.CompanyName.ProjectName.Application.Tests.csproj deleted file mode 100644 index 8a875c135..000000000 --- a/aspnet-core/templates/content/tests/PackageName.CompanyName.ProjectName.Application.Tests/PackageName.CompanyName.ProjectName.Application.Tests.csproj +++ /dev/null @@ -1,18 +0,0 @@ - - - - net8.0 - - false - - - - - - - - - - - - diff --git a/aspnet-core/templates/content/tests/PackageName.CompanyName.ProjectName.Application.Tests/PackageName/CompanyName/ProjectName/ProjectNameApplicationTestBase.cs b/aspnet-core/templates/content/tests/PackageName.CompanyName.ProjectName.Application.Tests/PackageName/CompanyName/ProjectName/ProjectNameApplicationTestBase.cs deleted file mode 100644 index 64198871d..000000000 --- a/aspnet-core/templates/content/tests/PackageName.CompanyName.ProjectName.Application.Tests/PackageName/CompanyName/ProjectName/ProjectNameApplicationTestBase.cs +++ /dev/null @@ -1,5 +0,0 @@ -namespace PackageName.CompanyName.ProjectName; - -public abstract class ProjectNameApplicationTestBase : ProjectNameTestBase -{ -} diff --git a/aspnet-core/templates/content/tests/PackageName.CompanyName.ProjectName.Application.Tests/PackageName/CompanyName/ProjectName/ProjectNameApplicationTestModule.cs b/aspnet-core/templates/content/tests/PackageName.CompanyName.ProjectName.Application.Tests/PackageName/CompanyName/ProjectName/ProjectNameApplicationTestModule.cs deleted file mode 100644 index 12175d486..000000000 --- a/aspnet-core/templates/content/tests/PackageName.CompanyName.ProjectName.Application.Tests/PackageName/CompanyName/ProjectName/ProjectNameApplicationTestModule.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Volo.Abp.Modularity; - -namespace PackageName.CompanyName.ProjectName; - -[DependsOn( - typeof(ProjectNameDomainTestModule), - typeof(ProjectNameApplicationModule) - )] -public class ProjectNameApplicationTestModule : AbpModule -{ -} diff --git a/aspnet-core/templates/content/tests/PackageName.CompanyName.ProjectName.Domain.Tests/PackageName.CompanyName.ProjectName.Domain.Tests.csproj b/aspnet-core/templates/content/tests/PackageName.CompanyName.ProjectName.Domain.Tests/PackageName.CompanyName.ProjectName.Domain.Tests.csproj deleted file mode 100644 index 09e35ceb3..000000000 --- a/aspnet-core/templates/content/tests/PackageName.CompanyName.ProjectName.Domain.Tests/PackageName.CompanyName.ProjectName.Domain.Tests.csproj +++ /dev/null @@ -1,18 +0,0 @@ - - - - net8.0 - - false - - - - - - - - - - - - diff --git a/aspnet-core/templates/content/tests/PackageName.CompanyName.ProjectName.Domain.Tests/PackageName/CompanyName/ProjectName/ProjectNameDomainTestBase.cs b/aspnet-core/templates/content/tests/PackageName.CompanyName.ProjectName.Domain.Tests/PackageName/CompanyName/ProjectName/ProjectNameDomainTestBase.cs deleted file mode 100644 index 01b678fe1..000000000 --- a/aspnet-core/templates/content/tests/PackageName.CompanyName.ProjectName.Domain.Tests/PackageName/CompanyName/ProjectName/ProjectNameDomainTestBase.cs +++ /dev/null @@ -1,5 +0,0 @@ -namespace PackageName.CompanyName.ProjectName; - -public abstract class ProjectNameDomainTestBase : ProjectNameTestBase -{ -} diff --git a/aspnet-core/templates/content/tests/PackageName.CompanyName.ProjectName.Domain.Tests/PackageName/CompanyName/ProjectName/ProjectNameDomainTestModule.cs b/aspnet-core/templates/content/tests/PackageName.CompanyName.ProjectName.Domain.Tests/PackageName/CompanyName/ProjectName/ProjectNameDomainTestModule.cs deleted file mode 100644 index 55d69b77c..000000000 --- a/aspnet-core/templates/content/tests/PackageName.CompanyName.ProjectName.Domain.Tests/PackageName/CompanyName/ProjectName/ProjectNameDomainTestModule.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Volo.Abp.Modularity; - -namespace PackageName.CompanyName.ProjectName; - -[DependsOn( - typeof(ProjectNameTestBaseModule), - typeof(ProjectNameDomainModule) - )] -public class ProjectNameDomainTestModule : AbpModule -{ -} diff --git a/aspnet-core/templates/content/tests/PackageName.CompanyName.ProjectName.EntityFrameworkCore.Tests/PackageName.CompanyName.ProjectName.EntityFrameworkCore.Tests.csproj b/aspnet-core/templates/content/tests/PackageName.CompanyName.ProjectName.EntityFrameworkCore.Tests/PackageName.CompanyName.ProjectName.EntityFrameworkCore.Tests.csproj deleted file mode 100644 index 61d399721..000000000 --- a/aspnet-core/templates/content/tests/PackageName.CompanyName.ProjectName.EntityFrameworkCore.Tests/PackageName.CompanyName.ProjectName.EntityFrameworkCore.Tests.csproj +++ /dev/null @@ -1,19 +0,0 @@ - - - - net8.0 - - false - - - - - - - - - - - - - diff --git a/aspnet-core/templates/content/tests/PackageName.CompanyName.ProjectName.EntityFrameworkCore.Tests/PackageName/CompanyName/ProjectName/EntityFrameworkCore/ProjectNameEntityFrameworkCoreTestBase.cs b/aspnet-core/templates/content/tests/PackageName.CompanyName.ProjectName.EntityFrameworkCore.Tests/PackageName/CompanyName/ProjectName/EntityFrameworkCore/ProjectNameEntityFrameworkCoreTestBase.cs deleted file mode 100644 index 6971ba357..000000000 --- a/aspnet-core/templates/content/tests/PackageName.CompanyName.ProjectName.EntityFrameworkCore.Tests/PackageName/CompanyName/ProjectName/EntityFrameworkCore/ProjectNameEntityFrameworkCoreTestBase.cs +++ /dev/null @@ -1,5 +0,0 @@ -namespace PackageName.CompanyName.ProjectName.EntityFrameworkCore; - -public abstract class ProjectNameEntityFrameworkCoreTestBase : ProjectNameTestBase -{ -} diff --git a/aspnet-core/templates/content/tests/PackageName.CompanyName.ProjectName.EntityFrameworkCore.Tests/PackageName/CompanyName/ProjectName/EntityFrameworkCore/ProjectNameEntityFrameworkCoreTestModule.cs b/aspnet-core/templates/content/tests/PackageName.CompanyName.ProjectName.EntityFrameworkCore.Tests/PackageName/CompanyName/ProjectName/EntityFrameworkCore/ProjectNameEntityFrameworkCoreTestModule.cs deleted file mode 100644 index 2146db9ca..000000000 --- a/aspnet-core/templates/content/tests/PackageName.CompanyName.ProjectName.EntityFrameworkCore.Tests/PackageName/CompanyName/ProjectName/EntityFrameworkCore/ProjectNameEntityFrameworkCoreTestModule.cs +++ /dev/null @@ -1,38 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.DependencyInjection; -using System; -using Volo.Abp.EntityFrameworkCore; -using Volo.Abp.Modularity; -using Volo.Abp.Uow; - -namespace PackageName.CompanyName.ProjectName.EntityFrameworkCore; - -[DependsOn( - typeof(ProjectNameTestBaseModule), - typeof(ProjectNameEntityFrameworkCoreModule) - )] -public class ProjectNameEntityFrameworkCoreTestModule : AbpModule -{ - public override void ConfigureServices(ServiceConfigurationContext context) - { - context.Services.AddEntityFrameworkInMemoryDatabase(); - - var databaseName = Guid.NewGuid().ToString(); - - Configure(options => - { - options.Configure(abpDbContextConfigurationContext => - { - abpDbContextConfigurationContext.DbContextOptions.EnableDetailedErrors(); - abpDbContextConfigurationContext.DbContextOptions.EnableSensitiveDataLogging(); - - abpDbContextConfigurationContext.DbContextOptions.UseInMemoryDatabase(databaseName); - }); - }); - - Configure(options => - { - options.TransactionBehavior = UnitOfWorkTransactionBehavior.Disabled; //EF in-memory database does not support transactions - }); - } -} diff --git a/aspnet-core/templates/content/tests/PackageName.CompanyName.ProjectName.TestBase/PackageName.CompanyName.ProjectName.TestBase.csproj b/aspnet-core/templates/content/tests/PackageName.CompanyName.ProjectName.TestBase/PackageName.CompanyName.ProjectName.TestBase.csproj deleted file mode 100644 index e983ebfaf..000000000 --- a/aspnet-core/templates/content/tests/PackageName.CompanyName.ProjectName.TestBase/PackageName.CompanyName.ProjectName.TestBase.csproj +++ /dev/null @@ -1,23 +0,0 @@ - - - - net8.0 - - false - - - - - - - - - - - - - - - - - diff --git a/aspnet-core/templates/content/tests/PackageName.CompanyName.ProjectName.TestBase/PackageName/CompanyName/ProjectName/ProjectNameTestBase.cs b/aspnet-core/templates/content/tests/PackageName.CompanyName.ProjectName.TestBase/PackageName/CompanyName/ProjectName/ProjectNameTestBase.cs deleted file mode 100644 index 79cca930d..000000000 --- a/aspnet-core/templates/content/tests/PackageName.CompanyName.ProjectName.TestBase/PackageName/CompanyName/ProjectName/ProjectNameTestBase.cs +++ /dev/null @@ -1,58 +0,0 @@ -using Microsoft.Extensions.DependencyInjection; -using System; -using System.Threading.Tasks; -using Volo.Abp; -using Volo.Abp.Modularity; -using Volo.Abp.Testing; -using Volo.Abp.Uow; - -namespace PackageName.CompanyName.ProjectName; - -public abstract class ProjectNameTestBase : AbpIntegratedTest - where TStartupModule : IAbpModule -{ - protected override void SetAbpApplicationCreationOptions(AbpApplicationCreationOptions options) - { - options.UseAutofac(); - } - - protected virtual Task WithUnitOfWorkAsync(Func func) - { - return WithUnitOfWorkAsync(new AbpUnitOfWorkOptions(), func); - } - - protected virtual async Task WithUnitOfWorkAsync(AbpUnitOfWorkOptions options, Func action) - { - using (var scope = ServiceProvider.CreateScope()) - { - var uowManager = scope.ServiceProvider.GetRequiredService(); - - using (var uow = uowManager.Begin(options)) - { - await action(); - - await uow.CompleteAsync(); - } - } - } - - protected virtual Task WithUnitOfWorkAsync(Func> func) - { - return WithUnitOfWorkAsync(new AbpUnitOfWorkOptions(), func); - } - - protected virtual async Task WithUnitOfWorkAsync(AbpUnitOfWorkOptions options, Func> func) - { - using (var scope = ServiceProvider.CreateScope()) - { - var uowManager = scope.ServiceProvider.GetRequiredService(); - - using (var uow = uowManager.Begin(options)) - { - var result = await func(); - await uow.CompleteAsync(); - return result; - } - } - } -} diff --git a/aspnet-core/templates/content/tests/PackageName.CompanyName.ProjectName.TestBase/PackageName/CompanyName/ProjectName/ProjectNameTestBaseModule.cs b/aspnet-core/templates/content/tests/PackageName.CompanyName.ProjectName.TestBase/PackageName/CompanyName/ProjectName/ProjectNameTestBaseModule.cs deleted file mode 100644 index adab3640d..000000000 --- a/aspnet-core/templates/content/tests/PackageName.CompanyName.ProjectName.TestBase/PackageName/CompanyName/ProjectName/ProjectNameTestBaseModule.cs +++ /dev/null @@ -1,24 +0,0 @@ -using Microsoft.Extensions.DependencyInjection; -using Volo.Abp; -using Volo.Abp.Authorization; -using Volo.Abp.Autofac; -using Volo.Abp.Features; -using Volo.Abp.MemoryDb; -using Volo.Abp.Modularity; - -namespace PackageName.CompanyName.ProjectName; - -[DependsOn( - typeof(AbpAutofacModule), - typeof(AbpTestBaseModule), - typeof(AbpAuthorizationModule), - typeof(AbpFeaturesModule), - typeof(AbpMemoryDbModule) - )] -public class ProjectNameTestBaseModule : AbpModule -{ - public override void ConfigureServices(ServiceConfigurationContext context) - { - context.Services.AddAlwaysAllowAuthorization(); - } -}