UmbrellaFrame.ModelSync.SQLite 1.3.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package UmbrellaFrame.ModelSync.SQLite --version 1.3.0
                    
NuGet\Install-Package UmbrellaFrame.ModelSync.SQLite -Version 1.3.0
                    
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="UmbrellaFrame.ModelSync.SQLite" Version="1.3.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="UmbrellaFrame.ModelSync.SQLite" Version="1.3.0" />
                    
Directory.Packages.props
<PackageReference Include="UmbrellaFrame.ModelSync.SQLite" />
                    
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 UmbrellaFrame.ModelSync.SQLite --version 1.3.0
                    
#r "nuget: UmbrellaFrame.ModelSync.SQLite, 1.3.0"
                    
#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 UmbrellaFrame.ModelSync.SQLite@1.3.0
                    
#: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=UmbrellaFrame.ModelSync.SQLite&version=1.3.0
                    
Install as a Cake Addin
#tool nuget:?package=UmbrellaFrame.ModelSync.SQLite&version=1.3.0
                    
Install as a Cake Tool

ModelSync

ModelSync

NuGet CI License

ModelSync is a schema and migration toolkit for .NET projects that want explicit database changes without adopting a full ORM. It generates provider-specific DDL from attributed C# models, compares models with live databases, runs ordered SQL migrations, synchronizes stored procedures, and produces deployment reports.

Current version: 1.3.0

What's New in 1.3.0

Version 1.3.0 adds reviewable migration reports, a safer CLI workflow, stronger model analyzers, and clearer provider support boundaries. Existing generator and migration APIs remain available.

Choose A Workflow

Goal API
Generate table SQL from a model TableGenerator
Compare models with a live database ModelSynchronizer
Run ordered SQL files with history MigrationRunner
Synchronize procedure files StoredProcedureSynchronizer
Validate, preview, and run from CI modelsync CLI

Install

Install the provider you need. Core is included automatically.

dotnet add package UmbrellaFrame.ModelSync.SqlServer --version 1.3.0
dotnet add package UmbrellaFrame.ModelSync.MySql --version 1.3.0
dotnet add package UmbrellaFrame.ModelSync.PostgreSQL --version 1.3.0
dotnet add package UmbrellaFrame.ModelSync.SQLite --version 1.3.0
dotnet add package UmbrellaFrame.ModelSync.Analyzers --version 1.3.0

UmbrellaFrame.ModelSync.Oracle is a preview provider for table DDL and partial safe model synchronization. Its migration runner, routine synchronization, reset, and native lock features are not production-ready.

Quick Start

using UmbrellaFrame.ModelSync.Core;
using UmbrellaFrame.ModelSync.SqlServer;

[SqlServerTableName("Products")]
public sealed class Product
{
    [SqlServerColumnType(SqlServerColumnType.INT)]
    [SqlServerColumnPrimaryKey(isAutoIncrement: true)]
    public int Id { get; set; }

    [SqlServerColumnType(SqlServerColumnType.NVARCHAR, "200")]
    [SqlServerColumnNotNull]
    [DbColumnIndex("IX_Products_Name")]
    public string Name { get; set; } = string.Empty;
}

var generator = new SqlServerTableGenerator(connectionString);
var sql = generator.GenerateSqlServerTable<Product>(ifNotExists: true);

Console.WriteLine(sql);
await generator.CreateTablesAsync();

Generate first, inspect the SQL, then execute. Destructive methods require explicit approval:

var allow = DestructiveOperationOptions.Allow();
generator.DropColumn<Product>("LegacyCode", allow);
generator.AlterColumnType<Product>("Price", allow);
await generator.DropTablesAsync(allow);

Live Model Comparison

var options = new SqlServerModelSyncOptions
{
    ConnectionString = connectionString,
    DefaultSchema = "app",
    HistorySchema = "sec"
};

var result = await SqlServerModelSynchronizer
    .FromAssemblies(options, typeof(Product).Assembly)
    .CompareAsync(cancellationToken);

// Review AutomaticOperations, ManualOperations, SkippedOperations,
// and BlockedOperations before applying.
await result.ApplyAsync(cancellationToken);

Safe additive operations can be automatic. Drop, rename, narrowing, and risky nullability changes are reported instead of silently executed.

Ordered Migrations

var runner = new SqlServerMigrationRunner(connectionString);

runner.RegisterScriptFile("Database/Scripts/Tables/001_CreateProducts.sql");
runner.RegisterScriptFile("Database/Scripts/StoredProcedures/010_GetProducts.sql");
runner.RegisterScriptFile("Database/Scripts/Seeds/020_DefaultProducts.sql");

var plan = await runner.CompareRegisteredAsync(cancellationToken); // read-only
var result = await runner.RunWithResultAsync(cancellationToken);

Scripts run in this order:

Tables -> StoredProcedures -> Triggers -> Seeds -> CustomSql

History rows and SQL hashes make repeat runs predictable. Registered SQL files are trusted project artifacts; do not build them from user input.

CLI And Reports

dotnet tool install --global UmbrellaFrame.ModelSync.Cli --version 1.3.0

Pass secrets through an environment variable instead of a process argument:

export MODELSYNC_CONNECTION_STRING='Data Source=modelsync-preview.db'

modelsync validate --scripts ./Database/Scripts

modelsync run \
  --provider sqlite \
  --connection-env MODELSYNC_CONNECTION_STRING \
  --scripts ./Database/Scripts \
  --dry-run

modelsync run \
  --provider sqlite \
  --connection-env MODELSYNC_CONNECTION_STRING \
  --scripts ./Database/Scripts \
  --apply \
  --report-md ./artifacts/modelsync-report.md \
  --report-json ./artifacts/modelsync-report.json

--apply is required for mutation. Ctrl+C is forwarded to the migration operation. The inline --connection option is retained for compatibility but may be visible in process listings.

Safety Notes

  • ModelSync is not an ORM and does not provide entity tracking, LINQ, or runtime CRUD.
  • Compare APIs are read-only; infrastructure is created by explicit mutation APIs.
  • DbColumnDefault, DbColumnCheck, and migration scripts contain reviewed SQL and must not use untrusted input.
  • Prefer a deployment-time migration job. If startup migration is unavoidable, keep provider-native locking enabled.
  • Database reset requires explicit destructive approval, an expected database name, environment validation, and system-database protection.
  • SQL Server can optionally back up a database before reset.

Provider Snapshot

Feature SQL Server MySQL/MariaDB PostgreSQL SQLite Oracle preview
Table DDL Yes Yes Yes Yes Yes
Safe model sync Yes Yes Yes Yes Partial
Migration runner Yes Yes Yes Yes No
Stored procedures Yes Yes Yes No No
Native migration lock Yes Yes Yes Write lock No

Documentation

MIT © UmbrellaFrame

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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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. 
.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
1.5.1 149 8/9/2026
1.5.0 115 8/9/2026
1.4.0 133 7/18/2026
1.4.0-rc.1 81 7/18/2026
1.3.0 126 7/15/2026
1.2.3 123 7/11/2026
1.2.2 134 7/1/2026
1.2.0 142 6/29/2026
1.1.0 138 6/29/2026
1.0.8 134 6/28/2026
1.0.7 132 6/24/2026
1.0.5 130 6/19/2026
1.0.4 127 5/22/2026
1.0.2 122 5/14/2026

ModelSync 1.3.0 adds migration dry-runs, Markdown/JSON reports, clearer provider support, and a safer CLI workflow.