Entity Framework playground

Explore what happens under the hood when writing queries or using migrations.

MyDbContext.cs
Migration.sql

Motivation

Understanding generated code

Entity Framework Core builds database model based on the C# code customized with annotations and conventions. It does all the heavy lifting at runtime which makes it less predictable and harder to experiment. In order to inspect or verify the generated SQL, the code must be run. You can use this playground to inspect generated SQL structure for both migrations and queries.


Learn by example

The best way to learn is to use the examples found under examples. Inspect, change and test what happens when various features are used.


Checking migrations output

Entity Framework Core uses entity classes and conventions to build a model. A SQL provider (e.g. SQL Server, SQLite, PostgreSQL) will generate a SQL schema for the target database. Understanding what will be the output requires extensive experience or inspecting generated code after applying migrations.

Explore migrations with SQL providers

Viewing generated SQL for queries

Entity framework supports querying data using LINQ or LINQ to objects. In both cases the generated SQL can only be seen when running the code. Using the playground, a generated SQL can be inspected given a model and an example query.

Explore generated SQL for queries