Skip to content

Introduction

Weasel is a set of .NET libraries for database schema management and ADO.NET helpers. It gives you a programmatic API for defining database objects like tables, indexes, foreign keys, sequences, and functions, then handles the heavy lifting of detecting differences between your code-defined schema and the actual database, generating DDL, and applying migrations.

Origin and the Critter Stack

Weasel was extracted from the Marten project during its V4 development cycle. What started as Marten's internal schema management layer is now a standalone, general-purpose library and a foundational part of the Critter Stack -- the family of .NET libraries that includes Marten, Wolverine, and Polecat.

Weasel is developed and maintained by JasperFx Software.

Key Capabilities

  • Programmatic schema definitions -- Define tables, columns, indexes, foreign keys, sequences, functions, and views in C# code
  • Automatic delta detection -- Compare your expected schema against the actual database state and compute the minimal set of changes needed
  • DDL generation -- Generate CREATE, ALTER, and DROP statements for any supported database engine
  • Schema migration -- Apply detected changes automatically or review them before execution
  • CLI migration tools -- Command-line interface for asserting schema validity, applying patches, and dumping DDL
  • EF Core integration -- Use Weasel's migration infrastructure alongside Entity Framework Core

Supported Databases

DatabasePackage
PostgreSQLWeasel.Postgresql
SQL ServerWeasel.SqlServer
OracleWeasel.Oracle
MySQLWeasel.MySql
SQLiteWeasel.Sqlite

NuGet Packages

PackageDescription
Weasel.CoreCore abstractions and migration infrastructure
Weasel.PostgresqlPostgreSQL provider (Npgsql)
Weasel.SqlServerSQL Server provider (Microsoft.Data.SqlClient)
Weasel.OracleOracle provider (Oracle.ManagedDataAccess.Core)
Weasel.MySqlMySQL provider
Weasel.SqliteSQLite provider (Microsoft.Data.Sqlite)
Weasel.EntityFrameworkCoreEF Core integration for Weasel migrations

All provider packages automatically reference Weasel.Core, so you only need to install the provider for your database.

Next Steps

Released under the MIT License.