I inherited a set of apps from developers who've left the company that were generated under Kinetic framework 1.1. Before I get involved in trying to upgrade the framework, which appears to be sorely overdue, I have a program that needs to write empty strings
into char/varchar columns. Unfortunately the code generated by the framework interprets an empty string (either "" or String.Empty) as NULL so my tables end up full of NULL columns rather than empty strings which will break dozens
of older apps that read them (long story).
Is there a way to set the value of a property of a SQL entity to an empty string? The specific code segment is:
foreach (PropertyInfo info in entityBase.GetType().GetProperties())
if (info.PropertyType.ToString() == "System.String")
info.SetValue(entityBase, String.Empty, null);
The entire program is a utility that is intended to load multiple tables from similarly formatted input files. "entityBase" is instantiated against one of several entities generated by Codesmith from the database. The above code iterates over the
properties of the requested entity and sets all the string-based columns to String.Empty. As noted above I've also used "" and both generate a NULL.
I looked for SetValue in the Framework to see if I could override the behavior but I can't find it so I assume it is part of the base code for the Framework and not modifiable.
Any thoughts would be greatly appreciated.