List Name and DataSourceString interaction in Flex Data Form


When you set the List Name in the Web Part prioerties, it dynamically creates a data source control from code. This control is then added to the DataSources and Controls collections by code within the DataFormWebPart, which in turn ensures that there is proper code in DataSourcesString to populate it later (thus stored in Web Parts table of the content DB(. As we never un-set List Name or even check it to see if it has changed or if DataSourcesString has the control already in it, we are thus resetting this every time the web part properties are saved. This is unecessary overhead that may lead to future issues.
We should either a) Set List Name to blank string when provisioning of the DataSourcesString is completed sucessfully (easy), or b) have a more programmatic approach in which we detect when List Name has actually changed, and only then erase the DataSources collection and recreate the necessary controls (more complicated).