From b11ba4f6a5335f2c8b2f2c7a11d0722f346ec42c Mon Sep 17 00:00:00 2001 From: hello Date: Tue, 16 Dec 2025 22:26:14 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9B=B6=E5=BA=A6=E6=A1=86=E6=9E=B6=E5=8D=87?= =?UTF-8?q?=E7=BA=A7=E5=88=B0=20Aspire=2013.0=20=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Directory.Packages.props | 99 +++++----- HelloShop.Web.slnf | 2 +- HelloShop.sln | 175 ------------------ HelloShop.slnx | 31 ++++ .../DaprDistributedLock.cs | 6 +- .../DaprDistributedLockResult.cs | 4 +- .../HelloShop.DistributedLock.Dapr.csproj | 2 +- .../HelloShop.DistributedLock.csproj | 2 +- .../HelloShop.EventBus.Abstractions.csproj | 2 +- .../HelloShop.EventBus.Dapr.csproj | 2 +- .../HelloShop.EventBus.Logging.csproj | 2 +- .../HelloShop.EventBus.RabbitMQ.csproj | 2 +- .../RabbitMQEventBus.cs | 58 +++--- .../RabbitMQEventBusExtensions.cs | 2 +- .../GarnetWindowsService.sln | 25 --- .../GarnetWindowsService.slnx | 3 + .../MultiTenancySample/MultiTenancySample.sln | 43 ----- .../MultiTenancySample.slnx | 6 + .../Extensions/OpenApiConfigureOptions.cs | 9 +- .../HelloShop.ApiService.csproj | 3 +- src/HelloShop.ApiService/Program.cs | 2 +- .../HelloShop.AppHost.csproj | 7 +- src/HelloShop.AppHost/Program.cs | 12 +- .../HelloShop.AppShared.csproj | 2 +- .../HelloShop.BasketService.csproj | 3 +- src/HelloShop.BasketService/Program.cs | 15 +- src/HelloShop.BasketService/appsettings.json | 2 +- .../HelloShop.HybridApp.csproj | 16 +- .../HelloShop.IdentityService.csproj | 3 +- src/HelloShop.IdentityService/Program.cs | 4 +- .../Extensions/Extensions.cs | 4 +- .../HelloShop.OrderingService.csproj | 3 +- .../HelloShop.ProductService.csproj | 3 +- src/HelloShop.ProductService/Program.cs | 11 +- .../Extensions/ModelBindingExtensionns.cs | 7 +- .../Extensions/OpenApiExtensions.cs | 92 +++++---- .../HelloShop.ServiceDefaults.csproj | 10 +- ...AcceptLanguageHeaderDocumentTransformer.cs | 43 +++++ .../AcceptLanguageHeaderOperationFilter.cs | 30 --- .../Resources/OpenApi/Custom.css | 2 +- .../Resources/OpenApi/logo-white.svg | 5 + .../HelloShop.WebApp.Client.csproj | 2 +- .../HelloShop.WebApp/HelloShop.WebApp.csproj | 2 +- .../HelloShop.BasketService.UnitTests.csproj | 2 +- .../Services/BasketServiceTest.cs | 6 +- .../HelloShop.FunctionalTests.csproj | 2 +- ...Shop.ProductService.FunctionalTests.csproj | 2 +- .../HelloShop.ProductService.UnitTests.csproj | 2 +- .../MockProductsControllerTest.cs | 5 +- .../ProductsControllerTest.cs | 5 +- 50 files changed, 336 insertions(+), 446 deletions(-) delete mode 100644 HelloShop.sln create mode 100644 HelloShop.slnx delete mode 100644 samples/GarnetWindowsService/GarnetWindowsService.sln create mode 100644 samples/GarnetWindowsService/GarnetWindowsService.slnx delete mode 100644 samples/MultiTenancySample/MultiTenancySample.sln create mode 100644 samples/MultiTenancySample/MultiTenancySample.slnx create mode 100644 src/HelloShop.ServiceDefaults/Infrastructure/AcceptLanguageHeaderDocumentTransformer.cs delete mode 100644 src/HelloShop.ServiceDefaults/Infrastructure/AcceptLanguageHeaderOperationFilter.cs create mode 100644 src/HelloShop.ServiceDefaults/Resources/OpenApi/logo-white.svg diff --git a/Directory.Packages.props b/Directory.Packages.props index 7a485d5..1590369 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -4,55 +4,62 @@ true - - - - - - - - - - + + + + + + + + + + + - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - + + + + + + - + + \ No newline at end of file diff --git a/HelloShop.Web.slnf b/HelloShop.Web.slnf index 105c3bd..934d829 100644 --- a/HelloShop.Web.slnf +++ b/HelloShop.Web.slnf @@ -1,6 +1,6 @@ { "solution": { - "path": "HelloShop.sln", + "path": "HelloShop.slnx", "projects": [ "src\\HelloShop.ApiService\\HelloShop.ApiService.csproj", "src\\HelloShop.AppHost\\HelloShop.AppHost.csproj", diff --git a/HelloShop.sln b/HelloShop.sln deleted file mode 100644 index c8a1674..0000000 --- a/HelloShop.sln +++ /dev/null @@ -1,175 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.9.34414.90 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HelloShop.AppHost", "src\HelloShop.AppHost\HelloShop.AppHost.csproj", "{6E0528E7-81A4-4AA4-9E04-BDDB40CD33EC}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HelloShop.ServiceDefaults", "src\HelloShop.ServiceDefaults\HelloShop.ServiceDefaults.csproj", "{800A173E-67E6-44BC-9BF1-52562A785A34}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HelloShop.ApiService", "src\HelloShop.ApiService\HelloShop.ApiService.csproj", "{F8D111B0-BF41-4F76-B404-BDDDC53A4462}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HelloShop.IdentityService", "src\HelloShop.IdentityService\HelloShop.IdentityService.csproj", "{5C355BCB-A344-4259-82D1-1DA07EE9C83A}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HelloShop.OrderingService", "src\HelloShop.OrderingService\HelloShop.OrderingService.csproj", "{C4789097-3694-4370-9252-44268661A26E}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HelloShop.ProductService", "src\HelloShop.ProductService\HelloShop.ProductService.csproj", "{B4C0ADA2-0442-4B7E-BFD9-AA39B52A0D42}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HelloShop.BasketService", "src\HelloShop.BasketService\HelloShop.BasketService.csproj", "{02EBA5AD-84B4-4AF4-B519-72061C08800D}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{1AD03316-A743-4E9D-B3BC-FB9499D15141}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{29BE158E-825E-48AB-A02D-4E537A5DC502}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HelloShop.ProductService.UnitTests", "tests\HelloShop.ProductService.UnitTests\HelloShop.ProductService.UnitTests.csproj", "{2022279A-E39F-4489-82AE-39AC53C594C9}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HelloShop.ProductService.FunctionalTests", "tests\HelloShop.ProductService.FunctionalTests\HelloShop.ProductService.FunctionalTests.csproj", "{45932B7F-6ED0-40F3-AA2C-F14A844FEE18}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HelloShop.FunctionalTests", "tests\HelloShop.FunctionalTests\HelloShop.FunctionalTests.csproj", "{6BAA9747-E0D0-41B9-8A1B-88B777498C43}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelloShop.BasketService.UnitTests", "tests\HelloShop.BasketService.UnitTests\HelloShop.BasketService.UnitTests.csproj", "{BE88233A-D6EB-462B-B53C-B588A0BEFAFC}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "libraries", "libraries", "{02EA681E-C7D8-13C7-8484-4AC65E1B71E8}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelloShop.EventBus.Abstractions", "libraries\HelloShop.EventBus.Abstractions\HelloShop.EventBus.Abstractions.csproj", "{9959387D-8C47-462C-808E-A1E865658C3F}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelloShop.EventBus.Dapr", "libraries\HelloShop.EventBus.Dapr\HelloShop.EventBus.Dapr.csproj", "{2FD0A058-A447-42C7-A00B-711B2D0B3333}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelloShop.EventBus.RabbitMQ", "libraries\HelloShop.EventBus.RabbitMQ\HelloShop.EventBus.RabbitMQ.csproj", "{5D403BF6-9267-4B0F-AEB3-2143C8BBA8CD}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelloShop.DistributedLock", "libraries\HelloShop.DistributedLock\HelloShop.DistributedLock.csproj", "{86729635-8E31-4C53-81AE-7C410C848219}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelloShop.DistributedLock.Dapr", "libraries\HelloShop.DistributedLock.Dapr\HelloShop.DistributedLock.Dapr.csproj", "{37F01A0B-50D6-48BA-8A20-FBADB5524CD7}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelloShop.EventBus.Logging", "libraries\HelloShop.EventBus.Logging\HelloShop.EventBus.Logging.csproj", "{ACBA2FA9-ADBB-4FCD-A303-6D8D4B2131AA}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelloShop.AppShared", "src\HelloShop.AppShared\HelloShop.AppShared.csproj", "{6636FED3-3BE6-4A5F-A8F9-15ED4FC71A3A}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelloShop.WebApp", "src\HelloShop.WebApp\HelloShop.WebApp\HelloShop.WebApp.csproj", "{3D558DAB-E330-0B21-6BFD-6B3CC78AB653}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelloShop.WebApp.Client", "src\HelloShop.WebApp\HelloShop.WebApp.Client\HelloShop.WebApp.Client.csproj", "{64268ECF-AB72-5485-9CEA-D8350A202CA8}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelloShop.HybridApp", "src\HelloShop.HybridApp\HelloShop.HybridApp.csproj", "{D2046750-0B6D-41CC-8C87-BE3524FDC9C7}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {6E0528E7-81A4-4AA4-9E04-BDDB40CD33EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6E0528E7-81A4-4AA4-9E04-BDDB40CD33EC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6E0528E7-81A4-4AA4-9E04-BDDB40CD33EC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {6E0528E7-81A4-4AA4-9E04-BDDB40CD33EC}.Release|Any CPU.Build.0 = Release|Any CPU - {800A173E-67E6-44BC-9BF1-52562A785A34}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {800A173E-67E6-44BC-9BF1-52562A785A34}.Debug|Any CPU.Build.0 = Debug|Any CPU - {800A173E-67E6-44BC-9BF1-52562A785A34}.Release|Any CPU.ActiveCfg = Release|Any CPU - {800A173E-67E6-44BC-9BF1-52562A785A34}.Release|Any CPU.Build.0 = Release|Any CPU - {F8D111B0-BF41-4F76-B404-BDDDC53A4462}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F8D111B0-BF41-4F76-B404-BDDDC53A4462}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F8D111B0-BF41-4F76-B404-BDDDC53A4462}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F8D111B0-BF41-4F76-B404-BDDDC53A4462}.Release|Any CPU.Build.0 = Release|Any CPU - {5C355BCB-A344-4259-82D1-1DA07EE9C83A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {5C355BCB-A344-4259-82D1-1DA07EE9C83A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5C355BCB-A344-4259-82D1-1DA07EE9C83A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {5C355BCB-A344-4259-82D1-1DA07EE9C83A}.Release|Any CPU.Build.0 = Release|Any CPU - {C4789097-3694-4370-9252-44268661A26E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C4789097-3694-4370-9252-44268661A26E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C4789097-3694-4370-9252-44268661A26E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C4789097-3694-4370-9252-44268661A26E}.Release|Any CPU.Build.0 = Release|Any CPU - {B4C0ADA2-0442-4B7E-BFD9-AA39B52A0D42}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B4C0ADA2-0442-4B7E-BFD9-AA39B52A0D42}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B4C0ADA2-0442-4B7E-BFD9-AA39B52A0D42}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B4C0ADA2-0442-4B7E-BFD9-AA39B52A0D42}.Release|Any CPU.Build.0 = Release|Any CPU - {02EBA5AD-84B4-4AF4-B519-72061C08800D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {02EBA5AD-84B4-4AF4-B519-72061C08800D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {02EBA5AD-84B4-4AF4-B519-72061C08800D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {02EBA5AD-84B4-4AF4-B519-72061C08800D}.Release|Any CPU.Build.0 = Release|Any CPU - {2022279A-E39F-4489-82AE-39AC53C594C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2022279A-E39F-4489-82AE-39AC53C594C9}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2022279A-E39F-4489-82AE-39AC53C594C9}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2022279A-E39F-4489-82AE-39AC53C594C9}.Release|Any CPU.Build.0 = Release|Any CPU - {45932B7F-6ED0-40F3-AA2C-F14A844FEE18}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {45932B7F-6ED0-40F3-AA2C-F14A844FEE18}.Debug|Any CPU.Build.0 = Debug|Any CPU - {45932B7F-6ED0-40F3-AA2C-F14A844FEE18}.Release|Any CPU.ActiveCfg = Release|Any CPU - {45932B7F-6ED0-40F3-AA2C-F14A844FEE18}.Release|Any CPU.Build.0 = Release|Any CPU - {6BAA9747-E0D0-41B9-8A1B-88B777498C43}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6BAA9747-E0D0-41B9-8A1B-88B777498C43}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6BAA9747-E0D0-41B9-8A1B-88B777498C43}.Release|Any CPU.ActiveCfg = Release|Any CPU - {6BAA9747-E0D0-41B9-8A1B-88B777498C43}.Release|Any CPU.Build.0 = Release|Any CPU - {BE88233A-D6EB-462B-B53C-B588A0BEFAFC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {BE88233A-D6EB-462B-B53C-B588A0BEFAFC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {BE88233A-D6EB-462B-B53C-B588A0BEFAFC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {BE88233A-D6EB-462B-B53C-B588A0BEFAFC}.Release|Any CPU.Build.0 = Release|Any CPU - {9959387D-8C47-462C-808E-A1E865658C3F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9959387D-8C47-462C-808E-A1E865658C3F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9959387D-8C47-462C-808E-A1E865658C3F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {9959387D-8C47-462C-808E-A1E865658C3F}.Release|Any CPU.Build.0 = Release|Any CPU - {2FD0A058-A447-42C7-A00B-711B2D0B3333}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2FD0A058-A447-42C7-A00B-711B2D0B3333}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2FD0A058-A447-42C7-A00B-711B2D0B3333}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2FD0A058-A447-42C7-A00B-711B2D0B3333}.Release|Any CPU.Build.0 = Release|Any CPU - {5D403BF6-9267-4B0F-AEB3-2143C8BBA8CD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {5D403BF6-9267-4B0F-AEB3-2143C8BBA8CD}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5D403BF6-9267-4B0F-AEB3-2143C8BBA8CD}.Release|Any CPU.ActiveCfg = Release|Any CPU - {5D403BF6-9267-4B0F-AEB3-2143C8BBA8CD}.Release|Any CPU.Build.0 = Release|Any CPU - {86729635-8E31-4C53-81AE-7C410C848219}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {86729635-8E31-4C53-81AE-7C410C848219}.Debug|Any CPU.Build.0 = Debug|Any CPU - {86729635-8E31-4C53-81AE-7C410C848219}.Release|Any CPU.ActiveCfg = Release|Any CPU - {86729635-8E31-4C53-81AE-7C410C848219}.Release|Any CPU.Build.0 = Release|Any CPU - {37F01A0B-50D6-48BA-8A20-FBADB5524CD7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {37F01A0B-50D6-48BA-8A20-FBADB5524CD7}.Debug|Any CPU.Build.0 = Debug|Any CPU - {37F01A0B-50D6-48BA-8A20-FBADB5524CD7}.Release|Any CPU.ActiveCfg = Release|Any CPU - {37F01A0B-50D6-48BA-8A20-FBADB5524CD7}.Release|Any CPU.Build.0 = Release|Any CPU - {ACBA2FA9-ADBB-4FCD-A303-6D8D4B2131AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {ACBA2FA9-ADBB-4FCD-A303-6D8D4B2131AA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {ACBA2FA9-ADBB-4FCD-A303-6D8D4B2131AA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {ACBA2FA9-ADBB-4FCD-A303-6D8D4B2131AA}.Release|Any CPU.Build.0 = Release|Any CPU - {6636FED3-3BE6-4A5F-A8F9-15ED4FC71A3A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6636FED3-3BE6-4A5F-A8F9-15ED4FC71A3A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6636FED3-3BE6-4A5F-A8F9-15ED4FC71A3A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {6636FED3-3BE6-4A5F-A8F9-15ED4FC71A3A}.Release|Any CPU.Build.0 = Release|Any CPU - {3D558DAB-E330-0B21-6BFD-6B3CC78AB653}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3D558DAB-E330-0B21-6BFD-6B3CC78AB653}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3D558DAB-E330-0B21-6BFD-6B3CC78AB653}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3D558DAB-E330-0B21-6BFD-6B3CC78AB653}.Release|Any CPU.Build.0 = Release|Any CPU - {64268ECF-AB72-5485-9CEA-D8350A202CA8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {64268ECF-AB72-5485-9CEA-D8350A202CA8}.Debug|Any CPU.Build.0 = Debug|Any CPU - {64268ECF-AB72-5485-9CEA-D8350A202CA8}.Release|Any CPU.ActiveCfg = Release|Any CPU - {64268ECF-AB72-5485-9CEA-D8350A202CA8}.Release|Any CPU.Build.0 = Release|Any CPU - {D2046750-0B6D-41CC-8C87-BE3524FDC9C7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D2046750-0B6D-41CC-8C87-BE3524FDC9C7}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D2046750-0B6D-41CC-8C87-BE3524FDC9C7}.Debug|Any CPU.Deploy.0 = Debug|Any CPU - {D2046750-0B6D-41CC-8C87-BE3524FDC9C7}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D2046750-0B6D-41CC-8C87-BE3524FDC9C7}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {6E0528E7-81A4-4AA4-9E04-BDDB40CD33EC} = {1AD03316-A743-4E9D-B3BC-FB9499D15141} - {800A173E-67E6-44BC-9BF1-52562A785A34} = {1AD03316-A743-4E9D-B3BC-FB9499D15141} - {F8D111B0-BF41-4F76-B404-BDDDC53A4462} = {1AD03316-A743-4E9D-B3BC-FB9499D15141} - {5C355BCB-A344-4259-82D1-1DA07EE9C83A} = {1AD03316-A743-4E9D-B3BC-FB9499D15141} - {C4789097-3694-4370-9252-44268661A26E} = {1AD03316-A743-4E9D-B3BC-FB9499D15141} - {B4C0ADA2-0442-4B7E-BFD9-AA39B52A0D42} = {1AD03316-A743-4E9D-B3BC-FB9499D15141} - {02EBA5AD-84B4-4AF4-B519-72061C08800D} = {1AD03316-A743-4E9D-B3BC-FB9499D15141} - {2022279A-E39F-4489-82AE-39AC53C594C9} = {29BE158E-825E-48AB-A02D-4E537A5DC502} - {45932B7F-6ED0-40F3-AA2C-F14A844FEE18} = {29BE158E-825E-48AB-A02D-4E537A5DC502} - {6BAA9747-E0D0-41B9-8A1B-88B777498C43} = {29BE158E-825E-48AB-A02D-4E537A5DC502} - {BE88233A-D6EB-462B-B53C-B588A0BEFAFC} = {29BE158E-825E-48AB-A02D-4E537A5DC502} - {9959387D-8C47-462C-808E-A1E865658C3F} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8} - {2FD0A058-A447-42C7-A00B-711B2D0B3333} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8} - {5D403BF6-9267-4B0F-AEB3-2143C8BBA8CD} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8} - {86729635-8E31-4C53-81AE-7C410C848219} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8} - {37F01A0B-50D6-48BA-8A20-FBADB5524CD7} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8} - {ACBA2FA9-ADBB-4FCD-A303-6D8D4B2131AA} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8} - {6636FED3-3BE6-4A5F-A8F9-15ED4FC71A3A} = {1AD03316-A743-4E9D-B3BC-FB9499D15141} - {3D558DAB-E330-0B21-6BFD-6B3CC78AB653} = {1AD03316-A743-4E9D-B3BC-FB9499D15141} - {64268ECF-AB72-5485-9CEA-D8350A202CA8} = {1AD03316-A743-4E9D-B3BC-FB9499D15141} - {D2046750-0B6D-41CC-8C87-BE3524FDC9C7} = {1AD03316-A743-4E9D-B3BC-FB9499D15141} - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {845545A8-2006-46C3-ABD7-5BDF63F3858C} - EndGlobalSection -EndGlobal diff --git a/HelloShop.slnx b/HelloShop.slnx new file mode 100644 index 0000000..6e19dee --- /dev/null +++ b/HelloShop.slnx @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libraries/HelloShop.DistributedLock.Dapr/DaprDistributedLock.cs b/libraries/HelloShop.DistributedLock.Dapr/DaprDistributedLock.cs index cd78442..5ca78dd 100644 --- a/libraries/HelloShop.DistributedLock.Dapr/DaprDistributedLock.cs +++ b/libraries/HelloShop.DistributedLock.Dapr/DaprDistributedLock.cs @@ -12,12 +12,12 @@ namespace HelloShop.DistributedLock.Dapr { expiryInSeconds = expiryInSeconds == default ? 60 : expiryInSeconds; - // The CallerMemberNameAttribute is used to get the name of the calling method. string? lockOwner = new StackTrace().GetFrame(1)?.GetMethod()?.DeclaringType?.Name; + lockOwner ??= Guid.NewGuid().ToString(); -#pragma warning disable CS0618 +#pragma warning disable DAPR_DISTRIBUTEDLOCK // 类型仅用于评估,在将来的更新中可能会被更改或删除。取消此诊断以继续。 TryLockResponse response = await daprClient.Lock("lockstore", resourceId, lockOwner, expiryInSeconds, cancellationToken); -#pragma warning restore CS0618 +#pragma warning restore DAPR_DISTRIBUTEDLOCK // 类型仅用于评估,在将来的更新中可能会被更改或删除。取消此诊断以继续。 return new DaprDistributedLockResult(response); } diff --git a/libraries/HelloShop.DistributedLock.Dapr/DaprDistributedLockResult.cs b/libraries/HelloShop.DistributedLock.Dapr/DaprDistributedLockResult.cs index b52e867..904bcc9 100644 --- a/libraries/HelloShop.DistributedLock.Dapr/DaprDistributedLockResult.cs +++ b/libraries/HelloShop.DistributedLock.Dapr/DaprDistributedLockResult.cs @@ -5,9 +5,9 @@ using Dapr.Client; namespace HelloShop.DistributedLock.Dapr { -#pragma warning disable CS0618 +#pragma warning disable DAPR_DISTRIBUTEDLOCK // 类型仅用于评估,在将来的更新中可能会被更改或删除。取消此诊断以继续。 public class DaprDistributedLockResult(TryLockResponse tryLockResponse) : IDistributedLockResult -#pragma warning restore CS0618 +#pragma warning restore DAPR_DISTRIBUTEDLOCK // 类型仅用于评估,在将来的更新中可能会被更改或删除。取消此诊断以继续。 { public async ValueTask DisposeAsync() { diff --git a/libraries/HelloShop.DistributedLock.Dapr/HelloShop.DistributedLock.Dapr.csproj b/libraries/HelloShop.DistributedLock.Dapr/HelloShop.DistributedLock.Dapr.csproj index f942359..4b604a2 100644 --- a/libraries/HelloShop.DistributedLock.Dapr/HelloShop.DistributedLock.Dapr.csproj +++ b/libraries/HelloShop.DistributedLock.Dapr/HelloShop.DistributedLock.Dapr.csproj @@ -1,7 +1,7 @@  - net9.0 + net10.0 enable enable diff --git a/libraries/HelloShop.DistributedLock/HelloShop.DistributedLock.csproj b/libraries/HelloShop.DistributedLock/HelloShop.DistributedLock.csproj index 125f4c9..b760144 100644 --- a/libraries/HelloShop.DistributedLock/HelloShop.DistributedLock.csproj +++ b/libraries/HelloShop.DistributedLock/HelloShop.DistributedLock.csproj @@ -1,7 +1,7 @@  - net9.0 + net10.0 enable enable diff --git a/libraries/HelloShop.EventBus.Abstractions/HelloShop.EventBus.Abstractions.csproj b/libraries/HelloShop.EventBus.Abstractions/HelloShop.EventBus.Abstractions.csproj index 757aebf..5324c58 100644 --- a/libraries/HelloShop.EventBus.Abstractions/HelloShop.EventBus.Abstractions.csproj +++ b/libraries/HelloShop.EventBus.Abstractions/HelloShop.EventBus.Abstractions.csproj @@ -1,7 +1,7 @@  - net9.0 + net10.0 enable enable diff --git a/libraries/HelloShop.EventBus.Dapr/HelloShop.EventBus.Dapr.csproj b/libraries/HelloShop.EventBus.Dapr/HelloShop.EventBus.Dapr.csproj index 0b35680..e536af0 100644 --- a/libraries/HelloShop.EventBus.Dapr/HelloShop.EventBus.Dapr.csproj +++ b/libraries/HelloShop.EventBus.Dapr/HelloShop.EventBus.Dapr.csproj @@ -1,7 +1,7 @@  - net9.0 + net10.0 enable enable diff --git a/libraries/HelloShop.EventBus.Logging/HelloShop.EventBus.Logging.csproj b/libraries/HelloShop.EventBus.Logging/HelloShop.EventBus.Logging.csproj index 8794144..88daa2f 100644 --- a/libraries/HelloShop.EventBus.Logging/HelloShop.EventBus.Logging.csproj +++ b/libraries/HelloShop.EventBus.Logging/HelloShop.EventBus.Logging.csproj @@ -1,7 +1,7 @@  - net9.0 + net10.0 enable enable diff --git a/libraries/HelloShop.EventBus.RabbitMQ/HelloShop.EventBus.RabbitMQ.csproj b/libraries/HelloShop.EventBus.RabbitMQ/HelloShop.EventBus.RabbitMQ.csproj index 51bc6db..3886925 100644 --- a/libraries/HelloShop.EventBus.RabbitMQ/HelloShop.EventBus.RabbitMQ.csproj +++ b/libraries/HelloShop.EventBus.RabbitMQ/HelloShop.EventBus.RabbitMQ.csproj @@ -1,7 +1,7 @@  - net9.0 + net10.0 enable enable diff --git a/libraries/HelloShop.EventBus.RabbitMQ/RabbitMQEventBus.cs b/libraries/HelloShop.EventBus.RabbitMQ/RabbitMQEventBus.cs index 6d3dc18..5ba93d3 100644 --- a/libraries/HelloShop.EventBus.RabbitMQ/RabbitMQEventBus.cs +++ b/libraries/HelloShop.EventBus.RabbitMQ/RabbitMQEventBus.cs @@ -25,26 +25,26 @@ namespace HelloShop.EventBus.RabbitMQ private readonly EventBusOptions _eventBusOptions = eventBusOptions.Value; private IConnection? _rabbitMQConnection; - private IModel? _consumerChannel; + private IChannel? _consumerChannel; public Task StartAsync(CancellationToken cancellationToken) { - Task.Factory.StartNew(() => + Task.Factory.StartNew(async () => { try { _rabbitMQConnection = serviceProvider.GetRequiredService(); - _consumerChannel = _rabbitMQConnection.CreateModel(); - _consumerChannel.ExchangeDeclare(exchange: _exchangeName, type: ExchangeType.Direct); - _consumerChannel.QueueDeclare(queue: _queueName, durable: true, exclusive: false, autoDelete: false, arguments: null); + _consumerChannel = await _rabbitMQConnection.CreateChannelAsync(); + await _consumerChannel.ExchangeDeclareAsync(exchange: _exchangeName, type: ExchangeType.Direct); + await _consumerChannel.QueueDeclareAsync(queue: _queueName, durable: true, exclusive: false, autoDelete: false, arguments: null); var consumer = new AsyncEventingBasicConsumer(_consumerChannel); - consumer.Received += OnMessageReceivedAsync; - _consumerChannel.BasicConsume(queue: _queueName, autoAck: false, consumer: consumer); + consumer.ReceivedAsync += OnMessageReceivedAsync; + await _consumerChannel.BasicConsumeAsync(queue: _queueName, autoAck: false, consumer: consumer); foreach (var (eventName, _) in _eventBusOptions.EventTypes) { - _consumerChannel.QueueBind(queue: _queueName, exchange: _exchangeName, routingKey: eventName); + await _consumerChannel.QueueBindAsync(queue: _queueName, exchange: _exchangeName, routingKey: eventName); } } catch (Exception ex) @@ -58,25 +58,36 @@ namespace HelloShop.EventBus.RabbitMQ public Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask; - public void Dispose() => _consumerChannel?.Dispose(); + public async void Dispose() + { + if (_consumerChannel is not null) + { + await _consumerChannel.CloseAsync(); + await _consumerChannel.DisposeAsync(); + } + } - public Task PublishAsync(DistributedEvent @event, CancellationToken cancellationToken = default) + public async Task PublishAsync(DistributedEvent @event, CancellationToken cancellationToken = default) { string routingKey = @event.GetType().Name; - using var channel = _rabbitMQConnection?.CreateModel() ?? throw new InvalidOperationException("RabbitMQ connection is not available."); + var channel = _rabbitMQConnection is not null ? await _rabbitMQConnection.CreateChannelAsync(cancellationToken: cancellationToken) : throw new InvalidOperationException("RabbitMQ connection is not available."); - channel.ExchangeDeclare(exchange: _exchangeName, type: ExchangeType.Direct); - - var body = JsonSerializer.SerializeToUtf8Bytes(@event, @event.GetType(), _eventBusOptions.JsonSerializerOptions); - - return _pipeline.Execute(() => + await using (channel) { - IBasicProperties properties = channel.CreateBasicProperties(); - properties.DeliveryMode = 2; - channel.BasicPublish(exchange: _exchangeName, routingKey: routingKey, mandatory: true, basicProperties: properties, body: body); - return Task.CompletedTask; - }); + await channel.ExchangeDeclareAsync(exchange: _exchangeName, type: ExchangeType.Direct, cancellationToken: cancellationToken); + + var body = JsonSerializer.SerializeToUtf8Bytes(@event, @event.GetType(), _eventBusOptions.JsonSerializerOptions); + + await _pipeline.ExecuteAsync(async (ct) => + { + var properties = new BasicProperties + { + DeliveryMode = DeliveryModes.Persistent + }; + await channel.BasicPublishAsync(exchange: _exchangeName, routingKey: routingKey, mandatory: true, basicProperties: properties, body: body, cancellationToken: ct); + }, cancellationToken); + } } private async Task OnMessageReceivedAsync(object sender, BasicDeliverEventArgs eventArgs) @@ -101,7 +112,10 @@ namespace HelloShop.EventBus.RabbitMQ } } - _consumerChannel?.BasicAck(eventArgs.DeliveryTag, multiple: false); + if (_consumerChannel is not null) + { + await _consumerChannel.BasicAckAsync(eventArgs.DeliveryTag, multiple: false); + } } private static ResiliencePipeline CreateResiliencePipeline(int retryCount) diff --git a/libraries/HelloShop.EventBus.RabbitMQ/RabbitMQEventBusExtensions.cs b/libraries/HelloShop.EventBus.RabbitMQ/RabbitMQEventBusExtensions.cs index ad094f8..ac93b7b 100644 --- a/libraries/HelloShop.EventBus.RabbitMQ/RabbitMQEventBusExtensions.cs +++ b/libraries/HelloShop.EventBus.RabbitMQ/RabbitMQEventBusExtensions.cs @@ -17,7 +17,7 @@ namespace HelloShop.EventBus.RabbitMQ builder.AddRabbitMQClient(connectionName, configureConnectionFactory: factory => { - factory.DispatchConsumersAsync = true; + factory.ConsumerDispatchConcurrency = 5; }); builder.Services.Configure(builder.Configuration.GetSection(sectionName)); diff --git a/samples/GarnetWindowsService/GarnetWindowsService.sln b/samples/GarnetWindowsService/GarnetWindowsService.sln deleted file mode 100644 index 6a74725..0000000 --- a/samples/GarnetWindowsService/GarnetWindowsService.sln +++ /dev/null @@ -1,25 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.10.35027.167 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GarnetWindowsService", "GarnetWindowsService\GarnetWindowsService.csproj", "{AA03C1F8-86B1-446F-B4A0-4A69903351BB}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {AA03C1F8-86B1-446F-B4A0-4A69903351BB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {AA03C1F8-86B1-446F-B4A0-4A69903351BB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {AA03C1F8-86B1-446F-B4A0-4A69903351BB}.Release|Any CPU.ActiveCfg = Release|Any CPU - {AA03C1F8-86B1-446F-B4A0-4A69903351BB}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {9293CD78-718B-4A38-BE60-4A1C7DF6D3F7} - EndGlobalSection -EndGlobal diff --git a/samples/GarnetWindowsService/GarnetWindowsService.slnx b/samples/GarnetWindowsService/GarnetWindowsService.slnx new file mode 100644 index 0000000..0a02ea6 --- /dev/null +++ b/samples/GarnetWindowsService/GarnetWindowsService.slnx @@ -0,0 +1,3 @@ + + + diff --git a/samples/MultiTenancySample/MultiTenancySample.sln b/samples/MultiTenancySample/MultiTenancySample.sln deleted file mode 100644 index 750e740..0000000 --- a/samples/MultiTenancySample/MultiTenancySample.sln +++ /dev/null @@ -1,43 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.9.34728.123 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MultiTenancySample.SchemaIsolationService", "MultiTenancySample.SchemaIsolationService\MultiTenancySample.SchemaIsolationService.csproj", "{57818F02-DC4F-44CD-89A6-75D00AB5640C}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MultiTenancySample.DatabaseIsolationService", "MultiTenancySample.DatabaseIsolationService\MultiTenancySample.DatabaseIsolationService.csproj", "{340A9AE9-C3FA-4555-86AF-395780D2B89B}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MultiTenancySample.FieldIsolationService", "MultiTenancySample.FieldIsolationService\MultiTenancySample.FieldIsolationService.csproj", "{0B3EB138-AE17-4EB0-B282-88777F6D5FCA}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MultiTenancySample.ServiceDefaults", "MultiTenancySample.ServiceDefaults\MultiTenancySample.ServiceDefaults.csproj", "{CF4169D1-AB89-42FD-B209-FCBA9B6F0816}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {57818F02-DC4F-44CD-89A6-75D00AB5640C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {57818F02-DC4F-44CD-89A6-75D00AB5640C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {57818F02-DC4F-44CD-89A6-75D00AB5640C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {57818F02-DC4F-44CD-89A6-75D00AB5640C}.Release|Any CPU.Build.0 = Release|Any CPU - {340A9AE9-C3FA-4555-86AF-395780D2B89B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {340A9AE9-C3FA-4555-86AF-395780D2B89B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {340A9AE9-C3FA-4555-86AF-395780D2B89B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {340A9AE9-C3FA-4555-86AF-395780D2B89B}.Release|Any CPU.Build.0 = Release|Any CPU - {0B3EB138-AE17-4EB0-B282-88777F6D5FCA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0B3EB138-AE17-4EB0-B282-88777F6D5FCA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0B3EB138-AE17-4EB0-B282-88777F6D5FCA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0B3EB138-AE17-4EB0-B282-88777F6D5FCA}.Release|Any CPU.Build.0 = Release|Any CPU - {CF4169D1-AB89-42FD-B209-FCBA9B6F0816}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {CF4169D1-AB89-42FD-B209-FCBA9B6F0816}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CF4169D1-AB89-42FD-B209-FCBA9B6F0816}.Release|Any CPU.ActiveCfg = Release|Any CPU - {CF4169D1-AB89-42FD-B209-FCBA9B6F0816}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {201289BC-2E55-46AF-AD01-B3D4288D9904} - EndGlobalSection -EndGlobal diff --git a/samples/MultiTenancySample/MultiTenancySample.slnx b/samples/MultiTenancySample/MultiTenancySample.slnx new file mode 100644 index 0000000..2083893 --- /dev/null +++ b/samples/MultiTenancySample/MultiTenancySample.slnx @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/HelloShop.ApiService/Extensions/OpenApiConfigureOptions.cs b/src/HelloShop.ApiService/Extensions/OpenApiConfigureOptions.cs index 15cdae8..8c7cb94 100644 --- a/src/HelloShop.ApiService/Extensions/OpenApiConfigureOptions.cs +++ b/src/HelloShop.ApiService/Extensions/OpenApiConfigureOptions.cs @@ -17,7 +17,7 @@ public class OpenApiConfigureOptions(IConfiguredServiceEndPointResolver serviceR { foreach (var endPoint in serviceEndpoint.Endpoints ?? []) { - UriBuilder uriBuilder = new(endPoint) { Path = "swagger/v1/swagger.json" }; + UriBuilder uriBuilder = new(endPoint) { Path = "/openapi/v1.json" }; try { @@ -35,12 +35,15 @@ public class OpenApiConfigureOptions(IConfiguredServiceEndPointResolver serviceR } catch (Exception ex) { - logger.LogError(ex, "Failed to get swagger endpoint for {ServiceName}", serviceEndpoint.ServiceName); + if (logger.IsEnabled(LogLevel.Error)) + { + logger.LogError(ex, "Failed to get swagger endpoint for {ServiceName}", serviceEndpoint.ServiceName); + } } } } options.ConfigObject.Urls = urlDescriptors; - options.SwaggerEndpoint("v1/swagger.json", "apiservice"); + options.SwaggerEndpoint("/openapi/v1.json", "apiservice"); } } diff --git a/src/HelloShop.ApiService/HelloShop.ApiService.csproj b/src/HelloShop.ApiService/HelloShop.ApiService.csproj index e405e12..59cc7b0 100644 --- a/src/HelloShop.ApiService/HelloShop.ApiService.csproj +++ b/src/HelloShop.ApiService/HelloShop.ApiService.csproj @@ -1,9 +1,10 @@  Exe - net9.0 + net10.0 enable enable + $(InterceptorsNamespaces);Microsoft.AspNetCore.OpenApi.Generated diff --git a/src/HelloShop.ApiService/Program.cs b/src/HelloShop.ApiService/Program.cs index 4fadada..bc0a262 100644 --- a/src/HelloShop.ApiService/Program.cs +++ b/src/HelloShop.ApiService/Program.cs @@ -46,6 +46,6 @@ app.MapReverseProxy(); app.MapControllers(); -app.UseOpenApi(); +app.UseOpenApiWithUI(); app.Run(); diff --git a/src/HelloShop.AppHost/HelloShop.AppHost.csproj b/src/HelloShop.AppHost/HelloShop.AppHost.csproj index 67551a9..5d122a8 100644 --- a/src/HelloShop.AppHost/HelloShop.AppHost.csproj +++ b/src/HelloShop.AppHost/HelloShop.AppHost.csproj @@ -1,8 +1,7 @@ - - + Exe - net9.0 + net10.0 enable enable @@ -15,7 +14,7 @@ - + diff --git a/src/HelloShop.AppHost/Program.cs b/src/HelloShop.AppHost/Program.cs index 52cb8aa..ab0577f 100644 --- a/src/HelloShop.AppHost/Program.cs +++ b/src/HelloShop.AppHost/Program.cs @@ -3,6 +3,7 @@ using CommunityToolkit.Aspire.Hosting.Dapr; using HelloShop.AppHost.Extensions; +using k8s.Models; var builder = DistributedApplication.CreateBuilder(args); @@ -50,7 +51,7 @@ var basketService = builder.AddProject("basket options.WithOptions(daprSidecarOptions).WithReferenceAndWaitFor(rabbitmq).WithReferenceAndWaitFor(cache); }); -var apiservice = builder.AddProject("apiservice") +var apiService = builder.AddProject("apiservice") .WithReference(identityService).WaitFor(identityService) .WithReference(orderingService).WaitFor(orderingService) .WithReference(productService).WaitFor(productService) @@ -58,7 +59,14 @@ var apiservice = builder.AddProject("apiservice") .WithDaprSidecar(); builder.AddProject("webapp") - .WithReference(apiservice).WaitFor(apiservice) + .WithReference(apiService).WaitFor(apiService) .WithDaprSidecar(); +var mauiapp = builder.AddMauiProject("hybridapp", "../HelloShop.HybridApp/HelloShop.HybridApp.csproj"); + +mauiapp.AddWindowsDevice().WithReference(apiService).WaitFor(apiService); +mauiapp.AddMacCatalystDevice().WithReference(apiService).WaitFor(apiService); +mauiapp.AddiOSSimulator().WithReference(apiService).WaitFor(apiService); +mauiapp.AddAndroidEmulator().WithReference(apiService).WaitFor(apiService); + builder.Build().Run(); diff --git a/src/HelloShop.AppShared/HelloShop.AppShared.csproj b/src/HelloShop.AppShared/HelloShop.AppShared.csproj index 6365ef6..022af67 100644 --- a/src/HelloShop.AppShared/HelloShop.AppShared.csproj +++ b/src/HelloShop.AppShared/HelloShop.AppShared.csproj @@ -1,7 +1,7 @@ - net9.0 + net10.0 enable enable diff --git a/src/HelloShop.BasketService/HelloShop.BasketService.csproj b/src/HelloShop.BasketService/HelloShop.BasketService.csproj index 667ba5c..632065c 100644 --- a/src/HelloShop.BasketService/HelloShop.BasketService.csproj +++ b/src/HelloShop.BasketService/HelloShop.BasketService.csproj @@ -1,9 +1,10 @@  - net9.0 + net10.0 enable enable true + $(InterceptorsNamespaces);Microsoft.AspNetCore.OpenApi.Generated diff --git a/src/HelloShop.BasketService/Program.cs b/src/HelloShop.BasketService/Program.cs index 203cddf..62fba9d 100644 --- a/src/HelloShop.BasketService/Program.cs +++ b/src/HelloShop.BasketService/Program.cs @@ -8,7 +8,10 @@ using HelloShop.BasketService.Services; using HelloShop.EventBus.Abstractions; using HelloShop.EventBus.Dapr; using HelloShop.ServiceDefaults.Extensions; +using Microsoft.Extensions.FileProviders; +using Microsoft.Extensions.Options; using Microsoft.IdentityModel.Tokens; +using System.Reflection; using System.Text; var builder = WebApplication.CreateBuilder(args); @@ -33,7 +36,7 @@ builder.Services.AddSingleton(); builder.Services.AddGrpc().AddJsonTranscoding(); builder.Services.AddGrpcSwagger(); -builder.Services.AddOpenApi(); +builder.Services.AddSwaggerGen(); builder.Services.AddCustomLocalization(); builder.Services.AddModelMapper().AddModelValidator(); @@ -60,7 +63,15 @@ app.UseAuthentication().UseAuthorization(); app.MapGrpcService(); app.MapGrpcService(); app.UseCustomLocalization(); -app.UseOpenApi(); +app.UseSwagger(c => +{ + c.RouteTemplate = "openapi/{documentName}.json"; +}); +app.UseSwaggerUI(c => +{ + c.InjectStylesheet("/ServiceDefaults/Resources/OpenApi/Custom.css"); + c.SwaggerEndpoint("/openapi/v1.json", "v1"); +}); app.MapGroup("api/Permissions").MapPermissionDefinitions("Permissions"); // End configure extensions request pipeline. app.Run(); diff --git a/src/HelloShop.BasketService/appsettings.json b/src/HelloShop.BasketService/appsettings.json index f097952..5c89e35 100644 --- a/src/HelloShop.BasketService/appsettings.json +++ b/src/HelloShop.BasketService/appsettings.json @@ -7,7 +7,7 @@ }, "Kestrel": { "EndpointDefaults": { - "Protocols": "Http2" + "Protocols": "Http1AndHttp2AndHttp3" } }, "AllowedHosts": "*" diff --git a/src/HelloShop.HybridApp/HelloShop.HybridApp.csproj b/src/HelloShop.HybridApp/HelloShop.HybridApp.csproj index 39bb93c..a1120a4 100644 --- a/src/HelloShop.HybridApp/HelloShop.HybridApp.csproj +++ b/src/HelloShop.HybridApp/HelloShop.HybridApp.csproj @@ -1,11 +1,11 @@  - net9.0-android;net9.0-ios;net9.0-maccatalyst - $(TargetFrameworks);net9.0-windows10.0.19041.0 + net10.0-android;net10.0-ios;net10.0-maccatalyst + $(TargetFrameworks);net10.0-windows10.0.19041.0 false - +