W
wdudek
Hi,
I have a situation where I am writing an applicaiton against a legacy
database that uses Y/N for it's boolean fields. Using LINQ I generated a
class that exposed these fields as a char. What I would like to do is expose
them to consumers of the class as a bool. I tried to edit the property that
was autogenerated by LINQ but this didn't work and caused numerous compiler
errors.
Is there a recomended approach to doing this? so far the only way I can
see to achieve this would be to wrap the LINQ class inside of another one and
expose it to the calling code through this wrapper, using a property marked
internal to allow code inside my library to work against the LINQ generated
class and the data context.
Any thoughts? in the end I want to achieve this
char _myValue;
public bool MyValue
{
get
{
if (_myValue)
return 'Y';
else
return 'N';
}
set
{
char temp = value ? 'Y' : 'N';
if (_myValue != temp)
_myValue = temp;
}
}
thanks Bill
I have a situation where I am writing an applicaiton against a legacy
database that uses Y/N for it's boolean fields. Using LINQ I generated a
class that exposed these fields as a char. What I would like to do is expose
them to consumers of the class as a bool. I tried to edit the property that
was autogenerated by LINQ but this didn't work and caused numerous compiler
errors.
Is there a recomended approach to doing this? so far the only way I can
see to achieve this would be to wrap the LINQ class inside of another one and
expose it to the calling code through this wrapper, using a property marked
internal to allow code inside my library to work against the LINQ generated
class and the data context.
Any thoughts? in the end I want to achieve this
char _myValue;
public bool MyValue
{
get
{
if (_myValue)
return 'Y';
else
return 'N';
}
set
{
char temp = value ? 'Y' : 'N';
if (_myValue != temp)
_myValue = temp;
}
}
thanks Bill