mirror of
https://github.com/Biarity/Sieve.git
synced 2024-11-25 14:53:27 +01:00
863d75bdc1
* Modular configuration for property mappings * Update Readme, unit tests and sample Co-authored-by: Steven Decoodt <steven.decoodt@vinci-energies.net>
32 lines
1.1 KiB
C#
32 lines
1.1 KiB
C#
using Microsoft.Extensions.Options;
|
|
using Sieve.Models;
|
|
using Sieve.Sample.Entities;
|
|
using Sieve.Services;
|
|
|
|
namespace Sieve.Sample.Services
|
|
{
|
|
public class ApplicationSieveProcessor : SieveProcessor
|
|
{
|
|
public ApplicationSieveProcessor(IOptions<SieveOptions> options, ISieveCustomSortMethods customSortMethods, ISieveCustomFilterMethods customFilterMethods) : base(options, customSortMethods, customFilterMethods)
|
|
{
|
|
}
|
|
|
|
protected override SievePropertyMapper MapProperties(SievePropertyMapper mapper)
|
|
{
|
|
// Option 1: Map all properties centrally
|
|
mapper.Property<Post>(p => p.Title)
|
|
.CanSort()
|
|
.CanFilter()
|
|
.HasName("CustomTitleName");
|
|
|
|
// Option 2: Manually apply functionally grouped mapping configurations
|
|
//mapper.ApplyConfiguration<SieveConfigurationForPost>();
|
|
|
|
// Option 3: Scan and apply all configurations
|
|
//mapper.ApplyConfigurationsFromAssembly(typeof(ApplicationSieveProcessor).Assembly);
|
|
|
|
return mapper;
|
|
}
|
|
}
|
|
}
|