CancellationToken
A .NET value passed into async methods that lets the caller signal that the work is no longer wanted and should stop.
In more detail
By convention it is the last parameter. ASP.NET Core supplies one per request, cancelled when the client disconnects, and passing it down to EF Core stops a query nobody is waiting for.
Related terms
- async and await — Language keywords for writing code that waits for slow work, such as a network call, without blocking a thread.
- Task — The .NET type representing an operation that may still be running and will eventually complete with a result, an exception or cancellation.
- Entity Framework Core — Microsoft's object-relational mapper for .NET, which lets code query and save database data as C# objects and translates LINQ into SQL.
Taught in
- Async and Await: Managing Concurrency — Modern .NET Core, C# & Enterprise Microservices
- Querying, Change Tracking, and Saving Data — Modern .NET Core, C# & Enterprise Microservices
- The Repository Pattern — Modern .NET Core, C# & Enterprise Microservices
- Unit Testing with xUnit and NSubstitute — Modern .NET Core, C# & Enterprise Microservices