Skip to content
bitzorcas
EN

Reference

Demo data & seed reference

The 14 platform seed tables, CSV-based seeding, and what you'll find in the database after --seed-demo.

Last updated

BitzOrcas.Modern uses a CSV-based seed framework to populate platform system tables. Seeding runs as part of the --init-schema / --seed-demo command — the API host creates all tables, audit sharding tables, runs seed data, then exits without entering the web pipeline.

How seeding works

The seed runner

The ISeedRunner iterates registered ISeedStep implementations in order. Each step reads from a CSV asset file and upserts records via the configured ORM adapter (SqlSugar by default). The framework provides CsvSeedReader and CsvSeedStepBase<T> for standard CSV → entity mapping.

Seed data CSV files live under:

src/BuildingBlocks/BitzOrcas.Infrastructure.SqlSugar/Seeders/Assets/

Each file follows the naming convention {order}-{table_name}.csv — the numeric prefix controls seeding order.

Schema initialisation modes

FlagTablesAudit tablesSeed data
--init-schema✅ Create✅ Create✅ Run
--seed-demo✅ Create✅ Create✅ Run (alias)
--seed-only❌ Skip❌ Skip✅ Run
--no-seed✅ Create✅ Create❌ Skip

The 14 platform seed tables

These are the system tables populated from CSV assets on --seed-demo:

OrderTableDescription
100sys_platform_tenantPlatform tenants (the root tenant and any system tenants)
110sys_languageSupported languages (e.g. zh-CN, en-US)
120sys_countryCountries and regions
130sys_industry_settingIndustry classification codes
140sys_general_code_groupGeneral code groups (lookup categories)
141sys_general_codeGeneral codes (lookup values)
142sys_general_code_textGeneral code display texts (i18n)
150sys_exchange_rateCurrency exchange rates
160sys_public_holidayPublic holidays by region
200sys_role_typeRole type definitions
210sys_roleSystem roles (Admin, Basic, etc.)
220sys_moduleModule definitions and permissions
230sys_permissionGranular permission entries
240sys_role_module_permissionRole-module-permission mappings

Seeding order matters

Tables are seeded in numeric prefix order. Foreign key dependencies are respected — parent tables (like sys_general_code_group) are seeded before child tables (like sys_general_code).

Sandbox module data

In addition to the platform tables, the Sandbox module (Notes, Greetings, Ping) provides built-in endpoints for testing. These are not database-backed by default — the Notes feature uses ISandboxDataPort which resolves to NullSandboxDataPort in the API shell (returns empty). When a persistence adapter is configured (SqlSugar or EF Core), the sandbox port is automatically wired to the real implementation.

Sandbox endpoints

EndpointMethodPurpose
/api/v1/pingGETHealth check / liveness probe
/api/v1/greetingsPOSTCreate a greeting (demonstrates command pattern)
/api/v1/notes/{id}GETGet a note by ID (demonstrates query pattern)
/api/v1/notesPOSTCreate a note (demonstrates write-through port)

Adding custom seed data

To add your own seed data:

  1. Create a CSV file in the Seeders/Assets/ directory with the appropriate order prefix.
  2. Create a CsvSeedStepBase<T> subclass that maps CSV columns to your entity.
  3. Register the step with ISeedRunner — the framework executes it in order.

The seed runner is idempotent — each step checks before writing, so re-running against an already-seeded database is safe.

  • Quick Start — bring the stack up and run --seed-demo.
  • Architecture — how the seed runner integrates into the DI pipeline.