Configuring Entity Types
Learn how to configure entity types using data annotations or the fluent API.
Overview
An entity type is a type included in the EF Core model. EF Core creates tables from entity types. In this lesson, we’ll review how to configure entity types using data annotations or the fluent API.
Note: The commands in this lesson generate code and files. Through the terminal, we can navigate to these files by using relevant Linux commands such as
ls
to view a list of files and directories,cd
to change directories, andcat
to view file contents. A SPA widget showing the updated project with the generated files is also available. Also, note that EF Core uses a timestamp within the generated file names. We represent these names withxxx
.
Default conventions
We’ll demonstrate the default conventions with the C# console app project below:
Get hands-on with 1200+ tech skills courses.