Table of Contents

Method AddRelation

Namespace
DocWright.MailMerge
Assembly
DocWright.MailMerge.dll

AddRelation<TChild>(string, Func<T, IEnumerable<TChild>?>, MergeFieldMap<TChild>)

Registers a child collection a nested «TableStart:name» region repeats over.

public MergeFieldMap<T> AddRelation<TChild>(string name, Func<T, IEnumerable<TChild>?> accessor, MergeFieldMap<TChild> childMap)

Parameters

name string

The region name, matched ordinal-ignore-case.

accessor Func<T, IEnumerable<TChild>>

Reads the child collection off a record. May return null, which merges as a region with no rows.

childMap MergeFieldMap<TChild>

The child records' field map.

Returns

MergeFieldMap<T>

This map, for chaining.

Type Parameters

TChild

The child record type.

Exceptions

ArgumentNullException

Any argument is null.

ArgumentException

name is empty or already registered.