Skip to content

Commit

Permalink
docs: documentation about navigation properties (#200)
Browse files Browse the repository at this point in the history
  • Loading branch information
skolmer authored Aug 14, 2024
1 parent d330a5f commit 20ae059
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions docs/pages/guide/gridifyMapper.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ var mapper = new GridifyMapper<Person>()
.GenerateMappings();
```

- To generate mappings with **control over nesting depth**, you can specify the `maxNestingDepth` parameter. This parameter limits how deep the mappings will be generated for nested classes. Set it to 0 for no nesting or a positive value to control the depth `(added in v2.11.0)`:
- To generate mappings with **control over nesting depth**, you can specify the `maxNestingDepth` parameter. This parameter limits how deep the mappings will be generated for nested classes and navigation properties `(added in v2.15.0)`. Set it to 0 for no nesting or a positive value to control the depth `(added in v2.11.0)`:

```csharp
var mapper = new GridifyMapper<Person>()
Expand All @@ -64,6 +64,7 @@ Another alternative to generate default mappings for top-level public properties

``` csharp
var mapper = new GridifyMapper<Person>(true);
var mapperWithDepth = new GridifyMapper<Person>(true, 2);
```

:::
Expand Down Expand Up @@ -94,6 +95,10 @@ mapper = mapper.AddMap("userName", p => p.UserName, value => value.ToLower());

This method checks if the mapper has a mapping for the given field name.

## ClearMaps

This method clears the list of mappings

## GetCurrentMaps

This method returns list of current mappings.
Expand Down Expand Up @@ -193,12 +198,15 @@ var gq = new GridifyQuery

### Mapping to Dictionary Keys

Similarly, you can define a mapping to a specific key in a dictionary.
Similarly, you can define a mapping to a specific key in a dictionary or in a navigation property.

```csharp
var gm = new GridifyMapper<TargetType>()
.AddMap("dictProp", (target, key) => target.MyDictionary[key]);

var gm2 = new GridifyMapper<TargetType>()
.AddMap("navProp", (target, key) => target.NavigationProperty.Where(n => n.Key == key).Select(n => n.Value));

var gq = new GridifyQuery
{
// Filters on the value associated with the 'name' key in a dictionary
Expand Down

0 comments on commit 20ae059

Please sign in to comment.