OrderByDynamic is modified to be able to handle inherited members, such as interface members.

SieveProcessor is modified to pass propertyInfo to OrderByDynamic to avoid reattainment of propertyInfo required in Expression.MakeMemberAccess.
SieveProcessor is modified to be able to handle possible multiple incompatible customMethods via AggregateException.
Corresponding interfaces are generated for entities with related inheritance.
ApplicationSieveProcessor is modified to include interface members.
SieveCustomFilterMethods and SieveCustomSortMethod are modified to include interface related custom method modifications.
Interface accessed unit tests are added.
This commit is contained in:
Hasan
2020-11-03 12:42:41 +03:00
parent 51b5356ec7
commit a4509bb8f0
14 changed files with 775 additions and 17 deletions

View File

@@ -0,0 +1,10 @@
using System;
namespace SieveUnitTests.Abstractions.Entity
{
public interface IBaseEntity
{
int Id { get; set; }
DateTimeOffset DateCreated { get; set; }
}
}

View File

@@ -0,0 +1,7 @@
namespace SieveUnitTests.Abstractions.Entity
{
public interface IComment: IBaseEntity
{
string Text { get; set; }
}
}

View File

@@ -0,0 +1,24 @@
using Sieve.Attributes;
using SieveUnitTests.Entities;
namespace SieveUnitTests.Abstractions.Entity
{
public interface IPost: IBaseEntity
{
[Sieve(CanFilter = true, CanSort = true)]
string Title { get; set; }
[Sieve(CanFilter = true, CanSort = true)]
int LikeCount { get; set; }
[Sieve(CanFilter = true, CanSort = true)]
int CommentCount { get; set; }
[Sieve(CanFilter = true, CanSort = true)]
int? CategoryId { get; set; }
[Sieve(CanFilter = true, CanSort = true)]
bool IsDraft { get; set; }
string ThisHasNoAttribute { get; set; }
string ThisHasNoAttributeButIsAccessible { get; set; }
int OnlySortableViaFluentApi { get; set; }
Comment TopComment { get; set; }
Comment FeaturedComment { get; set; }
}
}