This course will be retired on July 14, 2025.
Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
- Adding a One-to-Many Entity Relationship 5:48
- Using a One-to-Many Relationship 8:35
- Defining a Foreign Key Property 2:59
- Defining and Using a One-to-Many Relationship 2 objectives
- Adding a Many-to-Many Relationship 10:33
- Defining a Many-to-Many Relationship 2 objectives
- Defining a Many-to-Many Relationship with an Explicit Bridge Entity 10:25
- Defining a Many-to-Many Relationship with an Explicit Bridge Entity 3 objectives
- Using Data Annotations to Refine the Generated Database 5:58
- Refining a Model Using Data Annotations 1 objective
- Overriding the Context's OnModelCreating Method 6:33
- Using the Fluent API 1 objective
- Populating Your Database with Seed Data 5:55
- Section Review 10 questions

- 2x 2x
- 1.75x 1.75x
- 1.5x 1.5x
- 1.25x 1.25x
- 1.1x 1.1x
- 1x 1x
- 0.75x 0.75x
- 0.5x 0.5x
Let's override the Context class' `OnModelCreating` method so that we can customize EF's conventions and use EF's fluent API to refine our model.
Follow Along
To follow along commiting your changes to this course, you'll need to fork the dotnet-comic-book-gallery-model repo. Then you can clone, commit, and push your changes to your fork like this:
git clone <your-fork>
cd dotnet-comic-book-gallery-model
git checkout tags/v3.7 -b overriding-the-contexts-onmodelcreating-method
Additional Learning
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up-
saikiran maddukuri
17,919 Points1 Answer
-
Nathan Yebgui
15,732 Points1 Answer
View all discussions for this video
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up