Nabs.Launchpad.Core.SeedData 10.0.205

Prefix Reserved
dotnet add package Nabs.Launchpad.Core.SeedData --version 10.0.205
                    
NuGet\Install-Package Nabs.Launchpad.Core.SeedData -Version 10.0.205
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Nabs.Launchpad.Core.SeedData" Version="10.0.205" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Nabs.Launchpad.Core.SeedData" Version="10.0.205" />
                    
Directory.Packages.props
<PackageReference Include="Nabs.Launchpad.Core.SeedData" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Nabs.Launchpad.Core.SeedData --version 10.0.205
                    
#r "nuget: Nabs.Launchpad.Core.SeedData, 10.0.205"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Nabs.Launchpad.Core.SeedData@10.0.205
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Nabs.Launchpad.Core.SeedData&version=10.0.205
                    
Install as a Cake Addin
#tool nuget:?package=Nabs.Launchpad.Core.SeedData&version=10.0.205
                    
Install as a Cake Tool

Nabs Launchpad Core Seed Data Library

A .NET 10 library providing interfaces and abstractions for database seeding and migration operations in the Nabs Launchpad framework.

Overview

The Nabs.Launchpad.Core.SeedData library defines core interfaces for managing database initialization tasks including:

  • Database schema migrations
  • Test data generation and seeding
  • Development environment data setup

This library provides the contracts that implementations can use to handle database setup operations in a consistent manner across the Launchpad platform.

Key Features

  • Migration Processing: Interface for handling database schema migrations
  • Seed Data Processing: Interface for populating databases with initial or test data
  • Seed Configuration Processing: Interface and helpers for seeding configuration into Azure App Configuration and the local emulator
  • App Configuration Client Abstraction: Unified IConfgurationClient with Azure SDK and emulator implementations
  • Automatic Registration: AddDataMigrationServices to wire up the correct configuration client based on connection string (Azure vs emulator)
  • EF Migrations Helper: MigrationService.GenerateMigration<TContext> to generate migrations from the correct project folder
  • Solution Path Discovery: PathFinder.FindSolutionFolder() for locating the solution root
  • Async Support: All operations support cancellation tokens and async patterns
  • Framework Integration: Designed to work seamlessly with dependency injection and hosted services

Core Interfaces and Components

ISeedDataProcessor

Defines a contract for processing seed data operations:

public interface ISeedDataProcessor
{
    Task ProcessAsync(CancellationToken stoppingToken);
}

Use this interface to implement classes that populate your database with:

  • Initial application data
  • Test data for development environments
  • Sample data for demonstrations

IMigrationProcessor

Defines a contract for handling database migrations:

public interface IMigrationProcessor
{
    Task MigrateAsync(CancellationToken stoppingToken);
}

Use this interface to implement classes that:

  • Apply database schema changes
  • Execute migration scripts
  • Ensure database schema is up-to-date

Additional Components

ISeedConfigurationProcessor

Defines a contract for seeding configuration (e.g., App Configuration keys/labels):

public interface ISeedConfigurationProcessor
{
    Task ProcessAsync(CancellationToken stoppingToken);
}

IConfgurationClient

Abstraction over Azure App Configuration operations with two implementations:

  • AzureConfigurationClient (connection string or managed identity via URI)
  • EmulatorConfigurationClient (HTTP REST for local emulator)

ProjectExtensions.AddDataMigrationServices

Registers the appropriate IConfgurationClient based on the App Configuration connection string:

builder.AddDataMigrationServices(appConfigurationName: "AppConfig");
  • URI → Azure managed identity
  • Full connection string → Azure SDK client
  • localhost/127.0.0.1 → Emulator client

MigrationService.GenerateMigration

Helper to generate EF Core migrations from the correct project directory:

await dbContext.GenerateMigration("InitialCreate");

PathFinder.FindSolutionFolder

Utility to find the solution root to assist tooling that needs solution-relative paths.

Dependencies

  • .NET 10: Target framework
  • Bogus: Fake data generation library for creating realistic test data

Usage Examples

Implementing ISeedDataProcessor

public class UserSeedDataProcessor : ISeedDataProcessor
{
    private readonly IUserRepository _userRepository;
    private readonly Faker<User> _userFaker;

    public UserSeedDataProcessor(IUserRepository userRepository)
    {
        _userRepository = userRepository;
        _userFaker = new Faker<User>()
            .RuleFor(u => u.FirstName, f => f.Name.FirstName())
            .RuleFor(u => u.LastName, f => f.Name.LastName())
            .RuleFor(u => u.Email, f => f.Internet.Email());
    }

    public async Task ProcessAsync(CancellationToken stoppingToken)
    {
        if (await _userRepository.AnyAsync(stoppingToken))
            return; // Data already exists

        var users = _userFaker.Generate(100);
        await _userRepository.AddRangeAsync(users, stoppingToken);
    }
}

Implementing IMigrationProcessor

public class DatabaseMigrationProcessor : IMigrationProcessor
{
    private readonly ApplicationDbContext _context;

    public DatabaseMigrationProcessor(ApplicationDbContext context)
    {
        _context = context;
    }

    public async Task MigrateAsync(CancellationToken stoppingToken)
    {
        await _context.Database.MigrateAsync(stoppingToken);
    }
}

Dependency Injection Registration

services.AddScoped<ISeedDataProcessor, UserSeedDataProcessor>();
services.AddScoped<IMigrationProcessor, DatabaseMigrationProcessor>();

Using in Hosted Service

public class DatabaseInitializationService : IHostedService
{
    private readonly IMigrationProcessor _migrationProcessor;
    private readonly ISeedDataProcessor _seedDataProcessor;

    public DatabaseInitializationService(
        IMigrationProcessor migrationProcessor,
        ISeedDataProcessor seedDataProcessor)
    {
        _migrationProcessor = migrationProcessor;
        _seedDataProcessor = seedDataProcessor;
    }

    public async Task StartAsync(CancellationToken cancellationToken)
    {
        await _migrationProcessor.MigrateAsync(cancellationToken);
        await _seedDataProcessor.ProcessAsync(cancellationToken);
    }

    public Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask;
}

App Configuration Seeding and Registration

var builder = WebApplication.CreateBuilder(args);

// Registers IConfgurationClient (Azure vs Emulator) based on connection string
builder.AddDataMigrationServices(appConfigurationName: "AppConfig");

builder.Services.AddScoped<ISeedConfigurationProcessor, MyAppConfigSeeder>();

var app = builder.Build();

// Example seed processor
public sealed class MyAppConfigSeeder : ISeedConfigurationProcessor
{
    private readonly IConfgurationClient _client;
    public MyAppConfigSeeder(IConfgurationClient client) => _client = client;

    public async Task ProcessAsync(CancellationToken ct)
    {
        await _client.SetConfigurationSettingAsync(
            key: "MyApp:FeatureFlag:NewUI",
            value: "true",
            label: "prod",
            cancellationToken: ct);
    }
}

Using EmulatorConfigurationClient Directly (optional)

var client = new EmulatorConfigurationClient(
    connectionString: "Endpoint=http://localhost:8483;Id=...;Secret=...",
    httpClient: new HttpClient());
await client.AddConfigurationSettingAsync("Sample:Key", "value", label: "dev");

Generating EF Migrations

await using var context = new MyDbContext(options);
await context.GenerateMigration("InitialCreate");

Integration with Launchpad

This library is part of the larger Nabs Launchpad framework and integrates with:

  • Core.Testing.Silos: Provides test data for Orleans silo testing
  • Core.Persistence: Works with Entity Framework contexts for data operations
  • Core.Context: Integrates with application database contexts

Best Practices

  1. Environment-Specific Data: Only seed data appropriate for the current environment
  2. Idempotent Operations: Ensure seed operations can be run multiple times safely
  3. Performance Considerations: Use bulk operations for large datasets
  4. Error Handling: Implement proper error handling and logging
  5. Cancellation Support: Always respect cancellation tokens for graceful shutdowns

Testing

The library includes comprehensive unit tests in the Launchpad.Core.SeedData.UnitTests project to ensure reliability and correctness of the interfaces and any shared implementations.

Contributing

This library follows the Nabs Launchpad coding standards:

  • Use C# 13 features and latest language constructs
  • Follow nullable reference types conventions
  • Implement proper async/await patterns
  • Include comprehensive unit tests

License

Copyright � Net Advantage Business Solutions

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Nabs.Launchpad.Core.SeedData:

Package Downloads
Nabs.Launchpad.Core.Testing

Package Description

Nabs.Launchpad.Core.Testing.Silos

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
10.0.205 160 12/24/2025
10.0.204 181 12/21/2025
10.0.203 281 12/18/2025
10.0.202 278 12/17/2025
10.0.200 281 12/17/2025
10.0.199 436 12/10/2025
10.0.197 166 12/5/2025
10.0.196 681 12/3/2025
10.0.195 678 12/3/2025
10.0.194 669 12/3/2025
10.0.193 673 12/2/2025
10.0.192 174 11/28/2025
10.0.190 185 11/27/2025
10.0.189 165 11/23/2025
10.0.187 167 11/23/2025
10.0.186 160 11/23/2025
10.0.184 406 11/20/2025
10.0.181-rc3 282 11/11/2025
10.0.180 290 11/11/2025
10.0.179-rc2 276 11/11/2025
10.0.178-rc2 233 11/10/2025
10.0.177-rc2 225 11/10/2025
10.0.176-rc2 197 11/6/2025
10.0.175-rc2 195 11/6/2025
10.0.174-rc2 180 11/5/2025
10.0.173-rc2 212 11/3/2025
10.0.172-rc2 220 11/2/2025 10.0.172-rc2 is deprecated because it is no longer maintained.
10.0.170-rc2 204 11/1/2025 10.0.170-rc2 is deprecated because it is no longer maintained.
10.0.169-rc2 203 11/1/2025 10.0.169-rc2 is deprecated because it is no longer maintained.
10.0.168-rc2 201 10/31/2025 10.0.168-rc2 is deprecated because it is no longer maintained.
10.0.166-rc2 205 10/31/2025 10.0.166-rc2 is deprecated because it is no longer maintained.
10.0.164-rc2 277 10/28/2025 10.0.164-rc2 is deprecated because it is no longer maintained.
10.0.162-rc2 267 10/24/2025 10.0.162-rc2 is deprecated because it is no longer maintained.
10.0.161 271 10/24/2025 10.0.161 is deprecated because it is no longer maintained.
9.0.151 216 10/17/2025 9.0.151 is deprecated because it is no longer maintained.
9.0.150 293 9/10/2025 9.0.150 is deprecated because it is no longer maintained.
9.0.146 236 8/15/2025 9.0.146 is deprecated because it is no longer maintained.
9.0.145 276 8/11/2025 9.0.145 is deprecated because it is no longer maintained.
9.0.144 281 8/8/2025 9.0.144 is deprecated because it is no longer maintained.
9.0.137 246 7/29/2025 9.0.137 is deprecated because it is no longer maintained.
9.0.136 237 7/29/2025 9.0.136 is deprecated because it is no longer maintained.
9.0.135 266 7/28/2025 9.0.135 is deprecated because it is no longer maintained.
9.0.134 296 7/9/2025 9.0.134 is deprecated because it is no longer maintained.
9.0.133 286 7/9/2025 9.0.133 is deprecated because it is no longer maintained.
9.0.132 279 7/9/2025 9.0.132 is deprecated because it is no longer maintained.
9.0.131 295 7/9/2025 9.0.131 is deprecated because it is no longer maintained.
9.0.130 302 7/7/2025 9.0.130 is deprecated because it is no longer maintained.