S
Steve
I'm in the very early stages of evaluating an OR Mapper library called
EntitySpaces (www.entityspaces.com) and it's really cool, but they use
nullable types which are new to me and it's making my life very hard.
I'm generating business entities from different MySql Dbs and some of the
tables that have logical relationships have different integral fields, which
should be OK. Problem is, when my generated business entities have
different nullable integral types I can't assign to them.
For example:
int? a = 111;
short? b = a;
will not work. I have tried every kind of cast I could think of and none
will work.
b = (int?)a;
b = (int)a;
b = (int)a.value;
This will work:
b = int.Parse(a.Value.ToString());
However that code makes me ill and feel like I will vomit ;0)
So my trial and error has not led me to a clean solution. Other than a DB
redesign or refactoring generated business entities to all use the same
integral type, is there another solution that someone might know of?
Suggestions? Sympathy?
Thanks for reading,
Steve
EntitySpaces (www.entityspaces.com) and it's really cool, but they use
nullable types which are new to me and it's making my life very hard.
I'm generating business entities from different MySql Dbs and some of the
tables that have logical relationships have different integral fields, which
should be OK. Problem is, when my generated business entities have
different nullable integral types I can't assign to them.
For example:
int? a = 111;
short? b = a;
will not work. I have tried every kind of cast I could think of and none
will work.
b = (int?)a;
b = (int)a;
b = (int)a.value;
This will work:
b = int.Parse(a.Value.ToString());
However that code makes me ill and feel like I will vomit ;0)
So my trial and error has not led me to a clean solution. Other than a DB
redesign or refactoring generated business entities to all use the same
integral type, is there another solution that someone might know of?
Suggestions? Sympathy?
Thanks for reading,
Steve