diff --git a/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/AbstractKeyReadOnlyAppService.cs b/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/AbstractKeyReadOnlyAppService.cs index b2e11678f8..54123bc843 100644 --- a/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/AbstractKeyReadOnlyAppService.cs +++ b/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/AbstractKeyReadOnlyAppService.cs @@ -62,7 +62,7 @@ namespace Volo.Abp.Application.Services { await CheckGetListPolicyAsync(); - var query = CreateFilteredQuery(input); + var query = await CreateFilteredQueryAsync(input); var totalCount = await AsyncExecuter.CountAsync(query); @@ -160,11 +160,35 @@ namespace Volo.Abp.Application.Services /// methods. /// /// The input. + [Obsolete("Override the CreateFilteredQueryAsync method instead.")] protected virtual IQueryable CreateFilteredQuery(TGetListInput input) { return ReadOnlyRepository; } + /// + /// This method should create based on given input. + /// It should filter query if needed, but should not do sorting or paging. + /// Sorting should be done in and paging should be done in + /// methods. + /// + /// The input. + protected virtual async Task> CreateFilteredQueryAsync(TGetListInput input) + { + /* If user has overridden the CreateFilteredQuery method, + * we don't want to make breaking change in this point. + */ +#pragma warning disable 618 + var query = CreateFilteredQuery(input); +#pragma warning restore 618 + if (!ReferenceEquals(query, ReadOnlyRepository)) + { + return query; + } + + return await ReadOnlyRepository.GetQueryableAsync(); + } + /// /// Maps to . /// It internally calls the by default. diff --git a/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/CrudAppService.cs b/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/CrudAppService.cs index 111359d7f3..fffde41ba7 100644 --- a/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/CrudAppService.cs +++ b/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/CrudAppService.cs @@ -80,12 +80,12 @@ namespace Volo.Abp.Application.Services Repository = repository; } - protected async override Task DeleteByIdAsync(TKey id) + protected override async Task DeleteByIdAsync(TKey id) { await Repository.DeleteAsync(id); } - protected async override Task GetEntityByIdAsync(TKey id) + protected override async Task GetEntityByIdAsync(TKey id) { return await Repository.GetAsync(id); }