mirror of
https://github.com/Biarity/Sieve.git
synced 2025-07-27 04:33:23 +02:00
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:
37
SieveUnitTests/Entities/SieveConfigurationForPost.cs
Normal file
37
SieveUnitTests/Entities/SieveConfigurationForPost.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using Sieve.Services;
|
||||
|
||||
namespace SieveUnitTests.Entities
|
||||
{
|
||||
public class SieveConfigurationForPost : ISieveConfiguration
|
||||
{
|
||||
public void Configure(SievePropertyMapper mapper)
|
||||
{
|
||||
mapper.Property<Post>(p => p.ThisHasNoAttributeButIsAccessible)
|
||||
.CanSort()
|
||||
.CanFilter()
|
||||
.HasName("shortname");
|
||||
|
||||
mapper.Property<Post>(p => p.TopComment.Text)
|
||||
.CanFilter();
|
||||
|
||||
mapper.Property<Post>(p => p.TopComment.Id)
|
||||
.CanSort();
|
||||
|
||||
mapper.Property<Post>(p => p.OnlySortableViaFluentApi)
|
||||
.CanSort();
|
||||
|
||||
mapper.Property<Post>(p => p.TopComment.Text)
|
||||
.CanFilter()
|
||||
.HasName("topc");
|
||||
|
||||
mapper.Property<Post>(p => p.FeaturedComment.Text)
|
||||
.CanFilter()
|
||||
.HasName("featc");
|
||||
|
||||
mapper
|
||||
.Property<Post>(p => p.DateCreated)
|
||||
.CanSort()
|
||||
.HasName("CreateDate");
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user