Merge pull request #1031 from abpframework/CrudAppServices-GetAll-to-GetList

Resolves #1028 : Inconsistent "GetAll" vs "GetList" naming in CrudAppServices
pull/1037/head
Halil İbrahim Kalkan 6 years ago committed by GitHub
commit ec46217d21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -20,8 +20,8 @@ namespace Volo.Abp.Application.Services
}
}
public abstract class AsyncCrudAppService<TEntity, TEntityDto, TKey, TGetAllInput>
: AsyncCrudAppService<TEntity, TEntityDto, TKey, TGetAllInput, TEntityDto, TEntityDto>
public abstract class AsyncCrudAppService<TEntity, TEntityDto, TKey, TGetListInput>
: AsyncCrudAppService<TEntity, TEntityDto, TKey, TGetListInput, TEntityDto, TEntityDto>
where TEntity : class, IEntity<TKey>
where TEntityDto : IEntityDto<TKey>
{
@ -32,8 +32,8 @@ namespace Volo.Abp.Application.Services
}
}
public abstract class AsyncCrudAppService<TEntity, TEntityDto, TKey, TGetAllInput, TCreateInput>
: AsyncCrudAppService<TEntity, TEntityDto, TKey, TGetAllInput, TCreateInput, TCreateInput>
public abstract class AsyncCrudAppService<TEntity, TEntityDto, TKey, TGetListInput, TCreateInput>
: AsyncCrudAppService<TEntity, TEntityDto, TKey, TGetListInput, TCreateInput, TCreateInput>
where TEntity : class, IEntity<TKey>
where TEntityDto : IEntityDto<TKey>
{
@ -44,9 +44,9 @@ namespace Volo.Abp.Application.Services
}
}
public abstract class AsyncCrudAppService<TEntity, TEntityDto, TKey, TGetAllInput, TCreateInput, TUpdateInput>
: CrudAppServiceBase<TEntity, TEntityDto, TKey, TGetAllInput, TCreateInput, TUpdateInput>,
IAsyncCrudAppService<TEntityDto, TKey, TGetAllInput, TCreateInput, TUpdateInput>
public abstract class AsyncCrudAppService<TEntity, TEntityDto, TKey, TGetListInput, TCreateInput, TUpdateInput>
: CrudAppServiceBase<TEntity, TEntityDto, TKey, TGetListInput, TCreateInput, TUpdateInput>,
IAsyncCrudAppService<TEntityDto, TKey, TGetListInput, TCreateInput, TUpdateInput>
where TEntity : class, IEntity<TKey>
where TEntityDto : IEntityDto<TKey>
{
@ -66,9 +66,9 @@ namespace Volo.Abp.Application.Services
return MapToEntityDto(entity);
}
public virtual async Task<PagedResultDto<TEntityDto>> GetListAsync(TGetAllInput input)
public virtual async Task<PagedResultDto<TEntityDto>> GetListAsync(TGetListInput input)
{
await CheckGetAllPolicyAsync();
await CheckGetListPolicyAsync();
var query = CreateFilteredQuery(input);
@ -128,9 +128,9 @@ namespace Volo.Abp.Application.Services
await CheckPolicyAsync(GetPolicyName);
}
protected virtual async Task CheckGetAllPolicyAsync()
protected virtual async Task CheckGetListPolicyAsync()
{
await CheckPolicyAsync(GetAllPolicyName);
await CheckPolicyAsync(GetListPolicyName);
}
protected virtual async Task CheckCreatePolicyAsync()

@ -17,8 +17,8 @@ namespace Volo.Abp.Application.Services
}
}
public abstract class CrudAppService<TEntity, TEntityDto, TKey, TGetAllInput>
: CrudAppService<TEntity, TEntityDto, TKey, TGetAllInput, TEntityDto, TEntityDto>
public abstract class CrudAppService<TEntity, TEntityDto, TKey, TGetListInput>
: CrudAppService<TEntity, TEntityDto, TKey, TGetListInput, TEntityDto, TEntityDto>
where TEntity : class, IEntity<TKey>
where TEntityDto : IEntityDto<TKey>
{
@ -29,8 +29,8 @@ namespace Volo.Abp.Application.Services
}
}
public abstract class CrudAppService<TEntity, TEntityDto, TKey, TGetAllInput, TCreateInput>
: CrudAppService<TEntity, TEntityDto, TKey, TGetAllInput, TCreateInput, TCreateInput>
public abstract class CrudAppService<TEntity, TEntityDto, TKey, TGetListInput, TCreateInput>
: CrudAppService<TEntity, TEntityDto, TKey, TGetListInput, TCreateInput, TCreateInput>
where TEntity : class, IEntity<TKey>
where TEntityDto : IEntityDto<TKey>
where TCreateInput : IEntityDto<TKey>
@ -42,9 +42,9 @@ namespace Volo.Abp.Application.Services
}
}
public abstract class CrudAppService<TEntity, TEntityDto, TKey, TGetAllInput, TCreateInput, TUpdateInput>
: CrudAppServiceBase<TEntity, TEntityDto, TKey, TGetAllInput, TCreateInput, TUpdateInput>,
ICrudAppService<TEntityDto, TKey, TGetAllInput, TCreateInput, TUpdateInput>
public abstract class CrudAppService<TEntity, TEntityDto, TKey, TGetListInput, TCreateInput, TUpdateInput>
: CrudAppServiceBase<TEntity, TEntityDto, TKey, TGetListInput, TCreateInput, TUpdateInput>,
ICrudAppService<TEntityDto, TKey, TGetListInput, TCreateInput, TUpdateInput>
where TEntity : class, IEntity<TKey>
where TEntityDto : IEntityDto<TKey>
{
@ -62,9 +62,9 @@ namespace Volo.Abp.Application.Services
return MapToEntityDto(entity);
}
public virtual PagedResultDto<TEntityDto> GetAll(TGetAllInput input)
public virtual PagedResultDto<TEntityDto> GetList(TGetListInput input)
{
CheckGetAllPolicy();
CheckGetListPolicy();
var query = CreateFilteredQuery(input);
@ -122,9 +122,9 @@ namespace Volo.Abp.Application.Services
CheckPolicy(GetPolicyName);
}
protected virtual void CheckGetAllPolicy()
protected virtual void CheckGetListPolicy()
{
CheckPolicy(GetAllPolicyName);
CheckPolicy(GetListPolicyName);
}
protected virtual void CheckCreatePolicy()

@ -12,7 +12,7 @@ namespace Volo.Abp.Application.Services
/// This is a common base class for CrudAppService and AsyncCrudAppService classes.
/// Inherit either from CrudAppService or AsyncCrudAppService, not from this class.
/// </summary>
public abstract class CrudAppServiceBase<TEntity, TEntityDto, TKey, TGetAllInput, TCreateInput, TUpdateInput> :
public abstract class CrudAppServiceBase<TEntity, TEntityDto, TKey, TGetListInput, TCreateInput, TUpdateInput> :
ApplicationService
where TEntity : class, IEntity<TKey>
where TEntityDto : IEntityDto<TKey>
@ -21,7 +21,7 @@ namespace Volo.Abp.Application.Services
protected virtual string GetPolicyName { get; set; }
protected virtual string GetAllPolicyName { get; set; }
protected virtual string GetListPolicyName { get; set; }
protected virtual string CreatePolicyName { get; set; }
@ -39,7 +39,7 @@ namespace Volo.Abp.Application.Services
/// </summary>
/// <param name="query">The query.</param>
/// <param name="input">The input.</param>
protected virtual IQueryable<TEntity> ApplySorting(IQueryable<TEntity> query, TGetAllInput input)
protected virtual IQueryable<TEntity> ApplySorting(IQueryable<TEntity> query, TGetListInput input)
{
//Try to sort query if available
var sortInput = input as ISortedResultRequest;
@ -66,7 +66,7 @@ namespace Volo.Abp.Application.Services
/// </summary>
/// <param name="query">The query.</param>
/// <param name="input">The input.</param>
protected virtual IQueryable<TEntity> ApplyPaging(IQueryable<TEntity> query, TGetAllInput input)
protected virtual IQueryable<TEntity> ApplyPaging(IQueryable<TEntity> query, TGetListInput input)
{
//Try to use paging if available
var pagedInput = input as IPagedResultRequest;
@ -93,7 +93,7 @@ namespace Volo.Abp.Application.Services
/// methods.
/// </summary>
/// <param name="input">The input.</param>
protected virtual IQueryable<TEntity> CreateFilteredQuery(TGetAllInput input)
protected virtual IQueryable<TEntity> CreateFilteredQuery(TGetListInput input)
{
return Repository;
}

@ -29,7 +29,7 @@ namespace Volo.Abp.Application.Services
{
TEntityDto Get(TKey id);
PagedResultDto<TEntityDto> GetAll(TGetListInput input);
PagedResultDto<TEntityDto> GetList(TGetListInput input);
TEntityDto Create(TCreateInput input);

@ -16,7 +16,7 @@ namespace Volo.Abp.TestApp.Application
}
[Fact]
public async Task GetAll()
public async Task GetList()
{
var people = await _peopleAppService.GetListAsync(new PagedAndSortedResultRequestDto());
people.Items.Count.ShouldBeGreaterThan(0);

Loading…
Cancel
Save