This commit is contained in:
Biarity 2019-01-18 20:54:55 +10:00
parent 574538e7da
commit 35167075bf
2 changed files with 28 additions and 2 deletions

View File

@ -148,6 +148,32 @@ Notes:
* Here's a [good example on how to work with enumerables](https://github.com/Biarity/Sieve/issues/2)
* Another example on [how to do OR logic](https://github.com/Biarity/Sieve/issues/8)
### Nested objects
You can filter/sort on a nested object's property by marking the property using the Fluent API.
Marking via attributes not currently supported.
For example, using this object model:
```C#
public class Post {
public User creator { get; set; }
}
public class User {
public string Name { get; set; }
}
```
Mark `Post.User` to be filterable:
```C#
// in MapProperties
mapper.Property<Post>(p => p.User.Name)
.CanFilter();
```
Now you can make requests such as: `filters=User.Name==specific_name`
### Creating your own DSL
You can replace this DSL with your own (eg. use JSON instead) by implementing an [ISieveModel](https://github.com/Biarity/Sieve/blob/master/Sieve/Models/ISieveModel.cs). You can use the default [SieveModel](https://github.com/Biarity/Sieve/blob/master/Sieve/Models/SieveModel.cs) for reference.

View File

@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<Version>2.3</Version>
<Version>2.3.1</Version>
<Description>Sieve is a simple, clean, and extensible framework for .NET Core that adds sorting, filtering, and pagination functionality out of the box. Most common use case would be for serving ASP.NET Core GET queries. Documentation available on GitHub: https://github.com/Biarity/Sieve/
</Description>
<Copyright>Copyright 2018</Copyright>
@ -10,7 +10,7 @@
<PackageProjectUrl>https://github.com/Biarity/Sieve</PackageProjectUrl>
<PackageIconUrl>https://emojipedia-us.s3.amazonaws.com/thumbs/240/twitter/120/alembic_2697.png</PackageIconUrl>
<RepositoryUrl></RepositoryUrl>
<PackageReleaseNotes>Negated operators (PR SuperGouge:negation-operator)</PackageReleaseNotes>
<PackageReleaseNotes>Filtering and sorting for nested objects (#51)</PackageReleaseNotes>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<Authors>Biarity</Authors>