BrandUp.Extensions.Migrations 10.0.6

dotnet add package BrandUp.Extensions.Migrations --version 10.0.6
                    
NuGet\Install-Package BrandUp.Extensions.Migrations -Version 10.0.6
                    
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="BrandUp.Extensions.Migrations" Version="10.0.6" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="BrandUp.Extensions.Migrations" Version="10.0.6" />
                    
Directory.Packages.props
<PackageReference Include="BrandUp.Extensions.Migrations" />
                    
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 BrandUp.Extensions.Migrations --version 10.0.6
                    
#r "nuget: BrandUp.Extensions.Migrations, 10.0.6"
                    
#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 BrandUp.Extensions.Migrations@10.0.6
                    
#: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=BrandUp.Extensions.Migrations&version=10.0.6
                    
Install as a Cake Addin
#tool nuget:?package=BrandUp.Extensions.Migrations&version=10.0.6
                    
Install as a Cake Tool

BrandUp.Extensions.Migrations

Installation

NuGet-package: https://www.nuget.org/packages/BrandUp.Extensions.Migrations/

Architecture

ExampleLib1 assembly
	ExampleLib1.SetupMigration
	ExampleLib1.Update1Migration
	ExampleLib1.Update2Migration
ExampleLib2 assembly
	ExampleLib2.SetupMigration
	ExampleLib2.Update1Migration
	ExampleLib2.Update2Migration
MyApp assembly
	MyApp.SetupMigration
	MyApp.CreateIndexesMigration
	MyApp.DefaultUsersMigration

options.AddAssembly(typeof(ExampleLib1.SetupMigration).Assembly);
options.AddAssembly(typeof(ExampleLib2.SetupMigration).Assembly);
options.AddAssembly(typeof(MyApp.SetupMigration).Assembly);

migrationExecutor.UpAsync()

Define migrations

[Setup]
public class SetupMigration : IMigrationHandler
{
	readonly IDbContext dbContext;

	public SetupMigration(IDbContext dbContext)
	{
		this.dbContext = dbContext;
	}

	public Task UpAsync(CancellationToken cancellationToken = default)
	{
		dbContext.Create();		

		return Task.CompletedTask;
	}

	public Task DownAsync(CancellationToken cancellationToken = default)
	{
		dbContext.Delete();		

		return Task.CompletedTask;
	}
}

[Upgrade(typeof(SetupMigration))]
public class Update1Migration : IMigrationHandler
{
	public Task UpAsync(CancellationToken cancellationToken = default)
	{
		return Task.CompletedTask;
	}

	public Task DownAsync(CancellationToken cancellationToken = default)
	{
		return Task.CompletedTask;
	}
}

services.AddScoped<IDbContext, DbContext>();
services.AddMigrations(options => {
	options.AddAssembly(typeof(SetupMigration).Assembly);
});

Up migrations

var migrationExecutor = serviceProvider.GetService<MigrationExecutor>();
migrationExecutor.UpAsync();

Down migrations

var migrationExecutor = serviceProvider.GetService<MigrationExecutor>();
migrationExecutor.DownAsync();

Store migration state

public interface IMigrationState
{
	Task<bool> IsAppliedAsync(IMigrationDefinition migrationDefinition, CancellationToken cancellationToken = default);
	Task SetUpAsync(IMigrationDefinition migrationDefinition, CancellationToken cancellationToken = default);
	Task SetDownAsync(IMigrationDefinition migrationDefinition, CancellationToken cancellationToken = default);
}
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 (1)

Showing the top 1 NuGet packages that depend on BrandUp.Extensions.Migrations:

Package Downloads
BrandUp.Pages.MongoDb

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
10.0.6 122 5/28/2026
10.0.5 150 4/27/2026
10.0.4 137 4/20/2026
10.0.3 206 3/16/2026
10.0.2 135 3/11/2026
10.0.1 196 1/3/2026
9.0.3 649 6/10/2025
9.0.2 316 3/29/2025
9.0.1 272 12/22/2024
8.1.1 412 7/9/2024
8.0.4 371 4/29/2024
8.0.3 252 4/29/2024
8.0.2 232 4/29/2024
8.0.1 237 4/29/2024
7.0.3 999 3/11/2023
7.0.2 549 2/13/2023
7.0.1 712 11/10/2022
2.0.5 2,546 4/25/2022
1.0.0.5 2,157 4/30/2019
1.0.0.4 1,065 4/30/2019
Loading failed