Giter VIP home page Giter VIP logo

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

dbkeepernet's Projects

dbkeepernet icon dbkeepernet

Simple database schema maintenance (migrations) for .NET designed for any database engine

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.