Browse Source

Add async suffix to the application service asynchronous method

pull/9965/head
liangshiwei 4 years ago
parent
commit
f4dd700560
  1. 2
      modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/IPostAppService.cs
  2. 2
      modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Tagging/ITagAppService.cs
  3. 2
      modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs
  4. 2
      modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Tagging/TagAppService.cs
  5. 4
      modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/PostsController.cs
  6. 4
      modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/TagsController.cs
  7. 4
      modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Index.cshtml.cs
  8. 2
      modules/blogging/test/Volo.Blogging.Application.Tests/Volo/Blogging/PostAppService_Tests.cs
  9. 2
      modules/blogging/test/Volo.Blogging.Application.Tests/Volo/Blogging/TagAppService_Tests.cs
  10. 8
      modules/docs/src/Volo.Docs.Application.Contracts/Volo/Docs/Projects/IProjectAppService.cs
  11. 2
      modules/docs/src/Volo.Docs.Application/Volo/Docs/Projects/ProjectAppService.cs
  12. 4
      modules/docs/src/Volo.Docs.HttpApi/Volo/Docs/Projects/DocsProjectController.cs

2
modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/IPostAppService.cs

@ -7,7 +7,7 @@ namespace Volo.Blogging.Posts
{
public interface IPostAppService : IApplicationService
{
Task<ListResultDto<PostWithDetailsDto>> GetListByBlogIdAndTagName(Guid blogId, string tagName);
Task<ListResultDto<PostWithDetailsDto>> GetListByBlogIdAndTagNameAsync(Guid blogId, string tagName);
Task<ListResultDto<PostWithDetailsDto>> GetTimeOrderedListAsync(Guid blogId);

2
modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Tagging/ITagAppService.cs

@ -8,7 +8,7 @@ namespace Volo.Blogging.Tagging
{
public interface ITagAppService : IApplicationService
{
Task<List<TagDto>> GetPopularTags(Guid blogId, GetPopularTagsInput input);
Task<List<TagDto>> GetPopularTagsAsync(Guid blogId, GetPopularTagsInput input);
}
}

2
modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs

@ -42,7 +42,7 @@ namespace Volo.Blogging.Posts
_localEventBus = localEventBus;
}
public async Task<ListResultDto<PostWithDetailsDto>> GetListByBlogIdAndTagName(Guid id, string tagName)
public async Task<ListResultDto<PostWithDetailsDto>> GetListByBlogIdAndTagNameAsync(Guid id, string tagName)
{
var posts = await _postRepository.GetPostsByBlogId(id);
var tag = tagName.IsNullOrWhiteSpace() ? null : await _tagRepository.FindByNameAsync(id, tagName);

2
modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Tagging/TagAppService.cs

@ -15,7 +15,7 @@ namespace Volo.Blogging.Tagging
_tagRepository = tagRepository;
}
public async Task<List<TagDto>> GetPopularTags(Guid blogId, GetPopularTagsInput input)
public async Task<List<TagDto>> GetPopularTagsAsync(Guid blogId, GetPopularTagsInput input)
{
var postTags = (await _tagRepository.GetListAsync(blogId)).OrderByDescending(t=>t.UsageCount)
.WhereIf(input.MinimumPostCount != null, t=>t.UsageCount >= input.MinimumPostCount)

4
modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/PostsController.cs

@ -22,9 +22,9 @@ namespace Volo.Blogging
[HttpGet]
[Route("{blogId}/all")]
public Task<ListResultDto<PostWithDetailsDto>> GetListByBlogIdAndTagName(Guid blogId, string tagName)
public Task<ListResultDto<PostWithDetailsDto>> GetListByBlogIdAndTagNameAsync(Guid blogId, string tagName)
{
return _postAppService.GetListByBlogIdAndTagName(blogId, tagName);
return _postAppService.GetListByBlogIdAndTagNameAsync(blogId, tagName);
}
[HttpGet]

4
modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/TagsController.cs

@ -23,9 +23,9 @@ namespace Volo.Blogging
[HttpGet]
[Route("popular/{blogId}")]
public Task<List<TagDto>> GetPopularTags(Guid blogId, GetPopularTagsInput input)
public Task<List<TagDto>> GetPopularTagsAsync(Guid blogId, GetPopularTagsInput input)
{
return _tagAppService.GetPopularTags(blogId, input);
return _tagAppService.GetPopularTagsAsync(blogId, input);
}
}
}

4
modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Index.cshtml.cs

@ -44,8 +44,8 @@ namespace Volo.Blogging.Pages.Blog.Posts
}
Blog = await _blogAppService.GetByShortNameAsync(BlogShortName);
Posts = (await _postAppService.GetListByBlogIdAndTagName(Blog.Id, TagName)).Items;
PopularTags = (await _tagAppService.GetPopularTags(Blog.Id, new GetPopularTagsInput {ResultCount = 10, MinimumPostCount = 2}));
Posts = (await _postAppService.GetListByBlogIdAndTagNameAsync(Blog.Id, TagName)).Items;
PopularTags = (await _tagAppService.GetPopularTagsAsync(Blog.Id, new GetPopularTagsInput {ResultCount = 10, MinimumPostCount = 2}));
return Page();
}

2
modules/blogging/test/Volo.Blogging.Application.Tests/Volo/Blogging/PostAppService_Tests.cs

@ -25,7 +25,7 @@ namespace Volo.Blogging
public async Task Should_Get_List_Of_Posts()
{
var blogId = (await _blogRepository.GetListAsync()).First().Id;
var posts = await _postAppService.GetListByBlogIdAndTagName(blogId, null);
var posts = await _postAppService.GetListByBlogIdAndTagNameAsync(blogId, null);
posts.Items.Count.ShouldBeGreaterThan(0);
}

2
modules/blogging/test/Volo.Blogging.Application.Tests/Volo/Blogging/TagAppService_Tests.cs

@ -23,7 +23,7 @@ namespace Volo.Blogging
[Fact]
public async Task Should_Get_Popular_Tags()
{
var tags = await _tagAppService.GetPopularTags(_bloggingTestData.Blog1Id, new GetPopularTagsInput() {ResultCount = 5, MinimumPostCount = 0 });
var tags = await _tagAppService.GetPopularTagsAsync(_bloggingTestData.Blog1Id, new GetPopularTagsInput() {ResultCount = 5, MinimumPostCount = 0 });
tags.Count.ShouldBeGreaterThan(0);
}

8
modules/docs/src/Volo.Docs.Application.Contracts/Volo/Docs/Projects/IProjectAppService.cs

@ -8,13 +8,13 @@ namespace Volo.Docs.Projects
public interface IProjectAppService : IApplicationService
{
Task<ListResultDto<ProjectDto>> GetListAsync();
Task<ProjectDto> GetAsync(string shortName);
Task<ListResultDto<VersionInfoDto>> GetVersionsAsync(string shortName);
Task<string> GetDefaultLanguageCode(string shortName, string version);
Task<string> GetDefaultLanguageCodeAsync(string shortName, string version);
Task<LanguageConfig> GetLanguageListAsync(string shortName, string version);
}
}
}

2
modules/docs/src/Volo.Docs.Application/Volo/Docs/Projects/ProjectAppService.cs

@ -94,7 +94,7 @@ namespace Volo.Docs.Projects
return await GetLanguageListInternalAsync(shortName, version);
}
public async Task<string> GetDefaultLanguageCode(string shortName, string version)
public async Task<string> GetDefaultLanguageCodeAsync(string shortName, string version)
{
var languageList = await GetLanguageListInternalAsync(shortName, version);

4
modules/docs/src/Volo.Docs.HttpApi/Volo/Docs/Projects/DocsProjectController.cs

@ -36,9 +36,9 @@ namespace Volo.Docs.Projects
[HttpGet]
[Route("{shortName}/defaultLanguage")]
public Task<string> GetDefaultLanguageCode(string shortName,string version)
public Task<string> GetDefaultLanguageCodeAsync(string shortName,string version)
{
return ProjectAppService.GetDefaultLanguageCode(shortName, version);
return ProjectAppService.GetDefaultLanguageCodeAsync(shortName, version);
}
[HttpGet]

Loading…
Cancel
Save