Reputation:
I have a stored procedure similar to this:
CREATE PROCEDURE [dbo].[sp_mark_question]
AS
BEGIN
SELECT 1 AS Authenticated,
0 AS RC
END
It is executed like this:
var rc = await db.Database.SqlQuery<AnswerToClient>(sql).FirstOrDefaultAsync();
public class AnswerToClient
{
public bool Authenticated { get; set; }
public bool RC { get; set; }
}
I get an error:
The specified cast from a materialized 'System.Int32' type to the 'System.Boolean' type is not valid.
I think this might be because the stored procedure returns a number. How can I make it return a value that can be converted to the bool?
Upvotes: 1
Views: 1156