Nabs.Launchpad.Core.SeedData 10.0.180

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Nabs.Launchpad.Core.SeedData --version 10.0.180
                    
NuGet\Install-Package Nabs.Launchpad.Core.SeedData -Version 10.0.180
                    
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.180" />
                    
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.180" />
                    
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.180
                    
#r "nuget: Nabs.Launchpad.Core.SeedData, 10.0.180"
                    
#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.180
                    
#: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.180
                    
Install as a Cake Addin
#tool nuget:?package=Nabs.Launchpad.Core.SeedData&version=10.0.180
                    
Install as a Cake Tool

Nabs Launchpad Core Seed Data Library

A .NET 9 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.

Features

  • Migration Processing: Interface for handling database schema migrations
  • Seed Data Processing: Interface for populating databases with initial or test data
  • Async Support: All operations support cancellation tokens and async patterns
  • Framework Integration: Designed to work seamlessly with dependency injection and hosted services

Core Interfaces

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

Dependencies

  • .NET 9: 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;
}

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.
  • net10.0

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 188 12/30/2025 10.0.209 is deprecated because it is no longer maintained.
10.0.208 153 12/30/2025 10.0.208 is deprecated because it is no longer maintained.
10.0.207 144 12/29/2025 10.0.207 is deprecated because it is no longer maintained.
10.0.206 144 12/29/2025 10.0.206 is deprecated because it is no longer maintained.
10.0.205 230 12/24/2025 10.0.205 is deprecated because it is no longer maintained.
10.0.204 231 12/21/2025 10.0.204 is deprecated because it is no longer maintained.
10.0.203 330 12/18/2025 10.0.203 is deprecated because it is no longer maintained.
10.0.202 335 12/17/2025 10.0.202 is deprecated because it is no longer maintained.
10.0.200 330 12/17/2025 10.0.200 is deprecated because it is no longer maintained.
10.0.199 496 12/10/2025 10.0.199 is deprecated because it is no longer maintained.
10.0.197 218 12/5/2025 10.0.197 is deprecated because it is no longer maintained.
10.0.196 735 12/3/2025 10.0.196 is deprecated because it is no longer maintained.
10.0.195 730 12/3/2025 10.0.195 is deprecated because it is no longer maintained.
10.0.194 710 12/3/2025 10.0.194 is deprecated because it is no longer maintained.
10.0.193 727 12/2/2025 10.0.193 is deprecated because it is no longer maintained.
10.0.192 227 11/28/2025 10.0.192 is deprecated because it is no longer maintained.
10.0.190 237 11/27/2025 10.0.190 is deprecated because it is no longer maintained.
10.0.189 221 11/23/2025 10.0.189 is deprecated because it is no longer maintained.
10.0.187 216 11/23/2025 10.0.187 is deprecated because it is no longer maintained.
10.0.180 344 11/11/2025 10.0.180 is deprecated because it is no longer maintained.
Loading failed