1

I need to pull data from several tables using EF Core V7.The issue is that i don't want to create models(Datsets) or do the Onmodlecreation binding for all the tables from which i'm pulling the data from. Basically i'm trying to execute a Raw SQL Query and get data into a object with a data model which does not exist in the database.

I have referred to this SO post

Raw SQL Query without DbSet - Entity Framework Core It says dbData.Database.SqlQuery is now deprecated

and it speaks about several ways to solve it

  1. To use a Keyless entity type- I don't understand how we are pulling data without a model binding to the context. Is it possible ?

  2. To use a Helper class - It essentially executes Raw SQL. It raises the question of whether we need EF altogether to accomplish this .

techno
  • 6,100
  • 16
  • 86
  • 192

0 Answers0