Entity Framework Core Store Procedure with Parameters does not return results (FromSqlRaw)

Question: How do you call Entity Framework Stored Procedure if using (FromSqlRaw) does not return any results?

Login to See the Rest of the Answer

If you have used _context.YourClassModel.FromSqlRaw("YourStoreProc {0},{0}",Param1,Param2); and this does not return any results, chances are that the parameters are not getting passed into the Store Procedure at the Back-End (Database). 

[NB] In order to resolve this, use _context.YourClassModel.FromSqlInterpolated($"YourStoreProc{Param1},{Param2}")

© 2024 - ErnesTech - Privacy
E-Commerce Return Policy