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}")

If you log in, you will be notified when someone leaves a comment.

Other users would like to know if this solution helped you.

© 2023 - ErnesTech LLC- Privacy