Skip to content

Commit

Permalink
Sorting documentation (#2626)
Browse files Browse the repository at this point in the history
  • Loading branch information
PascalSenn committed Nov 20, 2020
1 parent edfcc79 commit 5d4771a
Show file tree
Hide file tree
Showing 2 changed files with 346 additions and 47 deletions.
9 changes: 5 additions & 4 deletions website/src/docs/hotchocolate/fetching-data/filtering.md
Expand Up @@ -5,7 +5,8 @@ title: Filtering
# What is filtering

With _Hot Chocolate_ filters, you can expose complex filter objects through your GraphQL API that translates to native database queries. The default filter implementation translates filters to expression trees that are applied to `IQueryable`.
Filters by default work on `IQueryable` but you can also easily customize them to use other interfaces. Hot Chocolate by default will inspect your .NET model and infer the possible filter operations from it.
Hot Chocolate by default will inspect your .NET model and infer the possible filter operations from it.
Filters use `IQueryable` (`IEnumerable`) by default, but you can also easily customize them to use other interfaces.

The following type would yield the following filter operations:

Expand Down Expand Up @@ -98,7 +99,7 @@ public class Query

# Customization

Under the hood, filtering is based on top of normal Hot Chocolate input types. You can easily customize them with a very familiar fluent interface. The filter input types follow the same `descriptor` scheme as you are used to from the normal filter input types. Just extend the base class `FilterInputType<T>` and override the descriptor method.
Under the hood, filtering is based on top of normal Hot Chocolate input types. You can easily customize them with a very familiar fluent interface. The filter input types follow the same `descriptor` scheme as you are used to from the normal input types. Just extend the base class `FilterInputType<T>` and override the descriptor method.

`IFilterInputTypeDescriptor<T>` supports most of the methods of `IInputTypeDescriptor<T>`. By default filters for all fields of the type are generated.
If you do want to specify the filters by yourself you can change this behavior with `BindFields`, `BindFieldsExplicitly` or `BindFieldsImplicitly`.
Expand Down Expand Up @@ -525,7 +526,7 @@ public class CustomConvention
}

services.AddGraphQLServer()
.AddConvention<CustomConvention>();
.AddConvention<IFilterConvention, CustomConvention>();
// or
services.AddGraphQLServer()
.AddConvention<IFilterConvention>(new FilterConvention(x => x.AddDefaults()))
Expand All @@ -543,7 +544,7 @@ public class CustomConventionExtension
}

services.AddGraphQLServer()
.AddConvention<CustomConventionExtension>();
.AddConvention<IFilterConvention, CustomConventionExtension>();
// or
services.AddGraphQLServer()
.AddConvention<IFilterConvention>(new FilterConventionExtension(x => /*config*/))
Expand Down

0 comments on commit 5d4771a

Please sign in to comment.