DotNetBrightener.DataAccess.DataMigration
2024.0.14.6-preview-2390101
See the version list below for details.
dotnet add package DotNetBrightener.DataAccess.DataMigration --version 2024.0.14.6-preview-2390101
NuGet\Install-Package DotNetBrightener.DataAccess.DataMigration -Version 2024.0.14.6-preview-2390101
<PackageReference Include="DotNetBrightener.DataAccess.DataMigration" Version="2024.0.14.6-preview-2390101" />
paket add DotNetBrightener.DataAccess.DataMigration --version 2024.0.14.6-preview-2390101
#r "nuget: DotNetBrightener.DataAccess.DataMigration, 2024.0.14.6-preview-2390101"
// Install DotNetBrightener.DataAccess.DataMigration as a Cake Addin #addin nuget:?package=DotNetBrightener.DataAccess.DataMigration&version=2024.0.14.6-preview-2390101&prerelease // Install DotNetBrightener.DataAccess.DataMigration as a Cake Tool #tool nuget:?package=DotNetBrightener.DataAccess.DataMigration&version=2024.0.14.6-preview-2390101&prerelease
Data Migration Library for .NET Core Applications
© 2024 DotNet Brightener
Versions
Package | Version |
---|---|
DotNetBrightener.DataAccess.DataMigration | |
DotNetBrightener.DataAccess.DataMigration.Mssql | |
DotNetBrightener.DataAccess.DataMigration.PostgreSql | |
dotnet-dnb-datamigration |
Overview
Data Migration Library is a simple library to help you manage your data migration in your .NET Core application. It provides a simple way to define your migration classes and run them in your application.
Not all applications can use DACPAC for managing database schema and data changes. Especially DACPAC does not work with other databases such as MySQL, PostgreSQL, etc. This library is designed to help you manage your data migration in your application.
Installation
Install using Package Reference
dotnet add [YOUR_PROJECT_NAME] package DotNetBrightener.DataAccess.DataMigration
If you need to data migration with SQL Server, install the following package: DotNetBrightener.DataAccess.DataMigration.Mssql
dotnet add [YOUR_PROJECT_NAME] package DotNetBrightener.DataAccess.DataMigration.Mssql
For PostgreSQL, install the following package: DotNetBrightener.DataAccess.DataMigration.PostgreSql
dotnet add [YOUR_PROJECT_NAME] package DotNetBrightener.DataAccess.DataMigration.PostgreSql
Usage
Register to Service Collection
// var _connectionString = "<your_connection_string>";
// If you use SQL Server
services.EnableDataMigrations()
.UseSqlServer(_connectionString);
// If you use PostgreSQL
services.EnableDataMigrations()
.UseNpgsql(_connectionString);
// if you want to auto detect all migration classes
services.AutoScanDataMigrators();
// if you want to manually register migration classes
services.AddDataMigrator<MyMigration>();
Define your migration classes
using DotNetBrightener.DataAccess.DataMigration;
[DataMigration("<your_migration_id>")]
public class MyMigration : IDataMigration
{
// You can use Dependency Injection for injecting your services
private readonly IMyService _myService;
public MyMigration(IMyService myService)
{
_myService = myService;
}
public async Task MigrateData()
{
// Your migration code here
await _myService.DoSomethingToMigrateData();
}
}
Roadmap
- Initial Release
- Add Support for SQL Server
- Add Support for PostgreSQL
- CLI tool for creating migration class
CLI Tool
You can now install the cli tool from Nuget: dotnet-dnb-datamigration
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net8.0
- linq2db.EntityFrameworkCore (>= 8.1.0)
- Microsoft.EntityFrameworkCore (>= 8.0.8)
- Microsoft.EntityFrameworkCore.Proxies (>= 8.0.8)
- Microsoft.Extensions.Hosting.Abstractions (>= 8.0.0)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on DotNetBrightener.DataAccess.DataMigration:
Package | Downloads |
---|---|
DotNetBrightener.DataAccess.DataMigration.Mssql
Package Description |
|
DotNetBrightener.DataAccess.DataMigration.PostgreSql
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.