Table of Contents

Class DbSeeder

Namespace
Builvero.Infrastructure.Data
Assembly
Builvero.Infrastructure.dll

Static utility class for seeding initial database data.

public static class DbSeeder
Inheritance
DbSeeder
Inherited Members

Remarks

This class provides methods for seeding default data into the database, such as admin users, invitations, and builder tags. All seeding operations are idempotent and safe to run multiple times.

Note: This class is deprecated in favor of DatabaseInitializer, which provides more comprehensive seeding with retry logic and better error handling. This class is kept for backward compatibility.

Methods

SeedAsync(ApplicationDbContext, IPasswordHasher, ITokenGenerator)

Seeds the database with initial data including admin user, invitation, and builder tags.

public static Task SeedAsync(ApplicationDbContext context, IPasswordHasher passwordHasher, ITokenGenerator tokenGenerator)

Parameters

context ApplicationDbContext

The database context to use for seeding.

passwordHasher IPasswordHasher

The password hasher service for creating the admin user.

tokenGenerator ITokenGenerator

The token generator service (currently unused but kept for compatibility).

Returns

Task

A task representing the asynchronous seeding operation.

Remarks

This method performs the following seeding operations:

  • Creates an admin user (email: "admin@builvero.com") if one doesn't exist
  • Creates a default invitation code ("WELCOME2024") if it doesn't exist
  • Creates default builder tags if they don't exist

All operations are idempotent - if the data already exists, no changes are made.