mirror of
https://github.com/Biarity/Sieve.git
synced 2024-11-22 05:22:57 +01:00
Document #51
This commit is contained in:
parent
574538e7da
commit
35167075bf
26
README.md
26
README.md
@ -148,6 +148,32 @@ Notes:
|
|||||||
* Here's a [good example on how to work with enumerables](https://github.com/Biarity/Sieve/issues/2)
|
* 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)
|
* 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
|
### 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.
|
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.
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netstandard2.0</TargetFramework>
|
<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>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>
|
</Description>
|
||||||
<Copyright>Copyright 2018</Copyright>
|
<Copyright>Copyright 2018</Copyright>
|
||||||
@ -10,7 +10,7 @@
|
|||||||
<PackageProjectUrl>https://github.com/Biarity/Sieve</PackageProjectUrl>
|
<PackageProjectUrl>https://github.com/Biarity/Sieve</PackageProjectUrl>
|
||||||
<PackageIconUrl>https://emojipedia-us.s3.amazonaws.com/thumbs/240/twitter/120/alembic_2697.png</PackageIconUrl>
|
<PackageIconUrl>https://emojipedia-us.s3.amazonaws.com/thumbs/240/twitter/120/alembic_2697.png</PackageIconUrl>
|
||||||
<RepositoryUrl></RepositoryUrl>
|
<RepositoryUrl></RepositoryUrl>
|
||||||
<PackageReleaseNotes>Negated operators (PR SuperGouge:negation-operator)</PackageReleaseNotes>
|
<PackageReleaseNotes>Filtering and sorting for nested objects (#51)</PackageReleaseNotes>
|
||||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||||
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
|
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
|
||||||
<Authors>Biarity</Authors>
|
<Authors>Biarity</Authors>
|
||||||
|
Loading…
Reference in New Issue
Block a user