Trellis.Testing.SqlProject 0.1.0-preview.6

This is a prerelease version of Trellis.Testing.SqlProject.
dotnet add package Trellis.Testing.SqlProject --version 0.1.0-preview.6
                    
NuGet\Install-Package Trellis.Testing.SqlProject -Version 0.1.0-preview.6
                    
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="Trellis.Testing.SqlProject" Version="0.1.0-preview.6" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Trellis.Testing.SqlProject" Version="0.1.0-preview.6" />
                    
Directory.Packages.props
<PackageReference Include="Trellis.Testing.SqlProject" />
                    
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 Trellis.Testing.SqlProject --version 0.1.0-preview.6
                    
#r "nuget: Trellis.Testing.SqlProject, 0.1.0-preview.6"
                    
#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 Trellis.Testing.SqlProject@0.1.0-preview.6
                    
#: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=Trellis.Testing.SqlProject&version=0.1.0-preview.6&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Trellis.Testing.SqlProject&version=0.1.0-preview.6&prerelease
                    
Install as a Cake Tool

Trellis.Testing.SqlProject

NuGet Package

Proves a SQL Server database project (DACPAC) matches an EF Core model, and says exactly what differs.

Installation

dotnet add package Trellis.Testing.SqlProject

Quick Example

using Microsoft.EntityFrameworkCore;
using Trellis.Testing.SqlProject;

[Fact]
public void Database_project_matches_the_ef_core_model()
{
    var options = new DbContextOptionsBuilder<AppDbContext>()
        .UseSqlServer("Server=.;Database=Unused") // never connected
        .Options;
    using var context = new AppDbContext(options);

    DatabaseProjectAssert.MatchesModel(
        context,
        Path.Combine(AppContext.BaseDirectory, "MyApp.Database.dacpac"));
}

When the two drift, the failure names the object and both values:

Expected the SQL database project to match the EF Core model, but found 2 difference(s):
  - Column [dbo].[Restaurants].[Location_LocatedIn] is at position 4 in the SQL project but 3 in the EF model
  - [dbo].[Restaurants].[Name].Length: SQL project=200; EF model=100
Update the database project (not EF migrations) when the model changes.

The test project must copy the built .dacpac to its output directory, for example with a ProjectReference to the database project (ReferenceOutputAssembly="false") plus a <None Include="...dacpac" CopyToOutputDirectory="PreserveNewest" /> item.

Why

Teams that keep a SQL project as the schema source of truth and an EF Core model beside it need a test that catches drift. The usual version compares two DACPACs and reports only Change Table: [dbo].[Restaurants], which does not say which column or why. Column order is part of what the project deploys and EF Core orders owned-type columns by declaration, so a column appended to the end of the SQL table fails the check with no hint that order was the cause.

Key Features

  • Plain-language differences — missing, extra, and mismatched columns, indexes, and constraints, each with both values
  • Column positions — is at position 4 in the SQL project but 3 in the EF model
  • No running database — the model side comes from Database.GenerateCreateScript(), so there is no LocalDB or container to start
  • Column order is opt-out — IgnoreColumnOrder = true when order genuinely does not matter
  • Non-default schemas work — EF's dynamic-SQL schema guard is rewritten so DacFx resolves tables in them

AI-native

This package carries an API reference for coding agents. Restoring a package never installs agent instructions. To opt in, restore your consuming project or solution, then run from its Git root:

dotnet new tool-manifest --output .config
dotnet tool install Trellis.AgentDocs --version 0.1.0-preview.19 --tool-manifest .config/dotnet-tools.json
dotnet tool run agentdocs init <solution-or-project>

If the repository already has .config/dotnet-tools.json, reuse it instead of creating another manifest. init lists Trellis.Testing.SqlProject as pending and prints the package IDs to add to approvedPackages in .agentdocs/policy.json. Add it, then run dotnet tool run agentdocs sync to install the reference under Git-root .agentdocs/. The reference is on demand: the generated index describes it, and an agent opens it when its task concerns proving a SQL database project matches an EF Core model. After a package upgrade, run dotnet restore and then dotnet tool run agentdocs sync.

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.1.0-preview.6 68 10/2/2026