Entity Framework Core can use SQL Server scalar functions in LINQ code by mapping them to a C# function. This section demonstrates how to map a function as well as using the function in your queries.
- [Instructor] And Entity Framework Core 2…has added a couple really nice features with LINQ.…The first one, we're going to talk about right now…is scalar function mapping.…So you can map scalar database functions to C# code…and then incorporate that into your LINQ query.…Since it is a database function,…it will execute server side.…So if you are running into an issue with…mixed mode evaluation and you had, for example,…some string manipulation that isn't handled…by straight T SQL, you can add in a scalar function…to do the work of what the C# code was doing and then have…it all execute server side and get that performance.…
The way you do this is you map a static function…on the context to the scalar database function.…It has width tables and columns you can specify,…the database names, and the schema.…Well schema's applied to tables and not columns…but you know what I mean.…And you can also map the UDF function…using the modelBuilder in OnModelCreating.…This is another example of community contribution…into the RTM release of Entity Framework.…
- 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.