//this must be called only when we know that the dll is loaded and available //so it must be a hierarchical step by step procedure on a need to base and not //after load public void CreateDataModelFromXml() { if (!String.IsNullOrEmpty(xmlItemDataModel) && !String.IsNullOrEmpty(xmlMainType)) { //itemDataModel = null; StringReader stringWriter = null; XmlReader xmlWriter = null; try { stringWriter = new StringReader(xmlItemDataModel); xmlWriter = XmlReader.Create(stringWriter); DataModelPluginConfiguration obj = null; XmlSerializer ser = new XmlSerializer(Type.GetType(xmlMainType));//, allsertypes); obj = ser.Deserialize(xmlWriter) as DataModelPluginConfiguration; _serializationError = "XML Read OK"; _itemDataModel = obj; } catch (Exception ex) { _serializationError = ex.Message; } finally { if (xmlWriter != null) { xmlWriter.Close(); } else { stringWriter?.Close(); } } } }
public void ReloadDataConfiguration(DataModelPluginConfiguration newData) { _itemDataModel = newData; //#if DEBUG //this is called here for debug MakeLatestXml(); //#endif }
//here I create catalogItem from explicit data model public DataModelCatalogItem(DataModelPluginConfiguration pluginDataModel, string selector = "") : this() { Selector = selector; _itemDataModel = pluginDataModel; }