Relatude Help

12 Registering the model & the admin UI

  • Server-hosted (the usual case) — AddRelatudeDB and UseRelatudeDB are in the global namespace. Inject RelatudeDBContext wherever you need the database: ctx.Database is the NodeStore that the rest of this manual works with. The options are described in…
  • relatude.db.json — Everything that is not code goes in relatude.settings/relatude.db.json: the databases, where they keep their data, the index engines, file stores, AI providers, the admin login and where the datamodel comes from…
  • 12.1 Every setting in relatude.db.json — The file is one JSON object, read into RelatudeDBServerSettings. Keys are case-insensitive, enums are written as names ("LocalDisk", "Native"), and // comments are allowed, though trailing commas are not. The tables list…
  • Overriding settings from configuration — Any setting in relatude.db.json can be overridden from ASP.NET configuration. At startup the server reads the RelatudeDB section and merges it over the file. The section can come from appsettings.json…
  • Changes made in the admin UI: relatude.db.overrides.json — The settings pages of the admin UI never write relatude.db.json. That file describes the application: you write it, keep it in source control and deploy it with the code. What an administrator changes belongs to the…
  • Settings of your own: custom settings — An application usually has settings of its own: a shop's currency, a payment provider's key, the address orders are mailed to. Register them with the server, and they get a tab in the admin UI (beside Server settings, or…
  • 12.2 What goes where: source control, deployment and appsettings — An application on Relatude.DB is configured from four places: the code, the settings files in relatude.settings/ (SHARED), the configuration of each environment (appsettings*.json, environment variables, secrets), and…
  • Options and events in Program.cs — ServerOptions holds what only code can say: file converters, folder paths, how settings are loaded, and the lifecycle callbacks.
  • Two ways to register a datamodel — Register model types in code with OnDatamodelInit, or as datamodel sources in relatude.db.json. The two add up: the server loads the sources first, then runs OnDatamodelInit on the same Datamodel. In Program.cs, the…
  • The admin UI — The admin UI is where you manage everything about a database that is not code: storage, indexes, model sources, backups, logs, tasks and APIs. Learn your way around it early. app.UseRelatudeDB() mounts it at…
  • Programmatic / embedded — Outside the server (in tests, an embedded store or an import tool), build the Datamodel yourself with the same methods, then open a store on it:
  • What the model builder validates — At build time (you find out at startup): A node type that is a class needs a public parameterless constructor. Two parent interfaces may not declare the same property name, and neither may two classes. Re-declaring an…
  • Do not redefine the native types — Relatude.DB has its own model in Relatude.DB.Native.Models: ISystemUser, ISystemUserGroup, ISystemCollection and ISystemCulture. The admin UI, authentication and cultures depend on them. If your domain needs users, model…