I've noticed that when using an EntityDataSource with FormViews, GridViews, and other databound controls, that empty strings are not always converted to null for inserts and updates. This isn't an issue when using templated DynamicControls, but when normal WebControls are bound to the datasource. For example:
<asp:TextBox ... Text='<%# Bind("NullableColumnName") %>'
During inserts and updates, when the text box has an empty string, the value saved to the table cell in the db is an empty string rather than NULL.
This is avoidable if normal <asp:Parameter Name="NullableColumnName" Type="String" /> parameters are added to the InsertParameters and UpdateParameters collections, since the default property of ConvertEmptyStringToNull is true.
Is there another way to ensure empty strings get converted to null, other than using DynamicControls with EDS? I'm just curious what is happening behind the scenes here. Data values of type Int32 are automatically converted to null when they are bound to an empty string, as are datetime values. It only seems to be normal strings that get pushed to the EDM without conversion to null.
View Complete Post