ProtectedconstructorStaticInstanceReturns the singleton instance of BaseEngineRegistry
Clears entity load tracking data. Useful for testing or when engines are being reconfigured.
Clear the entity size cache (useful if schema changes)
Find every loaded engine that caches the given entity, returning each match's engine + the full property config that produced it + a live pointer to the cached array — so a single call tells you whether you can serve a lookup from memory (instead of hitting the database) and gives you the data without a second call.
Matches are ordered unfiltered-first: a config with no Filter holds
the complete entity set and is the authoritative cache to prefer (e.g. for
"show all rows on focus" or in-memory search); filtered caches (a subset)
come after. When more than one engine caches the entity you get them all,
so callers can pick the right one (e.g. by engineClassName or by
inspecting config).
Typical use (1-liner intent):
const hit = BaseEngineRegistry.Instance.FindCachedEntity<UserInfo>('Users', { unfilteredOnly: true })[0];
if (hit) {
// Small/static entity already fully in memory — search/sort it locally, no DB call.
const matches = hit.records.filter(u => u.Name.toLowerCase().includes(q));
} else {
// Not cached unfiltered → fall back to a normal RunView against the DB.
}
Notes:
records is the engine's live array — read it, don't
mutate it. For 'simple' configs the rows are plain objects, not
BaseEntity instances (check config.ResultType if you need ORM rows).Entity to look up (case-insensitive, whitespace-trimmed).
Optionaloptions: { unfilteredOnly?: boolean }OptionalunfilteredOnly?: booleanWhen true, omit any cache that has a Filter
(i.e. only return full-set caches). Default false.
Matches (unfiltered first); empty array when no loaded engine caches it.
Get all registered engines
Array of all registered engine instances
Get a registered engine by class name
The class name of the engine
The engine instance or null if not found
Get registration info for a specific engine
The class name of the engine
The registration info or null if not found
Get a list of all engine class names
Gets a list of engines that have loaded a specific entity.
The name of the entity
Array of engine class names that have loaded this entity
Returns the entity load tracking data as a Map suitable for TelemetryAnalyzerContext. Key: entity name, Value: array of engine class names that have loaded this entity.
The Global Object Store is a place to store global objects that need to be shared across the application. Depending on the execution environment, this could be the window object in a browser, or the global object in a node environment, or something else in other contexts. The key here is that in some cases static variables are not truly shared because it is possible that a given class might have copies of its code in multiple paths in a deployed application. This approach ensures that no matter how many code copies might exist, there is only one instance of the object in question by using the Global Object Store.
Gets all entities that have been loaded by multiple engines.
Map of entity name to array of engine class names
Check if an engine is registered
Notify the registry that an engine has been loaded/configured
The engine that was loaded
Records that an engine has loaded a specific entity. If another engine has already loaded this entity, a warning is queued.
The class name of the engine loading the entity
The name of the entity being loaded
Records that an engine has loaded multiple entities. Convenience method for batch recording. Uses instance identity to prevent false positives when a subclass and base class share the same singleton (e.g., AIEngine extends AIEngineBase).
The engine instance that loaded the entities
Array of entity names being loaded
Refresh all loaded engines
Number of engines refreshed
Register an engine instance with the registry. This is typically called automatically by BaseEngine during Config().
The engine instance to register
OptionalclassName: stringOptional class name override (uses constructor name by default)
Clear all registrations (use with caution, primarily for testing)
Convenience wrapper over FindCachedEntity that returns just the
best cached array for an entity (unfiltered preferred), or null when
no loaded engine caches it. Use this for the common "if it's already in
memory, use it; otherwise go to the DB" check.
const rows = BaseEngineRegistry.Instance.TryGetCachedRecords<UserInfo>('Users', { unfilteredOnly: true });
if (rows) { /* serve from memory */ } else { /* RunView fallback */ }
Entity to look up (case-insensitive, trimmed).
Optionaloptions: { unfilteredOnly?: boolean }OptionalunfilteredOnly?: booleanRequire a full-set (no-Filter) cache. Default false.
The live cached array, or null if not cached (per the options).
Unregister an engine from the registry
The engine instance to unregister
Protected StaticgetReturns the singleton instance of the class. If the instance does not exist, it is created and stored in the Global Object Store. If className is provided it will be used as part of the key in the Global Object Store, otherwise the actual class name will be used. NOTE: the class name used by default is the lowest level of the object hierarchy, so if you have a class that extends another class, the lowest level class name will be used.
OptionalclassName: string
BaseEngineRegistry is a central registry for tracking all BaseEngine instances.
It provides:
Example