From d1043a29279b13d2450220652f032739059d9f3c Mon Sep 17 00:00:00 2001 From: "nader.javid" Date: Wed, 26 Jun 2024 13:46:56 +0330 Subject: [PATCH] Fix bug #238 MenuContributor problem --- .../ModificationCreatorSteps/CSharp/MenuContributorStep.cs | 5 +++++ .../Templates/Crud/MenuContributor_UsingForApp | 1 + 2 files changed, 6 insertions(+) diff --git a/src/AbpHelper.Core/Steps/Abp/ModificationCreatorSteps/CSharp/MenuContributorStep.cs b/src/AbpHelper.Core/Steps/Abp/ModificationCreatorSteps/CSharp/MenuContributorStep.cs index 6d480063..dc5977d9 100644 --- a/src/AbpHelper.Core/Steps/Abp/ModificationCreatorSteps/CSharp/MenuContributorStep.cs +++ b/src/AbpHelper.Core/Steps/Abp/ModificationCreatorSteps/CSharp/MenuContributorStep.cs @@ -35,6 +35,11 @@ CSharpSyntaxNode MainMenu(CSharpSyntaxNode root) => root.Descendants root.NotContains(usingForAppText) )); + builders.Add(new DeletionBuilder( + root => MainMenu(root).GetEndLine() - 1, + root => MainMenu(root).GetEndLine() - 1, + modifyCondition: root => !root.NotContains("return Task.CompletedTask;") + )); builders.Add( new InsertionBuilder( root => MainMenu(root).GetEndLine(), diff --git a/src/AbpHelper.Core/Templates/Crud/MenuContributor_UsingForApp b/src/AbpHelper.Core/Templates/Crud/MenuContributor_UsingForApp index 005339c8..c7cbc5df 100644 --- a/src/AbpHelper.Core/Templates/Crud/MenuContributor_UsingForApp +++ b/src/AbpHelper.Core/Templates/Crud/MenuContributor_UsingForApp @@ -1,3 +1,4 @@ {{~ if !Option.SkipPermissions ~}} using {{ ProjectInfo.FullName }}.Permissions; {{~ end ~}} + private async Task ConfigureMainMenuAsync(MenuConfigurationContext context)