Remove unnecessary async usages.

pull/2545/head
Halil İbrahim Kalkan 6 years ago
parent 401376e109
commit 4ba4306165

@ -24,12 +24,12 @@ namespace Volo.Abp.Cli.Commands
AbpCliOptions = cliOptions.Value;
}
public async Task ExecuteAsync(CommandLineArgs commandLineArgs)
public Task ExecuteAsync(CommandLineArgs commandLineArgs)
{
if (string.IsNullOrWhiteSpace(commandLineArgs.Target))
{
Logger.LogInformation(GetUsageInfo());
return;
return Task.CompletedTask;
}
var commandType = AbpCliOptions.Commands[commandLineArgs.Target];
@ -39,6 +39,8 @@ namespace Volo.Abp.Cli.Commands
var command = (IConsoleCommand) scope.ServiceProvider.GetRequiredService(commandType);
Logger.LogInformation(command.GetUsageInfo());
}
return Task.CompletedTask;
}
public string GetUsageInfo()

@ -48,7 +48,7 @@ namespace Volo.Abp.Cli.ProjectModification
.ConfigureAwait(false)).ConfigureAwait(false);
}
public async Task AddAsync(string projectFile, NugetPackageInfo package)
public Task AddAsync(string projectFile, NugetPackageInfo package)
{
using (DirectoryHelper.ChangeCurrentDirectory(Path.GetDirectoryName(projectFile)))
{
@ -71,6 +71,8 @@ namespace Volo.Abp.Cli.ProjectModification
Logger.LogInformation("Successfully installed.");
}
return Task.CompletedTask;
}
protected virtual async Task<NugetPackageInfo> FindNugetPackageInfoAsync(string moduleName)

@ -10,7 +10,7 @@ namespace SimpleConsoleDemo
{
class Program
{
static async Task Main(string[] args)
static void Main(string[] args)
{
using (var application = AbpApplicationFactory.Create<MyConsoleModule>(options =>
{
@ -42,7 +42,6 @@ namespace SimpleConsoleDemo
writer.Write();
}
Console.WriteLine();
Console.WriteLine("Press ENTER to exit!");
Console.ReadLine();

@ -23,7 +23,7 @@ namespace Volo.Abp.BackgroundJobs
//Act
_backgroundJobExecuter.Execute(
await _backgroundJobExecuter.ExecuteAsync(
new JobExecutionContext(
ServiceProvider,
typeof(MyJob),
@ -46,7 +46,7 @@ namespace Volo.Abp.BackgroundJobs
//Act
_backgroundJobExecuter.Execute(
await _backgroundJobExecuter.ExecuteAsync(
new JobExecutionContext(
ServiceProvider,
typeof(MyAsyncJob),

@ -38,7 +38,7 @@ namespace Volo.Abp.Caching
}
[Fact]
public async Task GetOrAddAsync()
public void GetOrAdd()
{
var personCache = GetRequiredService<IDistributedCache<PersonCacheItem>>();
@ -49,12 +49,12 @@ namespace Volo.Abp.Caching
bool factoryExecuted = false;
var cacheItem = await personCache.GetOrAddAsync(cacheKey,
async () =>
var cacheItem = personCache.GetOrAdd(cacheKey,
() =>
{
factoryExecuted = true;
return new PersonCacheItem(personName);
}).ConfigureAwait(false);
});
factoryExecuted.ShouldBeTrue();
cacheItem.Name.ShouldBe(personName);
@ -63,12 +63,12 @@ namespace Volo.Abp.Caching
factoryExecuted = false;
cacheItem = await personCache.GetOrAddAsync(cacheKey,
async () =>
cacheItem = personCache.GetOrAdd(cacheKey,
() =>
{
factoryExecuted = true;
return new PersonCacheItem(personName);
}).ConfigureAwait(false);
});
factoryExecuted.ShouldBeFalse();
cacheItem.Name.ShouldBe(personName);
@ -165,12 +165,12 @@ namespace Volo.Abp.Caching
bool factoryExecuted = false;
var cacheItem = await personCache.GetOrAddAsync(cacheKey,
async () =>
var cacheItem = personCache.GetOrAdd(cacheKey,
() =>
{
factoryExecuted = true;
return new PersonCacheItem(personName);
}).ConfigureAwait(false);
});
factoryExecuted.ShouldBeTrue();
cacheItem.Name.ShouldBe(personName);

@ -24,7 +24,12 @@ namespace Volo.Abp.Uow
using (var uow = _unitOfWorkManager.Begin())
{
uow.OnCompleted(async () => completed = true);
uow.OnCompleted(() =>
{
completed = true;
return Task.CompletedTask;
});
uow.Disposed += (sender, args) => disposed = true;
await uow.CompleteAsync().ConfigureAwait(false);

Loading…
Cancel
Save