From eb162745528f40166436f9b99d384092ee143c8e Mon Sep 17 00:00:00 2001 From: Hisham Bin Ateya Date: Fri, 4 Oct 2024 13:47:38 +0300 Subject: [PATCH] Use Ulid instead of Guid for better PERF --- Directory.Packages.props | 1 + .../AutoSetupMiddleware.cs | 2 +- .../OrchardCore.AutoSetup.csproj | 4 + .../Views/ContentPickerField.Edit.cshtml | 75 +++++--- ...alizationSetContentPickerField.Edit.cshtml | 49 +++-- .../Views/MultiTextField-Picker.Edit.cshtml | 27 ++- .../Views/UserPickerField.Edit.cshtml | 49 +++-- .../Views/ContentPreview.Button.cshtml | 11 +- ...ownload-Button-Actions.SummaryAdmin.cshtml | 6 +- .../OrchardCore.Demo/Views/DemoWidget.cshtml | 2 +- .../OrchardCore.Demo/Views/OuterDoll.cshtml | 2 +- .../OrchardCore.Deployment.Remote.csproj | 4 + .../Services/RemoteClientService.cs | 2 +- .../Services/RemoteInstanceService.cs | 2 +- .../Controllers/StepController.cs | 2 +- .../OrchardCore.Deployment.csproj | 4 + .../CachedShapeWrapperShapes.cs | 2 +- .../OrchardCore.DynamicCache.csproj | 4 + .../TagHelpers/DynamicCacheTagHelper.cs | 2 +- .../OrchardCore.Email.Smtp.csproj | 1 + .../Services/SmtpEmailProviderBase.cs | 2 +- .../Views/BagPart.Edit.cshtml | 44 ++--- .../Views/FlowPart.Edit.cshtml | 85 +++++---- .../Views/Admin/Index.cshtml | 2 +- .../OrchardCore.Liquid.csproj | 4 + .../OrchardCore.Liquid/ScriptsMiddleware.cs | 2 +- .../OrchardCore.OpenId.csproj | 1 + .../Services/OpenIdServerService.cs | 2 +- .../Controllers/AdminController.cs | 2 +- .../OrchardCore.Recipes.csproj | 4 + .../Services/RecipeDeploymentTargetHandler.cs | 2 +- .../OrchardCore.Settings.csproj | 4 + .../Services/SiteService.cs | 2 +- .../Views/TaxonomyField-Tags.Edit.cshtml | 45 +++-- .../Controllers/AdminController.cs | 4 +- .../Controllers/TenantApiController.cs | 4 +- .../OrchardCore.Tenants.csproj | 1 + .../Workflows/Activities/CreateTenantTask.cs | 2 +- .../Controllers/AccountController.cs | 2 +- .../OrchardCore.Users.csproj | 4 + .../Views/ContentCard.cshtml | 8 +- .../Views/WidgetsListPart.Edit.cshtml | 172 +++++++++--------- .../Controllers/WorkflowTypeController.cs | 2 +- .../OrchardCore.Workflows.csproj | 9 +- .../OrchardCore.Abstractions/IdGenerator.cs | 2 +- .../OrchardCore.Abstractions.csproj | 1 + .../Models/AdminMenu.cs | 2 +- .../Models/AdminNode.cs | 2 +- .../OrchardCore.AdminMenu.Abstractions.csproj | 4 + .../Cache/CacheTag.cs | 2 +- ...rchardCore.DisplayManagement.Liquid.csproj | 6 +- .../Entities/DefaultIdGenerator.cs | 2 +- .../OrchardCore.Infrastructure.csproj | 11 +- .../OrchardCore.OpenId.Core.csproj | 1 + .../YesSql/Stores/OpenIdApplicationStore.cs | 2 +- .../YesSql/Stores/OpenIdAuthorizationStore.cs | 2 +- .../YesSql/Stores/OpenIdScopeStore.cs | 2 +- .../YesSql/Stores/OpenIdTokenStore.cs | 2 +- .../OrchardCore.Recipes.Core.csproj | 4 + .../Services/RecipeExecutor.cs | 2 +- .../Services/RecipeMigrator.cs | 2 +- .../OrchardCore.Setup.Core.csproj | 4 + .../OrchardCore.Setup.Core/SetupService.cs | 2 +- .../Authentication/CacheTicketStore.cs | 2 +- .../OrchardCore.Users.Core.csproj | 1 + .../Apis/Context/SiteContext.cs | 6 +- .../Data/JsonDynamicTests.cs | 8 +- .../OpenIdServerDeploymentSourceTests.cs | 4 +- .../OrchardCore.Tests.csproj | 1 + .../AccountControllerTests.cs | 2 +- ...UserClaimsPrincipalProviderFactoryTests.cs | 2 +- .../OrchardCore.Users/UserValidatorTests.cs | 16 +- .../Recipes/RecipeExecutorTests.cs | 4 +- 73 files changed, 440 insertions(+), 321 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 3d06fcdc244..c9e56ac6acb 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -81,6 +81,7 @@ + diff --git a/src/OrchardCore.Modules/OrchardCore.AutoSetup/AutoSetupMiddleware.cs b/src/OrchardCore.Modules/OrchardCore.AutoSetup/AutoSetupMiddleware.cs index 19411e2f406..b6dcc412968 100644 --- a/src/OrchardCore.Modules/OrchardCore.AutoSetup/AutoSetupMiddleware.cs +++ b/src/OrchardCore.Modules/OrchardCore.AutoSetup/AutoSetupMiddleware.cs @@ -216,7 +216,7 @@ public async Task CreateTenantSettingsAsync(TenantSetupOptions se shellSettings["TablePrefix"] = setupOptions.DatabaseTablePrefix; shellSettings["Schema"] = setupOptions.DatabaseSchema; shellSettings["DatabaseProvider"] = setupOptions.DatabaseProvider; - shellSettings["Secret"] = Guid.NewGuid().ToString(); + shellSettings["Secret"] = Ulid.NewUlid().ToGuid().ToString(); shellSettings["RecipeName"] = setupOptions.RecipeName; shellSettings["FeatureProfile"] = setupOptions.FeatureProfile; diff --git a/src/OrchardCore.Modules/OrchardCore.AutoSetup/OrchardCore.AutoSetup.csproj b/src/OrchardCore.Modules/OrchardCore.AutoSetup/OrchardCore.AutoSetup.csproj index d7d0e22517b..331e4d92cb9 100644 --- a/src/OrchardCore.Modules/OrchardCore.AutoSetup/OrchardCore.AutoSetup.csproj +++ b/src/OrchardCore.Modules/OrchardCore.AutoSetup/OrchardCore.AutoSetup.csproj @@ -17,4 +17,8 @@ + + + + diff --git a/src/OrchardCore.Modules/OrchardCore.ContentFields/Views/ContentPickerField.Edit.cshtml b/src/OrchardCore.Modules/OrchardCore.ContentFields/Views/ContentPickerField.Edit.cshtml index 712431b2f8b..760e173a77e 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentFields/Views/ContentPickerField.Edit.cshtml +++ b/src/OrchardCore.Modules/OrchardCore.ContentFields/Views/ContentPickerField.Edit.cshtml @@ -7,36 +7,69 @@ var selectedItems = JConvert.SerializeObject(Model.SelectedItems, JOptions.CamelCase); var partName = Model.PartFieldDefinition.PartDefinition.Name; var fieldName = Model.PartFieldDefinition.Name; - var editUrl = Url.RouteUrl(new { area = "OrchardCore.Contents", controller = "Admin", action = "Edit", contentItemId = "contentItemId", returnUrl = FullRequestPath }); - var viewUrl = Url.RouteUrl(new { area = "OrchardCore.Contents", controller = "Admin", action = "Display", contentItemId = "contentItemId" }); - var searchUrl = Url.RouteUrl(new { area = "OrchardCore.ContentFields", controller = "ContentPickerAdmin", action = "SearchContentItems", part = partName, field = fieldName }); - var vueElementId = $"ContentPicker_{partName}_{fieldName}_{Guid.NewGuid().ToString("n")}"; + var editUrl = Url.RouteUrl(new + { + area = "OrchardCore.Contents", + controller = "Admin", + action = "Edit", + contentItemId = + "contentItemId", + returnUrl = FullRequestPath + }); + var viewUrl = Url.RouteUrl(new + { + area = "OrchardCore.Contents", + controller = "Admin", + action = "Display", + contentItemId + = "contentItemId" + }); + var searchUrl = Url.RouteUrl(new + { + area = "OrchardCore.ContentFields", + controller = "ContentPickerAdmin", + action = + "SearchContentItems", + part = partName, + field = fieldName + }); + var vueElementId = $"ContentPicker_{partName}_{fieldName}_{Ulid.NewUlid().ToGuid().ToString("n")}"; var multiple = settings.Multiple.ToString().ToLowerInvariant(); } - + -
- +
+
-
+
-