Table of Contents

Class MigrationContext

Namespace
Typhon.Engine
Assembly
Typhon.Engine.dll

What a migration function (ContextMigrationFunc<TOld, TNew>) can do beyond copying bytes: read the texts of the old value and set the texts of the new one. A String1024 is a handle the engine owns the text of (#1094), so a plain MigrationFunc<TOld, TNew> can only carry an existing one over; giving a new value a text takes this context.

public sealed class MigrationContext
Inheritance
MigrationContext
Inherited Members

Remarks

Copying an old value's String1024 into the new value keeps its text: the handle moves with the row. Copy it into at most one field — two fields naming one text would each free it.

The migration may also run a function only to read another field of the converted value (a realm key, say); there the context writes no text: SetText(ref String1024, ReadOnlySpan<char>) leaves the field empty and ReadText(in String1024) reads nothing.

Methods

ReadText(in String1024)

The text field of the OLD value names; empty for no text.

public string ReadText(in String1024 field)

Parameters

field String1024

Returns

string

SetText(ref String1024, ReadOnlySpan<byte>)

public void SetText(ref String1024 field, ReadOnlySpan<byte> utf8)

Parameters

field String1024
utf8 ReadOnlySpan<byte>

SetText(ref String1024, ReadOnlySpan<char>)

Gives field of the NEW value the text text, cut at MaxUtf8Bytes UTF-8 bytes.

public void SetText(ref String1024 field, ReadOnlySpan<char> text)

Parameters

field String1024
text ReadOnlySpan<char>