-
Notifications
You must be signed in to change notification settings - Fork 130
/
ApplicationSieveProcessor.cs
31 lines (26 loc) · 1.1 KB
/
ApplicationSieveProcessor.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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;
}
}
}