Having an issue with Nullable MySQL columns in SubSonic 3.0 templates
- by omegawkd
Looking at this line in the Settings.ttinclude
string CheckNullable(Column col){
string result="";
if(col.IsNullable && col.SysType !="byte[]" && col.SysType !="string")
result="?";
return result;
}
It describes how it determines if the column is nullable based on requirements and returns either "" or "?" to the generated code.
Now I'm not too familiar with the ? nullable type operator but from what I can see a cast is required.
For instance, if I have a nullable integer MySQL column and I generate the code using the default template files it returns a line similar to this:
int? _User_ID;
When trying to compile the project I get the error:
Cannot implicitly convert type 'int?' to 'int'. An explicit conversion exists (are you missing a cast?)
I checked teh Settings files for the other database types and they all seems to have the same routine. So my question is, is this behaviour expected or is this a bug?
I need to solve it one way or the other before I can procede.
Thanks for your help.