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?

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

Edit this Article
Entity Framework Store Procedure in Entity Framework Technology published
Was this page helpful?
Yes Yes! this solution to the problem was helpful. No No! this solution to the problem was not helpful.. Leave ErnesTech Feedback.Feedback
If you log in, you will be notified when someone leaves a comment.

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

Your Session is Ending
Login to Continue

© 2021 - ErnesTech - Privacy