2017-08-29 07:54:12 +08:00
Add the following properties to the `Movie` class:
[!code-csharp[Main ](../../tutorials/razor-pages/razor-pages-start/sample/RazorPagesMovie/Models/MovieNoEF.cs?name=snippet_MovieNoEF )]
The `ID` field is required by the database for the primary key.
< a name = "dc" > < / a >
### Add a database context class
2017-12-14 03:26:20 +08:00
Add the following `DbContext` derived class named *MovieContext.cs* to the *Models* folder:
2017-10-22 06:05:12 +08:00
[!code-csharp[Main ](../../tutorials/razor-pages/razor-pages-start/snapshot_sample/RazorPagesMovie/Models/MovieContext.cs )]
2017-08-29 07:54:12 +08:00
2017-10-05 07:01:18 +08:00
The preceding code creates a `DbSet` property for the entity set. In Entity Framework terminology, an entity set typically corresponds to a database table, and an entity corresponds to a row in the table.