Table of Contents

Class MergeFieldMap<T>

Namespace
DocWright.MailMerge
Assembly
DocWright.MailMerge.dll

Binds a merge field name to a way of reading it off an object.

public sealed class MergeFieldMap<T>

Type Parameters

T

The record type.

Inheritance
MergeFieldMap<T>
Inherited Members

Remarks

Explicit registration rather than reflection, because the net8 and net10 legs are IsAotCompatible and reflecting over an open generic's properties is exactly what trimming cannot see through. Registering the accessors costs a line per field and produces a binding the trimmer can follow, with no source generator in the build.

FromObjectsByReflection<T>(IEnumerable<T>) exists for callers who would rather have the convenience, and is annotated so the analyzer moves the warning to them.

Constructors

MergeFieldMap()

Properties

Count

Gets the number of registered fields.

Methods

Add(string, Func<T, object?>)

Registers a merge field.

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

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