Browse Source

Used different names for `ReadOnlyRepository` and `Repository` in application services

Still using `protected new` on `CrudAppService` because the repository member in `AbstractKeyCrudAppService` has to be renamed to something like `AbstractKeyRepository`, which would be a breaking change.

Renaming the repository in each descendant could lead to misunderstandings, since in `CrudAppService` descendants will be three repositories to choose from: `Repository`, `ReadOnlyRepository`, `AbstractKeyRepository`.
Currently the user must only differ between `ReadOnlyRepository` and `Repository`.

@maliming, can you review this?
pull/4346/head
Necati Meral 6 years ago
parent
commit
0b76186928
  1. 2
      framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/AbstractKeyCrudAppService.cs
  2. 8
      framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/AbstractKeyReadOnlyAppService.cs

2
framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/AbstractKeyCrudAppService.cs

@ -62,7 +62,7 @@ namespace Volo.Abp.Application.Services
ICrudAppService<TGetOutputDto, TGetListOutputDto, TKey, TGetListInput, TCreateInput, TUpdateInput> ICrudAppService<TGetOutputDto, TGetListOutputDto, TKey, TGetListInput, TCreateInput, TUpdateInput>
where TEntity : class, IEntity where TEntity : class, IEntity
{ {
protected new IRepository<TEntity> Repository { get; } protected IRepository<TEntity> Repository { get; }
protected virtual string CreatePolicyName { get; set; } protected virtual string CreatePolicyName { get; set; }

8
framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/AbstractKeyReadOnlyAppService.cs

@ -36,7 +36,7 @@ namespace Volo.Abp.Application.Services
, IReadOnlyAppService<TGetOutputDto, TGetListOutputDto, TKey, TGetListInput> , IReadOnlyAppService<TGetOutputDto, TGetListOutputDto, TKey, TGetListInput>
where TEntity : class, IEntity where TEntity : class, IEntity
{ {
protected IReadOnlyRepository<TEntity> Repository { get; } protected IReadOnlyRepository<TEntity> ReadOnlyRepository { get; }
protected virtual string GetPolicyName { get; set; } protected virtual string GetPolicyName { get; set; }
@ -44,7 +44,7 @@ namespace Volo.Abp.Application.Services
protected AbstractKeyReadOnlyAppService(IReadOnlyRepository<TEntity> repository) protected AbstractKeyReadOnlyAppService(IReadOnlyRepository<TEntity> repository)
{ {
Repository = repository; ReadOnlyRepository = repository;
} }
public virtual async Task<TGetOutputDto> GetAsync(TKey id) public virtual async Task<TGetOutputDto> GetAsync(TKey id)
@ -123,7 +123,7 @@ namespace Volo.Abp.Application.Services
return query.OrderByDescending(e => ((ICreationAuditedObject)e).CreationTime); return query.OrderByDescending(e => ((ICreationAuditedObject)e).CreationTime);
} }
throw new AbpException("No sorting specified but this query requires sorting. Override the ApplyDefaultSorting method for your application service derived from AbstractKeyCrudAppService!"); throw new AbpException("No sorting specified but this query requires sorting. Override the ApplyDefaultSorting method for your application service derived from AbstractKeyReadOnlyAppService!");
} }
/// <summary> /// <summary>
@ -158,7 +158,7 @@ namespace Volo.Abp.Application.Services
/// <param name="input">The input.</param> /// <param name="input">The input.</param>
protected virtual IQueryable<TEntity> CreateFilteredQuery(TGetListInput input) protected virtual IQueryable<TEntity> CreateFilteredQuery(TGetListInput input)
{ {
return Repository; return ReadOnlyRepository;
} }
/// <summary> /// <summary>

Loading…
Cancel
Save