Table of Contents

Class DatabaseSchemaExtensions

Namespace
Typhon.Schema.Definition
Assembly
Typhon.Schema.Definition.dll

Maps CLR types to their schema FieldType and computes the inline byte size a field of a given type occupies in component storage.

public static class DatabaseSchemaExtensions
Inheritance
DatabaseSchemaExtensions
Inherited Members

Methods

FieldSizeInComp(FieldType)

Byte size a field of the given field type occupies inline in component storage. The variable-length String counts only its 32-byte inline handle (the payload spills to the variable-size buffer); a Collection is its 4-byte buffer id and a Component its 8-byte handle. Returns 0 for types with no fixed inline footprint.

public static int FieldSizeInComp(this FieldType field)

Parameters

field FieldType

The field type to size.

Returns

int

The inline size in bytes, or 0 if the type has no fixed inline footprint.

FromType(Type)

Maps a CLR type to its schema FieldType, resolving primitives, the built-in value types (points, quaternions, bounding volumes, strings), nested components (types marked with ComponentAttribute), ComponentCollection<T> collections, and EntityLink<T> foreign keys (indexed as Long).

public static (FieldType field, FieldType under) FromType(Type t)

Parameters

t Type

The CLR type to map.

Returns

(FieldType field, FieldType under)

A pair whose field is the resolved FieldType and whose under carries the element type for a Collection (otherwise None). Returns (None, None) for an unrecognized type.

FromType<T>()

Resolves the FieldType pair for the CLR type T. See FromType(Type) for the mapping and return semantics.

public static (FieldType field, FieldType under) FromType<T>()

Returns

(FieldType field, FieldType under)

The resolved field type and, for a Collection, its element type in under; None for both when unrecognized.

Type Parameters

T

The CLR type to map.