Configuring Entity Properties
Learn how to configure entity properties using data annotations or fluent API.
We'll cover the following
Overview
Each entity type in the model has a set of properties. In this lesson, we’ll review how to configure entity properties using data annotations or the fluent API. In other words, we’ll learn how to configure the property to column mappings.
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
To demonstrate, we’ll work with the C# console app project below:
Get hands-on with 1400+ tech skills courses.