The Entity Framework Core FromSql command provides a mechanism for loading entities using straight SQL calls. Additional LINQ statements can be used in conjunction with composable queries. Phil demonstrates the capabilities and limitations of the FromSQL call, the differences between FromSql and ExecuteSqlCommand, and an extenstion method to get the database schema and table name from an Entity class.
- [Instructor] In addition to using LINQ…to build a query to retrieve entities into your DbSet,…EF Core enables executing SQL statements…to retrieve entities.…You can use inline SQL, stored procedures, or functions,…and with EF Core 2.0,…the statements can be parametrized for additional safely.…You do this using the FromSql method off of the DbSet,…and you can also use additional LINQ statements…when you use FromSql.…
The entities that are returned…are added to the ChangeTracker,…and I have an asterisk there because if you are using…a NotMapped DbSet, which we'll talk about,…then they won't be in the change tracker.…Course, there are some restrictions.…And there are a few, but they're really not bad.…First and foremost, it only works with relational databases.…Kind of makes senses, it's a FromSQL call,…not a FromNoSQL call.…You can only return entity types…that are part of the DbContext, and have a primary key.…
This does not mean it has to be part of the database,…it just has to be in the DbContext.…And we'll use NotMapped to add them in.…
- 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.