ProjGraph.Lib.EntityFramework 1.0.1

dotnet add package ProjGraph.Lib.EntityFramework --version 1.0.1
                    
NuGet\Install-Package ProjGraph.Lib.EntityFramework -Version 1.0.1
                    
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.1" />
                    
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.1" />
                    
Directory.Packages.props
<PackageReference Include="ProjGraph.Lib.EntityFramework" />
                    
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 ProjGraph.Lib.EntityFramework --version 1.0.1
                    
#r "nuget: ProjGraph.Lib.EntityFramework, 1.0.1"
                    
#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.1
                    
#: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.1
                    
Install as a Cake Addin
#tool nuget:?package=ProjGraph.Lib.EntityFramework&version=1.0.1
                    
Install as a Cake Tool

ProjGraph.Lib.EntityFramework

Entity Framework Core DbContext and ModelSnapshot analysis with Mermaid ERD generation for .NET projects.

NuGet License: MIT

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 DbContext and ModelSnapshot files 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 erDiagram diagrams

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
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 (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.

Version Downloads Last Updated
1.0.1 32 4/4/2026
1.0.0 98 3/12/2026