Update README.md (#168)

Fix Fluent API example on readme
This commit is contained in:
The Iron Fist 2022-02-13 03:19:05 -07:00 committed by GitHub
parent 863d75bdc1
commit 7aaadccf18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -231,7 +231,7 @@ It is recommended that you write exception-handling middleware to globally handl
You can find an example project incorporating most Sieve concepts in [SieveTests](https://github.com/Biarity/Sieve/tree/master/SieveTests). You can find an example project incorporating most Sieve concepts in [SieveTests](https://github.com/Biarity/Sieve/tree/master/SieveTests).
## Fluent API ## Fluent API
To use the Fluent API instead of attributes in marking properties, setup an alternative `SieveProcessor` that overrides `MapProperties`. For example: To use the Fluent API instead of attributes in marking properties, setup an alternative `SieveProcessor` that overrides `MapProperties`. For [example](https://github.com/Biarity/Sieve/blob/master/Sieve.Sample/Services/ApplicationSieveProcessor.cs):
```C# ```C#
public class ApplicationSieveProcessor : SieveProcessor public class ApplicationSieveProcessor : SieveProcessor
@ -278,7 +278,7 @@ To enable functional grouping of mappings the `ISieveConfiguration` interface wa
```C# ```C#
public class SieveConfigurationForPost : ISieveConfiguration public class SieveConfigurationForPost : ISieveConfiguration
{ {
protected override SievePropertyMapper Configure(SievePropertyMapper mapper) public void Configure(SievePropertyMapper mapper)
{ {
mapper.Property<Post>(p => p.Title) mapper.Property<Post>(p => p.Title)
.CanFilter() .CanFilter()
@ -330,7 +330,7 @@ public class ApplicationSieveProcessor : SieveProcessor
protected override SievePropertyMapper MapProperties(SievePropertyMapper mapper) protected override SievePropertyMapper MapProperties(SievePropertyMapper mapper)
{ {
return mapper.ApplyConfigurationForAssembly(typeof(ApplicationSieveProcessor).Assembly); return mapper.ApplyConfigurationsFromAssembly(typeof(ApplicationSieveProcessor).Assembly);
} }
} }
``` ```