Thought i would just share something i ran across that had me kinda scratching my head in frustration (all though that seems to happening a lot theses days 😦 )
When your setting up you EF Core to work with your stored procedures that you’ve created on your database when calling your store procedures using raw sql commands as shown in the image below .
In my Database Context class i have a DbSet that uses a model called “Game_Tbl” but i was continually running in this exception when i was trying to query my stored procedure .
This was the stored procedure in question
The problem was in my model class .
The data i was requested from the SQL stored procedure i created was causing and error because of the gID property in my Game_Tbl Model class it couldnt map the data properly which was causing and InvalidOperationError.
The solution was simple i just had to add gID to the query to correspond to my models property . Unfortunately none of the properties of the model class can be null or any exception will be thrown in EF Core FromSql method.