Using an execution strategy for connection resiliency changes how Entity Framework Core communicates to the database. This affects how you use explicit transactions. In this section, Phil explains how connection resiliency works in greater detail, and then demonstrates how to use explicit transactions with an execution strategy.
- [Narrator] When connection resiliency is enabled,…each operation becomes its own retriable operation.…If you're also using explicit transactions, all code…inside the transaction must be treated as a unit.…This causes direct conflict with the execution strategy.…So the solution is to invoke the execution strategy…with a delegate wrapping the transaction.…It's a lot of words, it's actually pretty easy to do…and we'll see that shortly.…
I'd be remiss if I didn't bring up,…that there is a possibility that your connection…fails during a transaction commit.…If it fails during a transaction, most databases roll…back to transaction. It sees that the client is gone…and rolls it back.…If the connection fails while the transaction is…being committed, the state of the transaction is…unknown to the application. Might have finished,…might not have finished. So whereas EF will bring back,…for example, server generated values. If the connection…fails those won't come back, it won't know what to do.…
So there are some decisions to be made on how you handle…
- Entity Framework Core components and projects
- Working with scaffolded files
- Testing with xUnit
- Viewing generated SQL
- Composing queries
- Sorting and filtering results
- Working with aggregates
- Loading related data
- Logging and tracking
- Mapping functions
- Generics and delegates
- Checking concurrency
- Resiliency and transactions
Skill Level Intermediate
Learning Entity Framework Corewith Reynald Adolphe1h 35m Intermediate
1. Get to Know Entity Framework
2. Set the Stage
3. Querying Data: Part 1
4. Querying Data: Part 2
5. Advanced Query Features
6. Persisting Data
7. DbContext Options and Configuration
Thank you1m 23s
- 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.