Our configuration is ES 2007.1.1210.0, SQL Server 2005, we use dynamic sql.
Different clients of our application require slightly different sets of columns stored in the database. So, we will provide an option to add a column at runtime. We don’t assume any special logic involved with those fields, their intention is to store data. The program is a webservice that mainly selects/inserts/updates data in the database. I've done some testing, and it looks like with some little modifications ES can gracefully handle database columns added at runtime.
- A new column metadata should be added to the columns metadata collection. This is doable right now because esColumnMetadataCollection implements Add() method.
- Provider type map should be updated to include a new map. esProviderSpecificMetadata.AddTypeMap() works great.
- Parameters cache needs to be updated to include new column. At the moment, there is no way to refresh this cache. I think the easiest way to implement this is to check if the number of metadata columns is different from the number of parameters in the cache (inside the Cache.GetParameters method). If the number is different, then recreate parameters.
- SetProperty method requires some rework to check if the property is not a generated one, but is listed in the metadata columns, then use one of the SetSystemInt32(), SetSystemString(), etc. methods to set the value.
- On serialization/deserialization side, using XmlAnyElement attribute allows accept/emit XmlElements for columns that where added at runtime.
I may be missing something, please point on mistakes. It would be great to have this all built into the framework.
Thank you,
Leonid