Nabs.Launchpad.Core.SeedData 10.0.209

Prefix Reserved
dotnet add package Nabs.Launchpad.Core.SeedData --version 10.0.209
                    
NuGet\Install-Package Nabs.Launchpad.Core.SeedData -Version 10.0.209
                    
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.209" />
                    
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.209" />
                    
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.209
                    
#r "nuget: Nabs.Launchpad.Core.SeedData, 10.0.209"
                    
#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.209
                    
#: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.209
                    
Install as a Cake Addin
#tool nuget:?package=Nabs.Launchpad.Core.SeedData&version=10.0.209
                    
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

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
10.0.209 149 12/30/2025 10.0.209 is deprecated because it is no longer maintained.
10.0.208 123 12/30/2025 10.0.208 is deprecated because it is no longer maintained.
10.0.207 116 12/29/2025 10.0.207 is deprecated because it is no longer maintained.
10.0.206 114 12/29/2025 10.0.206 is deprecated because it is no longer maintained.
10.0.205 199 12/24/2025 10.0.205 is deprecated because it is no longer maintained.
10.0.204 198 12/21/2025 10.0.204 is deprecated because it is no longer maintained.
10.0.203 298 12/18/2025 10.0.203 is deprecated because it is no longer maintained.
10.0.202 301 12/17/2025 10.0.202 is deprecated because it is no longer maintained.
10.0.200 302 12/17/2025 10.0.200 is deprecated because it is no longer maintained.
10.0.199 462 12/10/2025 10.0.199 is deprecated because it is no longer maintained.
10.0.197 189 12/5/2025 10.0.197 is deprecated because it is no longer maintained.
10.0.196 701 12/3/2025 10.0.196 is deprecated because it is no longer maintained.
10.0.195 700 12/3/2025 10.0.195 is deprecated because it is no longer maintained.
10.0.194 685 12/3/2025 10.0.194 is deprecated because it is no longer maintained.
10.0.193 695 12/2/2025 10.0.193 is deprecated because it is no longer maintained.
10.0.192 194 11/28/2025 10.0.192 is deprecated because it is no longer maintained.
10.0.190 208 11/27/2025 10.0.190 is deprecated because it is no longer maintained.
10.0.189 185 11/23/2025 10.0.189 is deprecated because it is no longer maintained.
10.0.187 186 11/23/2025 10.0.187 is deprecated because it is no longer maintained.
10.0.186 185 11/23/2025 10.0.186 is deprecated because it is no longer maintained.
10.0.184 430 11/20/2025 10.0.184 is deprecated because it is no longer maintained.
10.0.181-rc3 302 11/11/2025 10.0.181-rc3 is deprecated because it is no longer maintained.
10.0.180 313 11/11/2025 10.0.180 is deprecated because it is no longer maintained.
10.0.179-rc2 293 11/11/2025 10.0.179-rc2 is deprecated because it is no longer maintained.
10.0.178-rc2 255 11/10/2025 10.0.178-rc2 is deprecated because it is no longer maintained.
10.0.177-rc2 251 11/10/2025 10.0.177-rc2 is deprecated because it is no longer maintained.
10.0.176-rc2 217 11/6/2025 10.0.176-rc2 is deprecated because it is no longer maintained.
10.0.175-rc2 216 11/6/2025 10.0.175-rc2 is deprecated because it is no longer maintained.
10.0.174-rc2 203 11/5/2025 10.0.174-rc2 is deprecated because it is no longer maintained.
10.0.173-rc2 231 11/3/2025 10.0.173-rc2 is deprecated because it is no longer maintained.
10.0.172-rc2 228 11/2/2025 10.0.172-rc2 is deprecated because it is no longer maintained.
10.0.170-rc2 209 11/1/2025 10.0.170-rc2 is deprecated because it is no longer maintained.
10.0.169-rc2 210 11/1/2025 10.0.169-rc2 is deprecated because it is no longer maintained.
10.0.168-rc2 206 10/31/2025 10.0.168-rc2 is deprecated because it is no longer maintained.
10.0.166-rc2 213 10/31/2025 10.0.166-rc2 is deprecated because it is no longer maintained.
10.0.164-rc2 284 10/28/2025 10.0.164-rc2 is deprecated because it is no longer maintained.
10.0.162-rc2 277 10/24/2025 10.0.162-rc2 is deprecated because it is no longer maintained.
10.0.161 281 10/24/2025 10.0.161 is deprecated because it is no longer maintained.
9.0.151 224 10/17/2025 9.0.151 is deprecated because it is no longer maintained.
9.0.150 297 9/10/2025 9.0.150 is deprecated because it is no longer maintained.
9.0.146 241 8/15/2025 9.0.146 is deprecated because it is no longer maintained.
9.0.145 281 8/11/2025 9.0.145 is deprecated because it is no longer maintained.
9.0.144 284 8/8/2025 9.0.144 is deprecated because it is no longer maintained.
9.0.137 249 7/29/2025 9.0.137 is deprecated because it is no longer maintained.
9.0.136 243 7/29/2025 9.0.136 is deprecated because it is no longer maintained.
9.0.135 269 7/28/2025 9.0.135 is deprecated because it is no longer maintained.
9.0.134 301 7/9/2025 9.0.134 is deprecated because it is no longer maintained.
9.0.133 293 7/9/2025 9.0.133 is deprecated because it is no longer maintained.
9.0.132 285 7/9/2025 9.0.132 is deprecated because it is no longer maintained.
9.0.131 303 7/9/2025 9.0.131 is deprecated because it is no longer maintained.
9.0.130 310 7/7/2025 9.0.130 is deprecated because it is no longer maintained.