VivaVictoria.Chaos.DapperMigrator 1.1.1

dotnet add package VivaVictoria.Chaos.DapperMigrator --version 1.1.1
NuGet\Install-Package VivaVictoria.Chaos.DapperMigrator -Version 1.1.1
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="VivaVictoria.Chaos.DapperMigrator" Version="1.1.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add VivaVictoria.Chaos.DapperMigrator --version 1.1.1
#r "nuget: VivaVictoria.Chaos.DapperMigrator, 1.1.1"
#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.
// Install VivaVictoria.Chaos.DapperMigrator as a Cake Addin
#addin nuget:?package=VivaVictoria.Chaos.DapperMigrator&version=1.1.1

// Install VivaVictoria.Chaos.DapperMigrator as a Cake Tool
#tool nuget:?package=VivaVictoria.Chaos.DapperMigrator&version=1.1.1

Chaos.Dapper

IMigrator implementation for Data Mapper Dapper library. Supports all databases supported by Dapper.

Communication

This library provider IDatabaseDriver interface. This interface should be implemented to provide Dapper valid IDbConnection and create/insert/select statements for migration metadata table.

Install

Install via nuget.

Usage

var services = new ServiceCollection();
services.AddChaosDapper<MyMetadata>();

It defines DapperMigrator and specified MyMetadata class for Chaos. Insteadof MyMetadata you should use your IMetadata class, supported by IDatabaseDriver.

Extension

  1. Create new IDatabaseDriver implementation. Your implementation can require specified Metadata implementation:
public class MyMetadata : IMetadata
{
    public string TableName { get; }
    public string IdColumnName { get; }
    public string IdColumnType { get; }
    public string StateColumnName { get; }
    public string StateColumnType { get; }
    public string VersionColumnName { get; }
    public string VersionColumnType { get; }
    public string DateColumnName { get; }
    public string DateColumnType { get; }
}

public class MyDriver : IDatabaseDriver<MyMetadata>
{
    /*
     * Use connection string and metadata model to create connection. You can store
     * in metadata runtime-dependent connection parameters and use it for providing 
     * correct connection. For example, Postgres uses Schema from metadata to specify
     * NpgsqlConnection SearchPath.
     */
    public IDbConnection Connect(string connectionString, MyMetadata metadata) =>
        new MyDbConnection(connectionString);
       
    /*
     * Not all RDBMS supports transactions or supports their functional not fully or in custom format.
     * For example, Clickhouse does not support transactions and always returns false from this method.
     */ 
    public bool IsTransactionSupported();
    
    /*
     * Create raw sql script for creating metadata table and other infrastructure.
     * For example, SqlServer and Postgres creates requested Schema before creating table.
     * Use provided metadata instance to determine table and column parameters like name, type or constraints
     */
    public string CreateStatement(MyMetadata metadata);
    
    /*
     * Returns raw dapper-style sql script for inserting metadata info into table.
     * You can use any params via @Param keys, but you need to define all required params
     * in InsertParameters method.
     * Default params dateTime, version and state. They are required and should be used always.
     */
    public string InsertStatement(MyMetadata metadata);
    
    /*
     * Returns params for InsertStatement script in any supported by Dapper format: POCOs, dynamic, etc
     */
    public object InsertParameters(DateTime dateTime, long version, MigrationState state);
    
    /*
     * Returns sql script for receiving latest metadata info. Should returns from DB two values:
     * Version as int64 number,
     * State as any Enum-convertible value, recommended int or int8/int16/int32/int64
     */
    public string SelectStatement(MyMetadata metadata);
}
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
.NET Core netcoreapp3.1 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on VivaVictoria.Chaos.DapperMigrator:

Package Downloads
VivaVictoria.Chaos.SqlServer

MS SqlServer Migrator for Chaos tool. Based on Chaos.Dapper and System.Data.SqlClient.

VivaVictoria.Chaos.Postgres

PostgreSQL Migrator for Chaos tool. Based on Chaos.Dapper and Npgsql.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.1 1,157 10/17/2021
1.1.1-preview 807 10/7/2021
1.1.0 1,065 10/7/2021