Modular mapping configuration (#162)

* Modular configuration for property mappings

* Update Readme, unit tests and sample

Co-authored-by: Steven Decoodt <steven.decoodt@vinci-energies.net>
This commit is contained in:
Steven Decoodt
2022-01-12 20:22:24 +01:00
committed by GitHub
parent 820358e8ff
commit 863d75bdc1
9 changed files with 312 additions and 13 deletions

View File

@@ -0,0 +1,37 @@
using Sieve.Services;
namespace SieveUnitTests.Abstractions.Entity
{
public class SieveConfigurationForIPost : ISieveConfiguration
{
public void Configure(SievePropertyMapper mapper)
{
mapper.Property<IPost>(p => p.ThisHasNoAttributeButIsAccessible)
.CanSort()
.CanFilter()
.HasName("shortname");
mapper.Property<IPost>(p => p.TopComment.Text)
.CanFilter();
mapper.Property<IPost>(p => p.TopComment.Id)
.CanSort();
mapper.Property<IPost>(p => p.OnlySortableViaFluentApi)
.CanSort();
mapper.Property<IPost>(p => p.TopComment.Text)
.CanFilter()
.HasName("topc");
mapper.Property<IPost>(p => p.FeaturedComment.Text)
.CanFilter()
.HasName("featc");
mapper
.Property<IPost>(p => p.DateCreated)
.CanSort()
.HasName("CreateDate");
}
}
}