Simple database schema maintenance (migrations) for .NET designed for any database engine
Clone or download
voloda Merge pull request #48 from voloda/Logging
Increase detail of logs when executing an update step
Latest commit 4c0d196 Sep 17, 2018
Permalink
Failed to load latest commit information.
.build Switch over to .net standard 2.0 Aug 31, 2018
DbKeeperNet.Engine.Tests.Full Switch over to .net standard 2.0 Aug 31, 2018
DbKeeperNet.Engine.Tests Rename UseDbKeeperNet to AddDbKeeperNet Sep 1, 2018
DbKeeperNet.Engine Increase detail of logs when executing an update step Sep 16, 2018
DbKeeperNet.Extensions.AspNetRolesAndMembership.Tests Switch over to .net standard 2.0 Aug 31, 2018
DbKeeperNet.Extensions.AspNetRolesAndMembership Switch over to .net standard 2.0 Aug 31, 2018
DbKeeperNet.Extensions.Firebird.Tests Switch over to .net standard 2.0 Aug 31, 2018
DbKeeperNet.Extensions.Firebird Switch over to .net standard 2.0 Aug 31, 2018
DbKeeperNet.Extensions.MsSqlMembershipAndRolesSetup Switch over to .net standard 2.0 Aug 31, 2018
DbKeeperNet.Extensions.Mysql.Tests Switch over to .net standard 2.0 Aug 31, 2018
DbKeeperNet.Extensions.Mysql Switch over to .net standard 2.0 Aug 31, 2018
DbKeeperNet.Extensions.Pgsql.Tests Switch over to .net standard 2.0 Aug 31, 2018
DbKeeperNet.Extensions.Pgsql Switch over to .net standard 2.0 Aug 31, 2018
DbKeeperNet.Extensions.SQLite.Tests Switch over to .net standard 2.0 Aug 31, 2018
DbKeeperNet.Extensions.SQLite Switch over to .net standard 2.0 Aug 31, 2018
DbKeeperNet.Extensions.SqlServer.Tests Switch over to .net standard 2.0 Aug 31, 2018
DbKeeperNet.Extensions.SqlServer Switch over to .net standard 2.0 Aug 31, 2018
demos Update demos Sep 2, 2018
.gitattributes Switch over to .net standard 2.0 Aug 31, 2018
.gitignore Switch over to .net standard 2.0 Aug 31, 2018
Changelog.txt Switch over to .net standard 2.0 Aug 31, 2018
DbKeeperNet.Extensions.AspNetRolesAndMembership.nuspec ASP.NET Roles & membership packages Sep 2, 2018
DbKeeperNet.Extensions.MsSqlMembershipAndRolesSetup.nuspec ASP.NET Roles & membership packages Sep 2, 2018
DbKeeperNet.sln Switch over to .net standard 2.0 Aug 31, 2018
DbKeeperNet.snk Strong name key Aug 26, 2009
Jenkinsfile ASP.NET Roles & membership packages Sep 2, 2018
LICENSE Switch over to .net standard 2.0 Aug 31, 2018
README.md Update README.md Sep 4, 2018
TODO.md Switch over to .net standard 2.0 Aug 31, 2018
build.msbuild Switch over to regular release Sep 10, 2018

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]);
}