Entity Framework Core is using a code-first approach for modeling your database. Entity Framework builds database model based on the C# classes customized with either annoatations (attributes on classes) or using a fluent API. It also comes with some built-in conventions and can be extended in many different ways.
Because the model is evaluated in runtime, it is sometimes hard to know what kind of database structure will Entity Framework generate and what kind of SQL will be generated when querying data. The only way to know is to execute the code.
As projects grow, experimenting becomes harder and slower. The interactive playground will run the code for you and show what SQL will be generated when using Entity Framework.
Online C# and LINQ playground
Write code in the browser
Write the Entity Framework code-first model in C# along with your LINQ queries. Both LINQ (Language Integrated Query) and LINQ-to-Objects are supported when querying data. To learn what namespaces and packages are allowed, refer to the documentation.
A library of examples for code-first approach
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. Examples also contain example queries, links to features used, and more.
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.
You can also use the playground to extract SQL queries which can be hand-applied to any database. Code-first modelling is a common way of defining database as it puts the consuming code front and center when designing a database.
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
Within the playground you can target the following databases:Note that the code will not be executed in the actual database, but it might affect how the provider generates code. If you need a real database for testing, please contact us.
Within the playground you can use the following versions of Entity Framework:If you need additional versions and custom combinations, please contact us.