ProjGraph.Lib.EntityFramework
1.0.0
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package ProjGraph.Lib.EntityFramework --version 1.0.0
NuGet\Install-Package ProjGraph.Lib.EntityFramework -Version 1.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="ProjGraph.Lib.EntityFramework" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ProjGraph.Lib.EntityFramework" Version="1.0.0" />
<PackageReference Include="ProjGraph.Lib.EntityFramework" />
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 ProjGraph.Lib.EntityFramework --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: ProjGraph.Lib.EntityFramework, 1.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 ProjGraph.Lib.EntityFramework@1.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=ProjGraph.Lib.EntityFramework&version=1.0.0
#tool nuget:?package=ProjGraph.Lib.EntityFramework&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
ProjGraph.Lib.EntityFramework
Entity Framework Core DbContext and ModelSnapshot analysis with Mermaid ERD generation for .NET projects.
Installation
dotnet add package ProjGraph.Lib.EntityFramework
Overview
ProjGraph.Lib.EntityFramework parses EF Core DbContext source files and compiled ModelSnapshot migration
snapshots to produce Mermaid ERD diagrams.
It supports:
- Discovering
DbContextandModelSnapshotfiles in a project directory - Extracting entities/tables, columns/properties (with types and nullability), and foreign-key relationships
- Both Fluent API and data annotation configuration
- Generating Mermaid
erDiagramdiagrams
Usage
Register all services:
using ProjGraph.Lib.Core;
using ProjGraph.Lib.EntityFramework;
services.AddProjGraphCore();
services.AddProjGraphEntityFramework();
Generate an ERD from a DbContext file
using ProjGraph.Lib.EntityFramework.Application;
using ProjGraph.Lib.EntityFramework.Application.UseCases;
var efAnalysisService = provider.GetRequiredService<IEfAnalysisService>();
var model = await efAnalysisService.AnalyzeContextAsync("src/Data/AppDbContext.cs");
var renderer = provider.GetRequiredService<MermaidErdRenderer>();
string diagram = renderer.Render(model);
Example output:
erDiagram
Order {
Guid Id PK
string CustomerName
DateTime PlacedAt
}
OrderLine {
Guid Id PK
Guid OrderId FK
string ProductName
int Quantity
}
Order ||--o{ OrderLine : "has"
Generate an ERD from a ModelSnapshot
var analyzeSnapshot = provider.GetRequiredService<AnalyzeSnapshotUseCase>();
var model = await analyzeSnapshot.ExecuteAsync("src/Migrations/AppDbContextModelSnapshot.cs");
Discover contexts or snapshots automatically
var discoverContexts = provider.GetRequiredService<DiscoverContextsUseCase>();
IReadOnlyList<string> contextFiles = await discoverContexts.ExecuteAsync("src/");
var discoverSnapshots = provider.GetRequiredService<DiscoverSnapshotsUseCase>();
IReadOnlyList<string> snapshotFiles = await discoverSnapshots.ExecuteAsync("src/");
Key Services
| Service | Description |
|---|---|
IEfAnalysisService |
Orchestrates full EF model analysis |
AnalyzeContextUseCase |
Analyzes a DbContext source file |
AnalyzeSnapshotUseCase |
Analyzes a compiled ModelSnapshot |
DiscoverContextsUseCase |
Finds all DbContext files in a directory |
DiscoverSnapshotsUseCase |
Finds all ModelSnapshot files in a directory |
MermaidErdRenderer |
Renders an EfModel as a Mermaid erDiagram |
Links
- GitHub Repository
- Documentation
- CLI tool —
projgraph erd
| Product | Versions 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.
-
net10.0
- Microsoft.EntityFrameworkCore (>= 10.0.4)
- ProjGraph.Lib.Core (>= 1.0.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on ProjGraph.Lib.EntityFramework:
| Package | Downloads |
|---|---|
|
ProjGraph.Lib
Meta-package that bundles all ProjGraph libraries: project graph, class diagram, and Entity Framework analysis with a single DI registration. |
GitHub repositories
This package is not used by any popular GitHub repositories.