AspireC4.EntityFrameworkCore.ModelDump 17.0.0

dotnet add package AspireC4.EntityFrameworkCore.ModelDump --version 17.0.0
                    
NuGet\Install-Package AspireC4.EntityFrameworkCore.ModelDump -Version 17.0.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="AspireC4.EntityFrameworkCore.ModelDump" Version="17.0.0">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AspireC4.EntityFrameworkCore.ModelDump" Version="17.0.0" />
                    
Directory.Packages.props
<PackageReference Include="AspireC4.EntityFrameworkCore.ModelDump">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
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 AspireC4.EntityFrameworkCore.ModelDump --version 17.0.0
                    
#r "nuget: AspireC4.EntityFrameworkCore.ModelDump, 17.0.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 AspireC4.EntityFrameworkCore.ModelDump@17.0.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=AspireC4.EntityFrameworkCore.ModelDump&version=17.0.0
                    
Install as a Cake Addin
#tool nuget:?package=AspireC4.EntityFrameworkCore.ModelDump&version=17.0.0
                    
Install as a Cake Tool

AspireC4.EntityFrameworkCore.ModelDump

NuGet version

Writes your real Entity Framework Core model to obj/ on every build, so the AspireC4 ER diagram shows what EF builds: conventions, value converters, IEntityTypeConfiguration<T> classes, composite foreign keys, fluently configured complex and owned types (ComplexProperty, OwnsOne, OwnsMany, ToJson), explicit column types and string-converted enums included. Inheritance mapping, delete behaviour, sequences and check constraints are not shown.

This package is optional. It is a companion to AspireC4.Hosting.EntityFrameworkCore, which goes in the AppHost and does the drawing. Start there if you have not set up the ER diagram yet.

When to use it

The AppHost can already read your contexts without this package, either from assembly metadata or from the AspireC4.EntityFrameworkCore source generator. Both read the model statically, so neither sees configuration applied at runtime (ApplyConfigurationsFromAssembly, value converters) or relationships configured only fluently. This package builds the model the same way your application does, so the dump is always preferred when it is present.

Installation

1. Add the package to the project that owns the EF Core provider

That is the project that references Microsoft.EntityFrameworkCore.SqlServer, Npgsql.EntityFrameworkCore.PostgreSQL or similar. It can be the service registered in the AppHost or a persistence library the service references.

dotnet add package AspireC4.EntityFrameworkCore.ModelDump

The reference is the opt-in. The package is a development dependency, so it adds nothing to your build output or to the projects that reference yours.

The dump tool itself targets net10.0 and is invoked as dotnet <tool>.dll in an MSBuild Exec after Build. It rolls forward to the latest installed major runtime, so the .NET 11 SDK's runtime is enough, and a project that builds net11.0 can be loaded. A build that cannot run the tool simply produces no dump (the target is ContinueOnError); the AppHost then falls back to the other sources. See the requirements page.

2. Make sure the project has a design-time factory

The dump creates each context through IDesignTimeDbContextFactory<T>, which is the same entry point dotnet ef uses. You may already have one for migrations. If not, add one for each context:

using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;

public sealed class OrdersDbContextFactory : IDesignTimeDbContextFactory<OrdersDbContext>
{
    public OrdersDbContext CreateDbContext(string[] args)
    {
        var options = new DbContextOptionsBuilder<OrdersDbContext>()
            // The database is never opened, so any syntactically valid connection string works.
            .UseNpgsql("Host=localhost;Database=orders")
            .Options;

        return new OrdersDbContext(options);
    }
}

A project with no design-time factory dumps nothing, and the AppHost falls back to the other sources.

3. Build

The dump runs automatically after every build. The AppHost picks it up the next time it starts, from the registered project and from every project it references.

What it writes

The dump is written to obj/aspirec4/ef/, one JSON file per context. That directory is never copied to bin/ or publish/, and obj/ is normally ignored by git. The dump leaves nothing in your deployment or your repository.

The AppHost ignores a dump that is older than the built assembly, so a stale dump is never shown.

The dump also records each table's and column's description sources for the diagram's optional description column: the display attributes, the database comment (including ToTable(t => t.HasComment(…)), which only the built model can see), and the XML <summary>. The summary is read from the documentation file beside the assembly, so set <GenerateDocumentationFile>true</GenerateDocumentationFile> to include it. See ER Diagram Styling.

MSBuild properties

Property Default Description
AspireC4EfModelDumpConnectionString (empty) Passed to the factory as --connection=<value> in args, for a factory that reads its connection string from there
AspireC4EfModelDumpOutputDir $(BaseIntermediateOutputPath)aspirec4/ef/ Where the dump is written. Change it only if your obj/ layout is custom
<PropertyGroup>
  <AspireC4EfModelDumpConnectionString>Host=localhost;Database=orders</AspireC4EfModelDumpConnectionString>
</PropertyGroup>

A dump failure never fails your build. The target runs with ContinueOnError, and the AppHost uses the next best source instead.

More information

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

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
17.0.0 112 11/26/2026
17.0.0-prerelease.4 62 11/22/2026
17.0.0-prerelease.3 68 11/21/2026
17.0.0-prerelease.2 93 11/20/2026
17.0.0-prerelease.1 106 11/19/2026
13.6.5 104 11/16/2026
13.6.5-preview.1 86 11/12/2026
13.6.4-preview.3 73 11/8/2026
13.6.4-preview.2 113 10/31/2026
13.6.4-preview.1 91 10/29/2026
13.6.0-preview.4 82 10/27/2026
13.6.0-preview.3 100 10/24/2026
13.6.0-preview.2 84 10/22/2026
13.6.0-preview.1 83 10/18/2026