public static void SaveDefinitionStub(string file, DataHolderDefinition dataHolderDef) { XmlDataHolderDefinition holderDefinition = new XmlDataHolderDefinition() { Name = dataHolderDef.Name, DefaultTables = new string[1] { " " }, Fields = new DataFieldDefinition[dataHolderDef.Fields.Count] }; int num = 0; foreach (IDataField field in dataHolderDef.Fields.Values) { holderDefinition.Fields[num++] = LightDBMgr.DataFieldCreators[(int)field.DataFieldType](field); } LightRecordXmlConfig lightRecordXmlConfig = new LightRecordXmlConfig(); lightRecordXmlConfig.FileName = file; lightRecordXmlConfig.DataHolders = new XmlDataHolderDefinition[1] { holderDefinition }; lightRecordXmlConfig.Save(); }
public static void SaveDefinitionStub(string file, DataHolderDefinition dataHolderDef) { var def = new XmlDataHolderDefinition { Name = dataHolderDef.Name, DefaultTables = new[] { " " }, Fields = new DataFieldDefinition[dataHolderDef.Fields.Count] }; int i = 0; foreach (var field in dataHolderDef.Fields.Values) { def.Fields[i++] = DataFieldCreators[(int)field.DataFieldType](field); } var cfg = new LightRecordXmlConfig { FileName = file, DataHolders = new[] { def } }; cfg.Save(); }