MongoDB · Types · Preloading the schema

ArxMongoPreLoad

Definition

Namespace
ARX.SDK.MongoDb.Services
Package
ARX.SDK.MongoDb
C#
public static class ArxMongoPreLoad

Loads an ArxPreLoadTable from a MongoDB database.

Methods

  • static Task<ArxSchemaCatalog> LoadAsync(this ArxPreLoadTable preload, string connectionString, Action<ArxSchemaCatalogBuilder>? configure = null, CancellationToken cancellationToken = default)

    Reads the requested collections once (at startup) and returns the schema catalog for new ArxMongoDbService(connectionString, catalog): each collection's id (the _id, named "_id": an ObjectId one is a generated string, anything else supplied, by the $jsonSchema validator or one stored document), its unique indexes as keys and, in DataTypes, the field types its $jsonSchema validator declares. MongoDB has no foreign keys, so no lookups or referenced collections are loaded: declare lookups in configure.

    Parameter Type Description
    preloadthis ArxPreLoadTableThe tables to read, and how much of each (ArxPreLoadMode).
    connectionStringstringThe database to read them from; used for this call only.
    configureAction<ArxSchemaCatalogBuilder>?= nullAdds what the database can't say: lookups, display names, selection sets, hand-declared collections.
    cancellationTokenCancellationToken= defaultCancels the reads.
  • static Task<ArxSchemaCatalog> LoadAsync(this ArxPreLoadTable preload, string connectionString, string database, Action<ArxSchemaCatalogBuilder>? configure = null, CancellationToken cancellationToken = default)

    As LoadAsync, for a named database.

    Parameter Type Description
    preloadthis ArxPreLoadTableThe tables to read.
    connectionStringstringThe database's connection string.
    databasestringThe database, when the connection string doesn't name it.
    configureAction<ArxSchemaCatalogBuilder>?= nullAdds or changes declarations after the read (columns, lookups, versions); null for none.
    cancellationTokenCancellationToken= defaultCancels the call.