Free tool

Turn an EF Core model into an ER diagram

Paste an Entity Framework Core model snapshot, or your entity classes, and get the database as DBML: tables, columns, keys, indexes, and foreign keys. Paste that into DB Planner and it is an ER diagram.

Free, no account. Your schema is converted on our server and not stored. Up to 200 KB.

Two things you can paste

A model snapshot, when you have one

*ModelSnapshot.cs is regenerated by every dotnet ef migrations add, and it is EF Core’s own description of the database. Nothing has to be inferred from it: table names come from ToTable, column names from HasColumnName (so a snake_case naming convention is already applied), types from HasColumnType, and foreign keys arrive with their delete behaviour.

Entity classes, when you do not

Without a snapshot, the classes are read by convention: each property is a column, Id or <Class>Id is the key, and [Table], [Column], [Key], [Required], and [MaxLength] are honoured. A DbSet<T> on a context gives the table its name, and a navigation property with a matching <Nav>Id becomes a foreign key.

What the classes cannot show is anything configured elsewhere: fluent configuration in OnModelCreating, or a global naming convention. That is the whole case for the snapshot.

From the diagram back to C#

A diagram is where a schema change is cheapest to discuss. In DB Planner the model is DBML on a shared board, and when the design is agreed it exports as C# model classes, with Entity Framework annotations or as POCOs, or as SQL Server DDL. See the database design tool for the full loop from model to review to hand-off.

EF Core ER diagram questions

How do I create an ER diagram from an EF Core model?

Paste your model snapshot (the *ModelSnapshot.cs file in the Migrations folder) above to get DBML, then paste the DBML into a DB Planner project. Entity classes work too when there is no snapshot.

Should I paste the model snapshot or the entity classes?

The snapshot when you have one. It is EF Core’s own record of the database, with the real table names, column names, column types, keys, indexes, and delete rules. Entity classes leave out anything configured with the fluent API or a naming convention.

Where is the model snapshot?

In the Migrations folder, named after your context, for example AppDbContextModelSnapshot.cs. It is rewritten every time you run dotnet ef migrations add.

Can DB Planner generate C# models from a diagram?

Yes. A schema in DB Planner exports as C# classes with Entity Framework annotations or as plain POCOs, with naming and namespace options.

Put your schema on the board

Start on the free plan, no card needed. Pro is $5 a month when you outgrow it.

Start designing free