Advanced
Last updated
Was this helpful?
Last updated
Was this helpful?
EF Core provides the DbSet.FromSql()
method to execute raw SQL queries and get the results as entity objects.
Limitations
The SQL query must return all the columns of the table. e.g.,
will throw an exception.
The SQL query cannot include JOIN queries to get related data. Instead Include()
method can be used to load related entities after FromSql()
method.