SmartTableSync 0.5.4

dotnet add package SmartTableSync --version 0.5.4
                    
NuGet\Install-Package SmartTableSync -Version 0.5.4
                    
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="SmartTableSync" Version="0.5.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SmartTableSync" Version="0.5.4" />
                    
Directory.Packages.props
<PackageReference Include="SmartTableSync" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SmartTableSync --version 0.5.4
                    
#r "nuget: SmartTableSync, 0.5.4"
                    
#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.
#:package SmartTableSync@0.5.4
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SmartTableSync&version=0.5.4
                    
Install as a Cake Addin
#tool nuget:?package=SmartTableSync&version=0.5.4
                    
Install as a Cake Tool

SmartTableSync

A self-configuring .NET engine that keeps tables synchronized from one SQL database to another (parent to child). Give it table names: it inspects each table's schema, picks how to detect changes and how to merge them, and keeps the child up to date on the schedule your host chooses.

Built for Azure SQL Database, where it runs in production, and works with Azure SQL Managed Instance and SQL Server (on-premises or in a VM) in any combination.

What it does

  • Syncs the tables you list, one way: inserts, updates and deletes.
  • Chooses per table how to find changed rows: SQL Server Change Tracking, a rowversion column, a timestamp column, or a full re-scan for small tables.
  • Copies a new table in full once, then only what changed, and resumes where it stopped.
  • Needs no DDL rights at run time and signs in with managed identities or any SQL Server sign-in.
  • Notices schema changes in the parent; in Auto mode it adds new columns to the child by itself.

Install

dotnet add package SmartTableSync

That's the only package you need: it includes every sign-in method, from SQL logins and Windows authentication to managed identities and other Microsoft Entra methods (Authentication=Active Directory ... in the connection string).

Use it

Register the engine and run it on your own schedule, here every 5 minutes in a background service:

using SmartTableSync.Abstractions;
using SmartTableSync.Hosting;

var builder = Host.CreateApplicationBuilder(args);
builder.Services.AddSmartTableSync();
builder.Services.AddHostedService<SyncWorker>();
builder.Build().Run();

public sealed class SyncWorker(ISyncOrchestrator orchestrator) : BackgroundService
{
    protected override async Task ExecuteAsync(CancellationToken stoppingToken)
    {
        using var timer = new PeriodicTimer(TimeSpan.FromMinutes(5));
        do
        {
            await orchestrator.RunAsync(stoppingToken);
        }
        while (await timer.WaitForNextTickAsync(stoppingToken));
    }
}

appsettings.json:

{
  "ParentDbConnectionString": "Server=tcp:myserver.database.windows.net,1433;Database=ParentDb;Authentication=Active Directory Managed Identity;User Id=<client id>;Encrypt=True",
  "ChildDbConnectionString": "Server=tcp:myserver.database.windows.net,1433;Database=ChildDb;Authentication=Active Directory Managed Identity;User Id=<client id>;Encrypt=True",
  "SmartTableSync": {
    "TableList": "Product,Customer,sales.Order",
    "Mode": "Manual"
  }
}

The child database needs a table, a table type and a merge procedure for every synced table. In Manual mode (the default) you create them from the scripts of the SmartTableSync.Scaffold tool; in Auto mode the engine creates them itself with a separate provisioning connection (ChildProvisioningConnectionString).

Hangfire, Quartz.NET and other hosts work the same way: call ISyncOrchestrator.RunAsync from your scheduler. Overlapping runs are safe, also across several instances.

How changes are found

Strategy Used when Deletes reach the child
Change Tracking SQL Server Change Tracking is on for the table on every run
RowVersion the table has a rowversion column at the delete check, hourly by default
Timestamp the table has a UTC datetime column updated on every change (default LastUpdate) at the delete check
Full re-scan none of the above, and the table has up to 50,000 rows at the delete check

Documentation

Feedback

Tried it? Tell me what worked and what didn't: report a bug or ask for a feature, ask a question, or report a security problem privately. Anything else: Ruslan Sidoriako on LinkedIn.

License

Apache License 2.0. See LICENSE and NOTICE.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows 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.5.4 120 10/22/2026
0.5.3 103 10/20/2026
0.5.2 101 10/20/2026
0.5.1 96 10/20/2026
0.5.0 117 10/20/2026
0.5.0-preview.1 76 10/19/2026

SmartTableSync now shows up by name in SQL Server, the quick start explains a reused suffix
instead of failing in Terraform, and there are clear ways to give feedback.

### Added

- SmartTableSync's connections show up in SQL Server as `SmartTableSync`, and the scaffold tool's
 as `SmartTableSync.Scaffold` (`APP_NAME()`, `sys.dm_exec_sessions.program_name`), so a DBA can
 see which sessions are the sync. An `Application Name` in the connection string still wins.
 See [connection strings](docs/configuration.md#connection-strings).
- Issue forms for bugs and feature requests, links to Discussions for questions and for sharing a
 setup, a [contributing guide](CONTRIBUTING.md), and a feedback section in the README and on the
 NuGet package page.

### Changed

- The quick start stops before Terraform, with a clear message, when the suffix's resource group
 already exists but another folder or machine created it. Before, Terraform failed at apply with
 "a resource with the ID ... already exists". The docs say that `acme1` is only an example.
- A connection string that can't be read now stops the sync at startup with a message naming the
 setting (for example *"ChildDbConnectionString isn't a valid connection string"*), instead of at
 the first connection.

### Upgrading

Nothing to change. If you filter SQL Server sessions or audit logs by program name, they now show
`SmartTableSync` instead of SqlClient's default; set `Application Name` in the connection strings
to keep a name of your own.

### Tested

- Unit and integration tests (303 and 74) pass, including new ones that check `APP_NAME()` and
 `sys.dm_exec_sessions.program_name` on a real SQL Server, with and without an `Application
 Name` in the connection string.
- The quick start's suffix check on Azure: it stops for a resource group that exists but isn't in
 the folder's Terraform state, and continues for a new suffix, a deleted one, and the folder's own
 deployment.


Full changelog: https://github.com/Sidorus/SmartTableSync/blob/main/CHANGELOG.md