Skip to content

Append 'Async' to name of async methods #229

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ namespace Skoruba.IdentityServer4.Admin.BusinessLogic.Identity.Repositories.Inte
{
public interface IPersistedGrantAspNetIdentityRepository
{
Task<PagedList<PersistedGrantDataView>> GetPersistedGrantsByUsers(string search, int page = 1, int pageSize = 10);
Task<PagedList<PersistedGrant>> GetPersistedGrantsByUser(string subjectId, int page = 1, int pageSize = 10);
Task<PagedList<PersistedGrantDataView>> GetPersistedGrantsByUsersAsync(string search, int page = 1, int pageSize = 10);
Task<PagedList<PersistedGrant>> GetPersistedGrantsByUserAsync(string subjectId, int page = 1, int pageSize = 10);
Task<PersistedGrant> GetPersistedGrantAsync(string key);
Task<int> DeletePersistedGrantAsync(string key);
Task<int> DeletePersistedGrantsAsync(string userId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public PersistedGrantAspNetIdentityRepository(TIdentityDbContext identityDbConte
PersistedGrantDbContext = persistedGrantDbContext;
}

public virtual Task<PagedList<PersistedGrantDataView>> GetPersistedGrantsByUsers(string search, int page = 1, int pageSize = 10)
public virtual Task<PagedList<PersistedGrantDataView>> GetPersistedGrantsByUsersAsync(string search, int page = 1, int pageSize = 10)
{
return Task.Run(() =>
{
Expand Down Expand Up @@ -74,7 +74,7 @@ from identity in per.DefaultIfEmpty()
});
}

public virtual async Task<PagedList<PersistedGrant>> GetPersistedGrantsByUser(string subjectId, int page = 1, int pageSize = 10)
public virtual async Task<PagedList<PersistedGrant>> GetPersistedGrantsByUserAsync(string subjectId, int page = 1, int pageSize = 10)
{
var pagedList = new PagedList<PersistedGrant>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ namespace Skoruba.IdentityServer4.Admin.BusinessLogic.Identity.Services.Interfac
{
public interface IPersistedGrantAspNetIdentityService
{
Task<PersistedGrantsDto> GetPersistedGrantsByUsers(string search, int page = 1, int pageSize = 10);
Task<PersistedGrantsDto> GetPersistedGrantsByUser(string subjectId, int page = 1, int pageSize = 10);
Task<PersistedGrantsDto> GetPersistedGrantsByUsersAsync(string search, int page = 1, int pageSize = 10);
Task<PersistedGrantsDto> GetPersistedGrantsByUserAsync(string subjectId, int page = 1, int pageSize = 10);
Task<PersistedGrantDto> GetPersistedGrantAsync(string key);
Task<int> DeletePersistedGrantAsync(string key);
Task<int> DeletePersistedGrantsAsync(string userId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,20 @@ public PersistedGrantAspNetIdentityService(IPersistedGrantAspNetIdentityReposito
PersistedGrantAspNetIdentityServiceResources = persistedGrantAspNetIdentityServiceResources;
}

public virtual async Task<PersistedGrantsDto> GetPersistedGrantsByUsers(string search, int page = 1, int pageSize = 10)
public virtual async Task<PersistedGrantsDto> GetPersistedGrantsByUsersAsync(string search, int page = 1, int pageSize = 10)
{
var pagedList = await PersistedGrantAspNetIdentityRepository.GetPersistedGrantsByUsers(search, page, pageSize);
var pagedList = await PersistedGrantAspNetIdentityRepository.GetPersistedGrantsByUsersAsync(search, page, pageSize);
var persistedGrantsDto = pagedList.ToModel();

return persistedGrantsDto;
}

public virtual async Task<PersistedGrantsDto> GetPersistedGrantsByUser(string subjectId, int page = 1, int pageSize = 10)
public virtual async Task<PersistedGrantsDto> GetPersistedGrantsByUserAsync(string subjectId, int page = 1, int pageSize = 10)
{
var exists = await PersistedGrantAspNetIdentityRepository.ExistsPersistedGrantsAsync(subjectId);
if (!exists) throw new UserFriendlyErrorPageException(string.Format(PersistedGrantAspNetIdentityServiceResources.PersistedGrantWithSubjectIdDoesNotExist().Description, subjectId), PersistedGrantAspNetIdentityServiceResources.PersistedGrantWithSubjectIdDoesNotExist().Description);

var pagedList = await PersistedGrantAspNetIdentityRepository.GetPersistedGrantsByUser(subjectId, page, pageSize);
var pagedList = await PersistedGrantAspNetIdentityRepository.GetPersistedGrantsByUserAsync(subjectId, page, pageSize);
var persistedGrantsDto = pagedList.ToModel();

return persistedGrantsDto;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ namespace Skoruba.IdentityServer4.Admin.BusinessLogic.Repositories.Interfaces
{
public interface IPersistedGrantRepository
{
Task<PagedList<PersistedGrantDataView>> GetPersistedGrantsByUsers(string search, int page = 1, int pageSize = 10);
Task<PagedList<PersistedGrant>> GetPersistedGrantsByUser(string subjectId, int page = 1, int pageSize = 10);
Task<PagedList<PersistedGrantDataView>> GetPersistedGrantsByUsersAsync(string search, int page = 1, int pageSize = 10);
Task<PagedList<PersistedGrant>> GetPersistedGrantsByUserAsync(string subjectId, int page = 1, int pageSize = 10);
Task<PersistedGrant> GetPersistedGrantAsync(string key);
Task<int> DeletePersistedGrantAsync(string key);
Task<int> DeletePersistedGrantsAsync(string userId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public PersistedGrantRepository(TDbContext dbContext)
DbContext = dbContext;
}

public virtual async Task<PagedList<PersistedGrantDataView>> GetPersistedGrantsByUsers(string search, int page = 1, int pageSize = 10)
public virtual async Task<PagedList<PersistedGrantDataView>> GetPersistedGrantsByUsersAsync(string search, int page = 1, int pageSize = 10)
{
var pagedList = new PagedList<PersistedGrantDataView>();

Expand All @@ -49,7 +49,7 @@ public virtual async Task<PagedList<PersistedGrantDataView>> GetPersistedGrantsB
return pagedList;
}

public virtual async Task<PagedList<PersistedGrant>> GetPersistedGrantsByUser(string subjectId, int page = 1, int pageSize = 10)
public virtual async Task<PagedList<PersistedGrant>> GetPersistedGrantsByUserAsync(string subjectId, int page = 1, int pageSize = 10)
{
var pagedList = new PagedList<PersistedGrant>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ namespace Skoruba.IdentityServer4.Admin.BusinessLogic.Services.Interfaces
{
public interface IPersistedGrantService
{
Task<PersistedGrantsDto> GetPersistedGrantsByUsers(string search, int page = 1, int pageSize = 10);
Task<PersistedGrantsDto> GetPersistedGrantsByUser(string subjectId, int page = 1, int pageSize = 10);
Task<PersistedGrantsDto> GetPersistedGrantsByUsersAsync(string search, int page = 1, int pageSize = 10);
Task<PersistedGrantsDto> GetPersistedGrantsByUserAsync(string subjectId, int page = 1, int pageSize = 10);
Task<PersistedGrantDto> GetPersistedGrantAsync(string key);
Task<int> DeletePersistedGrantAsync(string key);
Task<int> DeletePersistedGrantsAsync(string userId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,20 @@ public PersistedGrantService(IPersistedGrantRepository persistedGrantRepository,
PersistedGrantServiceResources = persistedGrantServiceResources;
}

public virtual async Task<PersistedGrantsDto> GetPersistedGrantsByUsers(string search, int page = 1, int pageSize = 10)
public virtual async Task<PersistedGrantsDto> GetPersistedGrantsByUsersAsync(string search, int page = 1, int pageSize = 10)
{
var pagedList = await PersistedGrantRepository.GetPersistedGrantsByUsers(search, page, pageSize);
var pagedList = await PersistedGrantRepository.GetPersistedGrantsByUsersAsync(search, page, pageSize);
var persistedGrantsDto = pagedList.ToModel();

return persistedGrantsDto;
}

public virtual async Task<PersistedGrantsDto> GetPersistedGrantsByUser(string subjectId, int page = 1, int pageSize = 10)
public virtual async Task<PersistedGrantsDto> GetPersistedGrantsByUserAsync(string subjectId, int page = 1, int pageSize = 10)
{
var exists = await PersistedGrantRepository.ExistsPersistedGrantsAsync(subjectId);
if (!exists) throw new UserFriendlyErrorPageException(string.Format(PersistedGrantServiceResources.PersistedGrantWithSubjectIdDoesNotExist().Description, subjectId), PersistedGrantServiceResources.PersistedGrantWithSubjectIdDoesNotExist().Description);

var pagedList = await PersistedGrantRepository.GetPersistedGrantsByUser(subjectId, page, pageSize);
var pagedList = await PersistedGrantRepository.GetPersistedGrantsByUserAsync(subjectId, page, pageSize);
var persistedGrantsDto = pagedList.ToModel();

return persistedGrantsDto;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public GrantController(IPersistedGrantAspNetIdentityService persistedGrantServic
public async Task<IActionResult> PersistedGrants(int? page, string search)
{
ViewBag.Search = search;
var persistedGrants = await _persistedGrantService.GetPersistedGrantsByUsers(search, page ?? 1);
var persistedGrants = await _persistedGrantService.GetPersistedGrantsByUsersAsync(search, page ?? 1);

return View(persistedGrants);
}
Expand Down Expand Up @@ -73,7 +73,7 @@ public async Task<IActionResult> PersistedGrantsDelete(PersistedGrantsDto grants
[HttpGet]
public async Task<IActionResult> PersistedGrant(string id, int? page)
{
var persistedGrants = await _persistedGrantService.GetPersistedGrantsByUser(id, page ?? 1);
var persistedGrants = await _persistedGrantService.GetPersistedGrantsByUserAsync(id, page ?? 1);
persistedGrants.SubjectId = id;

return View(persistedGrants);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public async Task DeletePersistedGrantsAsync()
//Try delete persisted grant
await persistedGrantRepository.DeletePersistedGrantsAsync(subjectId.ToString());

var grant = await persistedGrantRepository.GetPersistedGrantsByUser(subjectId.ToString());
var grant = await persistedGrantRepository.GetPersistedGrantsByUserAsync(subjectId.ToString());

//Assert
grant.TotalCount.Should().Be(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public async Task DeletePersistedGrantsAsync()
//Try delete persisted grant
await persistedGrantService.DeletePersistedGrantsAsync(subjectId.ToString());

var grant = await persistedGrantRepository.GetPersistedGrantsByUser(subjectId.ToString());
var grant = await persistedGrantRepository.GetPersistedGrantsByUserAsync(subjectId.ToString());

//Assert
grant.TotalCount.Should().Be(0);
Expand Down