# Marten - Hot Chocolate

> Learn how to integrate Marten with Hot Chocolate for filtering, sorting, projections, and pagination.

Canonical source: https://chillicream.com/docs/hotchocolate/fetching-data/integrations/marten

The `HotChocolate.Data` package generally works with any LINQ provider that provides an `IQueryable<T>`. However, Marten requires special handling. Pagination and projections work out of the box, but filtering and sorting need LINQ expressions translated into a format that the Marten LINQ provider can process. This integration provides custom configurations for that purpose.

You can find a sample project in [Hot Chocolate Examples](https://github.com/ChilliCream/hotchocolate-examples/tree/master/misc/MartenDB).

## Get Started

Install the `HotChocolate.Data.Marten` package:

Bash

```
dotnet add package HotChocolate.Data.Marten
```

Warning

All `HotChocolate.*` packages need to have the same version.

## Filtering

Register the Marten filtering convention on the schema builder:

C#

```
builder
    .AddGraphQL()
    .AddQueryType<Query>()
    .AddMartenFiltering();
```

[Learn more about filtering](https://chillicream.com/docs/hotchocolate/fetching-data/filtering).

## Sorting

Register the Marten sorting convention on the schema builder:

C#

```
builder
    .AddGraphQL()
    .AddQueryType<Query>()
    .AddMartenSorting();
```

[Learn more about sorting](https://chillicream.com/docs/hotchocolate/fetching-data/sorting).

## Projections

Projections work out of the box with Marten. No custom configuration is needed.

[Learn more about projections](https://chillicream.com/docs/hotchocolate/fetching-data/projections).

## Paging

Pagination works out of the box with Marten. No custom configuration is needed.

[Learn more about pagination](https://chillicream.com/docs/hotchocolate/fetching-data/pagination).

## Next Steps

- [Filtering](https://chillicream.com/docs/hotchocolate/fetching-data/filtering) for filtering concepts
- [Sorting](https://chillicream.com/docs/hotchocolate/fetching-data/sorting) for sorting concepts
- [Pagination](https://chillicream.com/docs/hotchocolate/fetching-data/pagination) for pagination setup
[Edit this page on GitHub](https://github.com/ChilliCream/graphql-platform/edit/main/website/content/docs/hotchocolate/fetching-data/integrations/marten.md)

Last updated on **June 30, 2026** by **Tobias Tengler**
