Let's say that a table have columns that are of type varchar
just to save binary values like YES/NO
, TRUE/FALSE
, STATIC/DCHP
,... I believe strongly that I could rather use Boolean in the Entity Framework.
This is the table
+---------------------+-------------+
| AccessibleRemotely | IPType |
+ --------------------+-------------+
| YES | Static |
+---------------------+-------------+
| NO | DHCP |
+---------------------+-------------+
This is my entity
public class Device
{
public bool? AccessibleRemotely { get; set; }
public bool? IPType { get; set; }
}
This is my configuration
public class DeviceConfiguration : EntityTypeConfiguration<Device>
{
public DeviceConfiguration()
{
//mapping here...
}
}
How do I transform text to Boolean and vice-versa?
Thanks for helping