Skip to content
Simple database schema maintenance (migrations) for .NET designed for any database engine
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.build
DbKeeperNet.DotNet.Cli
DbKeeperNet.Engine.Tests.Full
DbKeeperNet.Engine.Tests
DbKeeperNet.Engine
DbKeeperNet.Extensions.AspNetRolesAndMembership.Tests
DbKeeperNet.Extensions.AspNetRolesAndMembership
DbKeeperNet.Extensions.Firebird.Tests
DbKeeperNet.Extensions.Firebird
DbKeeperNet.Extensions.MsSqlMembershipAndRolesSetup
DbKeeperNet.Extensions.Mysql.Tests
DbKeeperNet.Extensions.Mysql
DbKeeperNet.Extensions.Pgsql.Tests
DbKeeperNet.Extensions.Pgsql
DbKeeperNet.Extensions.SQLite.Tests
DbKeeperNet.Extensions.SQLite
DbKeeperNet.Extensions.SqlServer.Tests
DbKeeperNet.Extensions.SqlServer
demos
.gitattributes
.gitignore
Changelog.txt
DbKeeperNet.Extensions.AspNetRolesAndMembership.nuspec
DbKeeperNet.Extensions.MsSqlMembershipAndRolesSetup.nuspec
DbKeeperNet.sln
DbKeeperNet.snk
Jenkinsfile
LICENSE
README.md
TODO.md
build.msbuild

README.md

Gitter char Build Status

DbKeeperNet

DbKeeperNet is a handy .Net Standard 2.0 (.NET 4.6.1+ and .NET Core 2.0+) component designed to offer users a simple, easy to use ADO.NET platform for distribution of relational database schema updates / changes (database schema updater, RDBMS schema distribution tool).

It servers as an alternative for database migrations on projects where EF (Entity Framework) is not used.

You can use it freely in both commercial and non-commercial applications as you need.

Support for different database engines:

  • MSSQL 2000, MSSQL 2005, MSSQL 2008, MSSQL 2012 (including SQL EXPRESS).
  • MySql Connector .NET support
  • PostgreSQL (Npgsql connector)
  • SQLite ADO.NET
  • Oracle Support (.NET built-in Oracle client or Oracle.ManagedDataAccess.Client)
  • Firebird 2.5

Other features:

  • Allows .NET custom steps to be executed during the upgrade
  • Database upgrade/migration described in a XML validated via a schema
  • You have your database upgrade fully under your control
  • Support for Asp.NET membership and role management
  • Fully compatible with MONO 4.5, .NET 2.0+
  • Easily extensible for new features

Getting started

  • First create an XML database upgrade script (see demos\FullFrameworkConsoleApp\DatabaseUpgrade.xml for an example)
    • In demos folder you can find additional examples for various usage scenarios
  • Install necessary nuget packages (like DbKeeperNet.Extensions.SQLite)
  • Register depedencies in dependency injection
  • Resolve IDatabaseUpdater and call its ExecuteUpgrade() method
const string connectionString = "Data Source=fullframeworkdemo.db3";

var serviceCollection = new ServiceCollection();
serviceCollection.AddDbKeeperNet(c =>
{
    c
    .UseSQLite(connectionString)
    .AddEmbeddedResourceScript("FullFrameworkConsoleApp.DatabaseUpgrade.xml,FullFrameworkConsoleApp");
});
serviceCollection.AddLogging(c => { c.AddConsole(); });

var serviceProvider = serviceCollection.BuildServiceProvider(true);

using (var scope = serviceProvider.CreateScope())
{
    var upgrader = scope.ServiceProvider.GetService<IDatabaseUpdater>();
    upgrader.ExecuteUpgrade();
}

using (var c = new SqliteConnection(connectionString))
{
    c.Open();

    DbCommand cmd = c.CreateCommand();
    cmd.CommandText = "select * from DbKeeperNet_SimpleDemo";
    DbDataReader reader = cmd.ExecuteReader();
    while (reader.Read())
        Console.WriteLine("{0}: {1}", reader[0], reader[1]);
}

Using dotnet CLI to manage database upgrades

  • Installing dotnet cli
dotnet tool install -g dotnet-dbkeepernet
  • Adding new XML script
dotnet dbkeepernet new -v 3.1 -a Test.xx Script.xml
You can’t perform that action at this time.