DbRewinder 0.0.3

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

// Install DbRewinder as a Cake Tool
#tool nuget:?package=DbRewinder&version=0.0.3                

Test On Push

DbRewinder

Db Rewinder is a time machine for reverting the integration tests data changes. It can be useful if you had integration tests that changes another integration tests data causing it to fail if running it in wrong order.

How it works

  1. When you call the install method, the service will generate a table to store reversion SQL commands for every database change.
  2. Then it will generate triggers for every table. These triggers will store in the previous generated table the commands for reversion.
  3. When you call rewind all reverse commands in that table will run, reverting all previous changes.

Suported Databases and Providers

Only MySql 8 with MysqlConnector has been tested.

Using it

Setup

  • You can setup it directly using the factory:
    var rewindService = DbRewinderServiceFactory.GetSyncService(DbRewinderProviderType.MySql,
        () => ContainerInstance.GetService<ICoreDbContext>().Database.GetDbConnection());

    // Or the async version:

    var rewindService = DbRewinderServiceFactory.GetAsyncService(DbRewinderProviderType.MySql,
        () => ContainerInstance.GetService<ICoreDbContext>().Database.GetDbConnection());

  • You can use it with Dependency Injection:

    serviceCollection.ConfigureRewinder(config => config
        .AddProvider(DbRewinderProviderType.MySql, serviceProvider => serviceProvider.GetService<IMyDbContext>().Database.GetConnection())
        .AddProvider(DbRewinderProviderType.MySql, _ => new MySqlConnection(connectionString2)));

    ...

    var syncService = serviceProvider.GetService<IDbRewinderSyncService>();
    
    //or
    
    var asyncService = serviceProvider.GetService<IDbRewinderAsyncService>();

  • Before start using the service you must run the install method once

    rewindService.Install();

Using

    
    rewindService.Install();

    // Do some changes

    rewindService.CreateCheckpoint("My Checkpoint 1"); 

    // Do some more changes

    rewindService.Rewind("My Checkpoint 1"); 

    // Do some more changes

    rewindService.CreateCheckpoint("My Checkpoint 2"); 

    // Do some more changes

    rewindService.Rewind(); // this will rewind all data changes since install call, 

Licence

MIT

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  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 netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.0.3 308 2/10/2023
0.0.2 260 2/10/2023
0.0.1 257 2/7/2023
0.0.0 22,619 2/6/2023