Entity Framework Core supports LINQ aggregation commands. In this section, Phil adds tests to demonstrate using Sum, Count, Min, Max, Average, Any, and All. Min, Max, and Average requires a few modification for EF Core to execute the commands server side.
- [Instructor] EF Core supports a wide range…of aggregation functions such as…sum, count, min, max, and average.…An interesting side note is that min, max, and average…run server side but EF registers…them as client side execution.…So if you have client side execution disabled,…they will fail.…Don't worry, I'm going to show you a workaround for this.…Then any and all execute server side as well,…and in SQL Server, they use the where exists construct.…
So let's see some examples of aggregates…using Entity Framework Core.…Open up the aggregate test class,…and let's start off by calculating the sum of the prices.…So we'll say decimal sum equals context.product.sum…and we have to tell it what we are summing…and in this case, it's the list price.…There is no deferred execution with the aggregates.…
They happen immediately so we won't have to…call two lists or anything like that because well,…it just wouldn't make sense.…Let's just put a test in there to make sure…that it is doing what we expect.…And I don't think I mentioned it before.…
- 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.