D2Lang.EntityFrameworkCore
1.1.0
dotnet add package D2Lang.EntityFrameworkCore --version 1.1.0
NuGet\Install-Package D2Lang.EntityFrameworkCore -Version 1.1.0
<PackageReference Include="D2Lang.EntityFrameworkCore" Version="1.1.0" />
<PackageVersion Include="D2Lang.EntityFrameworkCore" Version="1.1.0" />
<PackageReference Include="D2Lang.EntityFrameworkCore" />
paket add D2Lang.EntityFrameworkCore --version 1.1.0
#r "nuget: D2Lang.EntityFrameworkCore, 1.1.0"
#:package D2Lang.EntityFrameworkCore@1.1.0
#addin nuget:?package=D2Lang.EntityFrameworkCore&version=1.1.0
#tool nuget:?package=D2Lang.EntityFrameworkCore&version=1.1.0
D2Lang.EntityFrameworkCore
Generate a D2 SQL-table diagram directly from an Entity Framework Core relational model.
Install
dotnet add package D2Lang.EntityFrameworkCore
The package references d2lang-cs transitively. It supports EF Core applications targeting .NET 8 or .NET 10.
Automatic generation
Chain AddD2Schema after the normal context registration:
builder.Services
.AddDbContext<AppDbContext>(options =>
options.UseSqlServer(builder.Configuration.GetConnectionString("Database")))
.AddD2Schema<AppDbContext>("docs/database-schema.d2");
The file is generated when the host starts. Relative paths use the host content root. The generator reads EF Core's in-memory relational model, so it does not connect to the database. Files are replaced only when their content changes.
The output contains database tables, columns, provider store types, nullability, primary keys, unique columns, foreign-key constraints, and column-to-column foreign-key connections. Use the independently installed D2 CLI to render the generated source:
d2 docs/database-schema.d2 docs/database-schema.svg
Generation can be customized during registration:
.AddD2Schema<AppDbContext>("docs/database-schema.d2", options =>
{
options.IncludeDatabaseSchemas = true;
options.IncludeNullability = true;
options.IncludeForeignKeyConnections = true;
options.IncludeForeignKeyNames = false;
});
For applications that do not use the .NET generic host, create the diagram directly:
var diagram = dbContext.ToD2Diagram();
var source = diagram.ToString();
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. 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 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. |
-
net10.0
- d2lang-cs (>= 1.1.0)
- Microsoft.EntityFrameworkCore.Relational (>= 10.0.10)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.10)
-
net8.0
- d2lang-cs (>= 1.1.0)
- Microsoft.EntityFrameworkCore.Relational (>= 8.0.29)
- Microsoft.Extensions.Caching.Memory (>= 8.0.1)
- Microsoft.Extensions.Hosting.Abstractions (>= 8.0.1)
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.1.0 | 43 | 8/9/2026 |