Table of Contents

Class JsonTransformRuleBuilder

Namespace
Excalibur.EventSourcing.Upcasting
Assembly
Excalibur.EventSourcing.dll

Fluent builder for constructing a list of JsonTransformRule instances.

public sealed class JsonTransformRuleBuilder
Inheritance
JsonTransformRuleBuilder
Inherited Members

Remarks

Usage example:

var rules = new JsonTransformRuleBuilder()
    .Rename("OldProperty", "NewProperty")
    .Remove("DeprecatedField")
    .AddDefault("NewField", 42)
    .Move("Nested.Value", "TopLevel")
    .Build();

Methods

AddDefault(string, object?)

Adds an add-default rule that sets the property at path to defaultValue if it does not already exist.

public JsonTransformRuleBuilder AddDefault(string path, object? defaultValue)

Parameters

path string

The property name to add.

defaultValue object

The default value.

Returns

JsonTransformRuleBuilder

The builder for method chaining.

Build()

Builds the list of transformation rules.

public IReadOnlyList<JsonTransformRule> Build()

Returns

IReadOnlyList<JsonTransformRule>

An immutable list of transformation rules.

Move(string, string)

Adds a move rule that moves a property from sourcePath to targetPath.

public JsonTransformRuleBuilder Move(string sourcePath, string targetPath)

Parameters

sourcePath string

The source property name.

targetPath string

The target property name.

Returns

JsonTransformRuleBuilder

The builder for method chaining.

Remove(string)

Adds a remove rule that deletes the property at path.

public JsonTransformRuleBuilder Remove(string path)

Parameters

path string

The property name to remove.

Returns

JsonTransformRuleBuilder

The builder for method chaining.

Rename(string, string)

Adds a rename rule that renames a property from sourcePath to targetPath.

public JsonTransformRuleBuilder Rename(string sourcePath, string targetPath)

Parameters

sourcePath string

The current property name.

targetPath string

The new property name.

Returns

JsonTransformRuleBuilder

The builder for method chaining.