wangchao1687 wrote:
the varcher null in DB should map to null in generated code, why I get ""?
because all NULL values are converted to the default value for the .NET type of the field mapped onto the column. For strings you could use null, though for int for example, you can't, so there is a universal way to deal with this: TypeDefaultValue.cs/vb has the default values for NULL-ed fields.
It is annoy that I need to check using [destinationPersonalInfo.TestOriginalFieldValueForNull] method. I even did not change any properties of the entity.
There is no other way, how would you test if some int field is NULL? You can't. You could define '-1' or so as 'NULL', but what if your app specs change and -1 becomes a valid value? (in the early '90-ies, some people used 9-9-99 as a NULL date in systems, which gave problems when the system was still around at that date. )