In this section, Phil creates a custom execution strategy and demonstrates its use.
- [Instructor] So now, let's create…a custom execution strategy.…And to do that, we create a new class.…Let's create it right next to our context.…So add class.…We'll just call it simply My Execution Strategy.…Go ahead and make it public,…and inherit from…Execution…Strategy.…
You'll notice that we need,…using Microsoft.EntityFrameworkCore.Storage.…So let's do Control + Dot…and implement the missing members,…and we'll go ahead and implement all of them.…And you'll see, we can take in,…or we have to take in either a context…or execution strategy dependencies,…but then we can set the retry count…and the retry delay,…and then we have to code…what exceptions should we retry on.…
For this demo,…we're going to just return true,…and let me add a note here.…In real life…should just be a list of…exceptions,…and not all.…Let me fix my little spelling error.…Okay, we now have our execution strategy.…I'm going to add in one more constructor.…
And this is one that uses the DefaultMaxRetryCount…and the DefaultMaxDelay,…so they don't have to be specified.…
- Persisting data
- Tracking EntityState
- Configuring the DbContext
- Transactions across DbContexts
- Understanding the batching process
- Attaching and deleting detached entities
- Design time configuration
- Concurrency checking
- Using custom execution strategies
Skill Level Intermediate
Entity Framework Core Essential Training: 1with Phil Japikse3h 20m Intermediate
ASP.NET Core: Test-Driven Developmentwith Richard Rout37m 30s Intermediate
1. Persisting Data: Part 1
2. Persisting Data: Part 2
3. DbContext Options and Configuration
- 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.