Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I define a SQL Server datatype when I have a bool mapped to SQL Server with Entity Framework?

I have the following in a C# class.

    public bool answer1Correct { get; set; }
    public bool answer2Correct { get; set; }
    public bool answer3Correct { get; set; }
    public bool answer4Correct { get; set; }
    public bool answer5Correct { get; set; }

I want to use Entity Framework to connect these to a table in SQL Server. What datatype should I use when I create the columns in SQL Server 2012 ?

like image 349
Alan2 Avatar asked Dec 26 '22 02:12

Alan2


1 Answers

Use the datatype BIT ... the Entity Framework will map it correctly

like image 121
Tintifax Avatar answered Jun 01 '23 09:06

Tintifax