SqlParameterCollection only accepts non-null SqlParameter type objects, not SqlParameter objects
When you try to execute a parameterized query with EF Core, you get the following exception: System.InvalidCastException: The SqlParameterCollection only accepts non-null SqlParameter type objects, not SqlParameter objects The error message is confusing because it’s not showing the full type names. This error means you’re using System.Data.SqlClient.SqlParameter, but EF Core only accepts Microsoft.Data.SqlClient.SqlParameter. Note: They … Read more