Meaning, is there anything I can do, so that when I try and assign a short
to a bool
, it invokes my custom type conversion from short
to bool
?
I have a DB first POCO model, and every true/false value in the entire data model generated off the DB of 250 tables is either short?
or short
. The original RDBMS didn't have the concept of a boolean value.
Now I can't just change all the shorts to bools because I get type conversion errors when querying the DbContext. I could substitute bool
for a custom value type if I could get and set it's value without needing a Value
property, e.g.
public struct BoolThatLikesShorts
{
...
}
and then use it like BoolThatLikesShorts IsActive = (short)1;
and later on use it like
if (IsActive)
{
...
}
so that I we effectively have a complete bool
equivalent.