BitzOrcas uses CSV-based seed data for both production initialization and test fixtures. The same CsvSeedStepBase<T> framework powers both.
Seed data location
src/BuildingBlocks/BitzOrcas.Infrastructure.SqlSugar/Seeders/Assets/├── Identity/ → platform_tenant.csv, sys_role.csv, etc.└── MasterData/ → sys_country.csv, sys_language.csv, etc.Test database setup
Integration tests initialize a test database using:
--init-schemaflag creates tables via SqlSugar CodeFirst--seed-demoloads CSV seed data viaISeedRunner- Tests run against seeded data
CsvSeedReader
public class CsvSeedReader{ // Reads CSV with header mapping to entity properties public List<T> Read<T>(Stream csvStream) where T : class;}CsvSeedStepBase
public abstract class CsvSeedStepBase<T> : ISeedStep where T : class, new(){ // Reads CSV → maps to entities → upserts via SqlSugar Storageable public override async Task ExecuteAsync(...) { var records = reader.Read<T>(csvStream); await db.Storageable(records).ExecuteCommandAsync(); }}Adding test fixtures
- Add a CSV file to
Seeders/Assets/(or embed as resource) - Create a seed step inheriting
CsvSeedStepBase<T> - Register in test setup
See also
- Demo accounts — Seed data reference
- Quick start — Schema initialization