Class AutomaticTypeRegistry

Namespace: redb.Core.Utils
Assembly: redb.Core.dll

Automatic type registry for polymorphic work with REDB objects
Scans loaded assemblies and builds mapping scheme_id/scheme_name -> C# type

public class AutomaticTypeRegistry

Inheritance

ObjectAutomaticTypeRegistry

Properties

IsInitialized

Check if registry is initialized

public static bool IsInitialized { get; }

Methods

Clear()

Clear registry (for testing)

public static void Clear()

GetSchemeIdByType(Type)

Get scheme_id by C# type

public static long? GetSchemeIdByType(Type type)

GetStatistics()

Get registry statistics

public static (int SchemeNames, int SchemeIds) GetStatistics()

GetTypeBySchemeId(long)

Get C# type by scheme ID

public static Type? GetTypeBySchemeId(long schemeId)

GetTypeBySchemeName(string)

Get C# type by scheme name

public static Type? GetTypeBySchemeName(string schemeName)

InitializeAsync(ISchemeSyncProvider, ILogger?)

Initialize type registry at application startup.

public static Task InitializeAsync(ISchemeSyncProvider schemeProvider, ILogger? logger = null)

RegisterType(string, long, Type)

Register type manually (for cases when automatic scanning doesn't work)

public static void RegisterType(string schemeName, long schemeId, Type type)