Asp.Net Core 3.1 Error: FromSqlRaw or FromSqlInterpolated was called with non-composable SQL and with a query composing over it. Consider calling `AsEnumerable` after the FromSqlRaw or FromSqlInterpolated method to perform the composition on the client side.
Solution:
Add AsEnumerable<DTO_ClassModelHere>();
IEnumerable<DTO_ClassModelHere> _yourObject = _context.DTO_ClassModelHere.FromSqlRaw("EXECUTE dbo.YourStoreProcedure {0}", YourParameter).AsEnumerable<DTO_ClassModelHere>();
//The code above should resolve the error.
-Make sure that any other functions consuming the _yourObject result returns IEnumerable as well. The chain should maintain until the Collection reaches it's final destination that is the Front-End.
-Make sure that the AsEnumerable() is comes after FromSqlRaw or else you will still see the error.
Good work, thank you.
Thank you
jim said:
Thank you.