diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/CachedApplicationConfigurationClientExtensions.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/CachedApplicationConfigurationClientExtensions.cs deleted file mode 100644 index 601a2d1088..0000000000 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/CachedApplicationConfigurationClientExtensions.cs +++ /dev/null @@ -1,13 +0,0 @@ -using Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations; -using Volo.Abp.Threading; - -namespace Volo.Abp.AspNetCore.Mvc.Client -{ - public static class CachedApplicationConfigurationClientExtensions - { - public static ApplicationConfigurationDto Get(this ICachedApplicationConfigurationClient client) - { - return AsyncHelper.RunSync(client.GetAsync); - } - } -} \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/RemoteLocalizationContributor.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/RemoteLocalizationContributor.cs index d994a84335..79033f3679 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/RemoteLocalizationContributor.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/RemoteLocalizationContributor.cs @@ -4,6 +4,7 @@ using Microsoft.Extensions.Localization; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; using Volo.Abp.Localization; +using Volo.Abp.Threading; namespace Volo.Abp.AspNetCore.Mvc.Client { @@ -54,8 +55,11 @@ namespace Volo.Abp.AspNetCore.Mvc.Client private Dictionary GetResourceOrNull() { - var resource = _applicationConfigurationClient - .Get() + var applicationConfigurationDto = AsyncHelper.RunSync( + () => _applicationConfigurationClient.GetAsync() + ); + + var resource = applicationConfigurationDto .Localization.Values .GetOrDefault(_resource.ResourceName); diff --git a/framework/src/Volo.Abp.BackgroundJobs.Abstractions/Volo/Abp/BackgroundJobs/BackgroundJobManagerExtensions.cs b/framework/src/Volo.Abp.BackgroundJobs.Abstractions/Volo/Abp/BackgroundJobs/BackgroundJobManagerExtensions.cs index 4cc93fa533..774bccf2c6 100644 --- a/framework/src/Volo.Abp.BackgroundJobs.Abstractions/Volo/Abp/BackgroundJobs/BackgroundJobManagerExtensions.cs +++ b/framework/src/Volo.Abp.BackgroundJobs.Abstractions/Volo/Abp/BackgroundJobs/BackgroundJobManagerExtensions.cs @@ -1,6 +1,4 @@ -using System; -using Volo.Abp.DynamicProxy; -using Volo.Abp.Threading; +using Volo.Abp.DynamicProxy; namespace Volo.Abp.BackgroundJobs { @@ -9,19 +7,6 @@ namespace Volo.Abp.BackgroundJobs /// public static class BackgroundJobManagerExtensions { - /// - /// Enqueues a job to be executed. - /// - /// Type of the arguments of job. - /// Background job manager reference - /// Job arguments. - /// Job priority. - /// Job delay (wait duration before first try). - public static string Enqueue(this IBackgroundJobManager backgroundJobManager, TArgs args, BackgroundJobPriority priority = BackgroundJobPriority.Normal, TimeSpan? delay = null) - { - return AsyncHelper.RunSync(() => backgroundJobManager.EnqueueAsync(args, priority, delay)); - } - /// /// Checks if background job system has a real implementation. /// It returns false if the current implementation is . diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddModuleCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddModuleCommand.cs index 8d406feab3..42bc75c864 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddModuleCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddModuleCommand.cs @@ -27,7 +27,11 @@ namespace Volo.Abp.Cli.Commands { if (commandLineArgs.Target == null) { - throw new CliUsageException("Module name is missing!" + Environment.NewLine + Environment.NewLine + await GetUsageInfo()); + throw new CliUsageException( + "Module name is missing!" + + Environment.NewLine + Environment.NewLine + + GetUsageInfo() + ); } var skipDbMigrations = Convert.ToBoolean( @@ -40,7 +44,7 @@ namespace Volo.Abp.Cli.Commands ); } - public Task GetUsageInfo() + public string GetUsageInfo() { var sb = new StringBuilder(); @@ -61,14 +65,14 @@ namespace Volo.Abp.Cli.Commands sb.AppendLine(" abp add-module Volo.Blogging -s Acme.BookStore --skip-db-migrations false Adds the module to the given solution but doesn't create a database migration."); sb.AppendLine(""); - return Task.FromResult(sb.ToString()); + return sb.ToString(); } - public Task GetShortDescriptionAsync() + public string GetShortDescription() { - return Task.FromResult("Adds a multi-package module to a solution by finding all packages of the module, " + - "finding related projects in the solution and adding each package to the" + - " corresponding project in the solution."); + return "Adds a multi-package module to a solution by finding all packages of the module, " + + "finding related projects in the solution and adding each package to the" + + " corresponding project in the solution."; } protected virtual string GetSolutionFile(CommandLineArgs commandLineArgs) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddPackageCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddPackageCommand.cs index c7922cbc33..3b1153eade 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddPackageCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddPackageCommand.cs @@ -27,7 +27,11 @@ namespace Volo.Abp.Cli.Commands { if (commandLineArgs.Target == null) { - throw new CliUsageException("Package name is missing!" + Environment.NewLine + Environment.NewLine + await GetUsageInfo()); + throw new CliUsageException( + "Package name is missing!" + + Environment.NewLine + Environment.NewLine + + GetUsageInfo() + ); } await ProjectNugetPackageAdder.AddAsync( @@ -36,7 +40,7 @@ namespace Volo.Abp.Cli.Commands ); } - public Task GetUsageInfo() + public string GetUsageInfo() { var sb = new StringBuilder(); @@ -55,14 +59,14 @@ namespace Volo.Abp.Cli.Commands sb.AppendLine(" abp add-package Volo.Abp.FluentValidation -p Acme.BookStore.Application Adds the package to the given project."); sb.AppendLine(""); - return Task.FromResult(sb.ToString()); + return sb.ToString(); } - public Task GetShortDescriptionAsync() + public string GetShortDescription() { - return Task.FromResult("Adds a new ABP package to a project by adding related nuget package" + - " as a dependency to the project and adding [DependsOn(...)] attribute to" + - " the module class in the project."); + return "Adds a new ABP package to a project by adding related nuget package" + + " as a dependency to the project and adding [DependsOn(...)] attribute to" + + " the module class in the project."; } protected virtual string GetProjectFile(CommandLineArgs commandLineArgs) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/HelpCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/HelpCommand.cs index fe574c2112..c9046f44fb 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/HelpCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/HelpCommand.cs @@ -28,7 +28,7 @@ namespace Volo.Abp.Cli.Commands { if (string.IsNullOrWhiteSpace(commandLineArgs.Target)) { - Logger.LogInformation(await GetUsageInfo()); + Logger.LogInformation(GetUsageInfo()); return; } @@ -37,11 +37,11 @@ namespace Volo.Abp.Cli.Commands using (var scope = ServiceScopeFactory.CreateScope()) { var command = (IConsoleCommand) scope.ServiceProvider.GetRequiredService(commandType); - Logger.LogInformation(await command.GetUsageInfo()); + Logger.LogInformation(command.GetUsageInfo()); } } - public async Task GetUsageInfo() + public string GetUsageInfo() { var sb = new StringBuilder(); @@ -58,8 +58,8 @@ namespace Volo.Abp.Cli.Commands using (var scope = ServiceScopeFactory.CreateScope()) { - shortDescription = await ((IConsoleCommand)scope.ServiceProvider.GetRequiredService(command.Value)) - .GetShortDescriptionAsync(); + shortDescription = ((IConsoleCommand) scope.ServiceProvider + .GetRequiredService(command.Value)).GetShortDescription(); } sb.Append(" >"); @@ -74,9 +74,9 @@ namespace Volo.Abp.Cli.Commands return sb.ToString(); } - public Task GetShortDescriptionAsync() + public string GetShortDescription() { - return Task.FromResult(""); + return string.Empty; } } } \ No newline at end of file diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/IConsoleCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/IConsoleCommand.cs index b9fb34210b..92d57cce8b 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/IConsoleCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/IConsoleCommand.cs @@ -7,8 +7,8 @@ namespace Volo.Abp.Cli.Commands { Task ExecuteAsync(CommandLineArgs commandLineArgs); - Task GetUsageInfo(); + string GetUsageInfo(); - Task GetShortDescriptionAsync(); + string GetShortDescription(); } } \ No newline at end of file diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/LoginCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/LoginCommand.cs index 1828035fa1..631756c1e0 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/LoginCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/LoginCommand.cs @@ -26,14 +26,22 @@ namespace Volo.Abp.Cli.Commands { if (commandLineArgs.Target.IsNullOrEmpty()) { - throw new CliUsageException("Username name is missing!" + Environment.NewLine + Environment.NewLine + await GetUsageInfo()); + throw new CliUsageException( + "Username name is missing!" + + Environment.NewLine + Environment.NewLine + + GetUsageInfo() + ); } Console.Write("Password: "); var password = ConsoleHelper.ReadSecret(); if (password.IsNullOrWhiteSpace()) { - throw new CliUsageException("Password name is missing!" + Environment.NewLine + Environment.NewLine + await GetUsageInfo()); + throw new CliUsageException( + "Password name is missing!" + + Environment.NewLine + Environment.NewLine + + GetUsageInfo() + ); } await AuthService.LoginAsync(commandLineArgs.Target, password); @@ -41,7 +49,7 @@ namespace Volo.Abp.Cli.Commands Logger.LogInformation($"Successfully logged in as '{commandLineArgs.Target}'"); } - public Task GetUsageInfo() + public string GetUsageInfo() { var sb = new StringBuilder(); @@ -52,12 +60,12 @@ namespace Volo.Abp.Cli.Commands sb.AppendLine("Example:"); sb.AppendLine(" abp login john"); - return Task.FromResult(sb.ToString()); + return sb.ToString(); } - public Task GetShortDescriptionAsync() + public string GetShortDescription() { - return Task.FromResult(""); + return string.Empty; } } } \ No newline at end of file diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/LogoutCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/LogoutCommand.cs index 22d30367e6..d3024635fb 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/LogoutCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/LogoutCommand.cs @@ -24,14 +24,14 @@ namespace Volo.Abp.Cli.Commands return AuthService.LogoutAsync(); } - public Task GetUsageInfo() + public string GetUsageInfo() { - return Task.FromResult(""); + return string.Empty; } - public Task GetShortDescriptionAsync() + public string GetShortDescription() { - return Task.FromResult(""); + return string.Empty; } } } \ No newline at end of file diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs index c2e6816b86..3f2456e81b 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs @@ -30,7 +30,11 @@ namespace Volo.Abp.Cli.Commands { if (commandLineArgs.Target == null) { - throw new CliUsageException("Project name is missing!" + Environment.NewLine + Environment.NewLine + await GetUsageInfo()); + throw new CliUsageException( + "Project name is missing!" + + Environment.NewLine + Environment.NewLine + + GetUsageInfo() + ); } Logger.LogInformation("Creating a new project..."); @@ -98,7 +102,7 @@ namespace Volo.Abp.Cli.Commands Logger.LogInformation($"The output folder is: '{outputFolder}'"); } - public Task GetUsageInfo() + public string GetUsageInfo() { var sb = new StringBuilder(); @@ -124,12 +128,12 @@ namespace Volo.Abp.Cli.Commands sb.AppendLine(""); sb.AppendLine("See the documentation for more info."); - return Task.FromResult(sb.ToString()); + return sb.ToString(); } - public Task GetShortDescriptionAsync() + public string GetShortDescription() { - return Task.FromResult("Generates a new solution based on the ABP startup templates."); + return "Generates a new solution based on the ABP startup templates."; } protected virtual DatabaseProvider GetDatabaseProviderOrNull(CommandLineArgs commandLineArgs) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/UpdateCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/UpdateCommand.cs index f0b00b913b..177def5197 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/UpdateCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/UpdateCommand.cs @@ -90,11 +90,14 @@ namespace Volo.Abp.Cli.Commands return; } - throw new CliUsageException("No solution or project found in this directory." + Environment.NewLine + - Environment.NewLine + AsyncHelper.RunSync(GetUsageInfo)); + throw new CliUsageException( + "No solution or project found in this directory." + + Environment.NewLine + Environment.NewLine + + GetUsageInfo() + ); } - public Task GetUsageInfo() + public string GetUsageInfo() { var sb = new StringBuilder(); @@ -111,13 +114,13 @@ namespace Volo.Abp.Cli.Commands sb.AppendLine(""); sb.AppendLine("See the documentation for more info."); - return Task.FromResult(sb.ToString()); + return sb.ToString(); } - public Task GetShortDescriptionAsync() + public string GetShortDescription() { - return Task.FromResult("Automatically updates all ABP related NuGet packages and NPM packages in a" + - " solution or project to the latest versions"); + return "Automatically updates all ABP related NuGet packages and NPM packages in a" + + " solution or project to the latest versions"; } public static class Options