I have tried the below
var p = new SqlParameter(\"Option\", \"AUTHENTICATE\");
var user = _context.Set().FromSqlRaw(\"EXECUTE dbo.spGeneral_Authe
In .Net core 3.0 or above version,Please use below code: Instead of System.Data.SqlClient.SqlParameter Use Microsoft.Data.SqlClient.SqlParameter
int AuthourId = 3;
Microsoft.Data.SqlClient.SqlParameter authorId = new Microsoft.Data.SqlClient.SqlParameter("@AuthorId", AuthourId);
IEnumerable<Book> booksByAuthor = shopDbContext.Books
.FromSqlRaw("Select * from Book where AuthorId=@AuthorId", authorId)
.ToList();
InvalidCastException: The SqlParameterCollection only accepts non-null SqlParameter type objects, not SqlParameter objects.
For the above error, SqlParameter should be Microsoft.Data.SqlClient.SqlParameter not System.Data.SqlClient.SqlParameter