Browse Source

Check IHasCreationTime instead of ICreationAuditedObject

pull/4882/head
Halil İbrahim Kalkan 6 years ago
parent
commit
27050189dc
  1. 4
      framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/AbstractKeyReadOnlyAppService.cs
  2. 4
      framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/CrudAppService.cs

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

@ -122,9 +122,9 @@ namespace Volo.Abp.Application.Services
/// <param name="query">The query.</param> /// <param name="query">The query.</param>
protected virtual IQueryable<TEntity> ApplyDefaultSorting(IQueryable<TEntity> query) protected virtual IQueryable<TEntity> ApplyDefaultSorting(IQueryable<TEntity> query)
{ {
if (typeof(TEntity).IsAssignableTo<ICreationAuditedObject>()) if (typeof(TEntity).IsAssignableTo<IHasCreationTime>())
{ {
return query.OrderByDescending(e => ((ICreationAuditedObject)e).CreationTime); return query.OrderByDescending(e => ((IHasCreationTime)e).CreationTime);
} }
throw new AbpException("No sorting specified but this query requires sorting. Override the ApplyDefaultSorting method for your application service derived from AbstractKeyReadOnlyAppService!"); throw new AbpException("No sorting specified but this query requires sorting. Override the ApplyDefaultSorting method for your application service derived from AbstractKeyReadOnlyAppService!");

4
framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/CrudAppService.cs

@ -102,9 +102,9 @@ namespace Volo.Abp.Application.Services
protected override IQueryable<TEntity> ApplyDefaultSorting(IQueryable<TEntity> query) protected override IQueryable<TEntity> ApplyDefaultSorting(IQueryable<TEntity> query)
{ {
if (typeof(TEntity).IsAssignableTo<ICreationAuditedObject>()) if (typeof(TEntity).IsAssignableTo<IHasCreationTime>())
{ {
return query.OrderByDescending(e => ((ICreationAuditedObject)e).CreationTime); return query.OrderByDescending(e => ((IHasCreationTime)e).CreationTime);
} }
else else
{ {

Loading…
Cancel
Save