Get in depth with one serialization setting that prevents problems when serializing Entity Framework entities with navigation properties.
- [Lecturer] We've seen in theory…why the reference loop handling setting is so important,…so now let's look at an example of it in code.…To start we'll add a couple of navigation properties…between our tour and reservation entities.…Here in the reservation entity, let's add…a public tour property called tour.…And, in the tour entity, let's add a public property…which is a list of reservation, called reservations.…
Now we should be able to load these navigation properties…up in our queries.…Back in the context class for Entity Framework,…I wanted to point out that as we discussed earlier,…I've disabled lazy loading so that the navigation…properties that we just added,…won't be loaded automatically under any circumstances.…Now if we go to the reservation controllers,…get all method, and we can add and include here,…and we can tell it we want to include…all the tour for the reservations.…
Now let's go test that in Postman.…When we submit a request to the get all method…in the reservations controller,…you can now see that we get an error back that says,…
AuthorJonathan "J." Tower
- Convention-based routing
- Binding your code to an HTTP request
- Validating models
- Using attributes to route requests
- Customizing attribute routes
- Data serialization and model binding
- Error handling
- Using exception filters and exception loggers
- API documentation and testing
- Securing your API
Skill Level Beginner
ASP.NET MVC: HTTP Request Life Cyclewith Janan Siam2h 15m Advanced
1. Controllers and Actions
3. Data Serialization and Model Binding
4. Error Handling
5. API Documentation and Testing
Next steps1m 38s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.