protected void SetPropertyValue(MetaTableProperty metaProperty, PropertyInfo pi, Object valueToSet, Object existing = null, Boolean OverwriteExisting = true) { object[] o = new object[] { }; Object e_v = null; Boolean doWrite = true; //if (!OverwriteExisting) //{ // e_v = pi.GetValue(existing, o); // if (DefaultValues[pi] != e_v) // { // doWrite = false; // } //} if (doWrite) { Object v = valueToSet; //metaProperty.GetValue(entry.properties[metaProperty.PropertyName]); //String value = ; v = TypeProvider.ConvertMetaEntryValue(v, pi); pi.SetValue(existing, v, null); } }
public static MetaTable MergeTables(MetaTablePropertyAliasList alias, IEnumerable <MetaTable> tables) { var d = tables.First().description; MetaTable output = new MetaTable(d); foreach (MetaTable table in tables) { Dictionary <String, MetaTableProperty> matchedPropertyBySourceName = new Dictionary <string, MetaTableProperty>(); foreach (var property in table.properties.items) { MetaTableProperty matched_property = output.properties.Get(property.PropertyName, alias); if (matched_property == null) { output.properties.Import(property); matched_property = property; } matchedPropertyBySourceName.Add(property.PropertyName, matched_property); } output.entries.ExpandEntries(output.properties); var targetEntries = output.entries.GetEntryDictionary(d.entryIDPropertyName); var sourceEntries = table.entries.GetEntryDictionary(d.entryIDPropertyName); foreach (var pair in sourceEntries) { // targetEntries.entries.CreateEntry() MetaTableEntry entry = null; if (!targetEntries.ContainsKey(pair.Key)) { throw new NotImplementedException(); //entry = output.CreateEntry() //output.entries.Add(entry); } else { entry = targetEntries[pair.Key]; } foreach (var matchedPair in matchedPropertyBySourceName) { var sourceVal = pair.Value.properties[matchedPair.Key]; entry.properties[matchedPair.Value.PropertyName] = sourceVal; } } } return(output); }
public TaskPropertyEntry OpenProperty(MetaTableProperty property) { var output = items.FirstOrDefault(x => x.propertyName == property.PropertyName); if (output == null) { output = new TaskPropertyEntry(property); items.Add(output); } return(output); }
public List <MetaTableProperty> ProcessTables(IEnumerable <MetaTable> tables) { List <MetaTableProperty> output = new List <MetaTableProperty>(); foreach (MetaTable t in tables) { Process(t); } foreach (var pair in PropertySets) { InstanceMergerByFrequencies <MetaTableProperty> merger = new InstanceMergerByFrequencies <MetaTableProperty>(pair.Value); MetaTableProperty property = merger.GetMergedInstance(); output.Add(property); } return(output); }
public MetaEntityClassProperty AddProperty(MetaTableProperty property, Boolean throwException = true) { MetaEntityClassProperty newProperty = new MetaEntityClassProperty() { type = MetaEntityClassPropertyType.value, PropertyName = property.PropertyName, DisplayName = property.DisplayName }; newProperty.Learn(property); if (AddProperty(newProperty, throwException)) { return(newProperty); } else { return(null); } }
/// <summary> /// Sets the object by entry from MetaTable /// </summary> /// <param name="entry">The entry.</param> /// <param name="input">The input.</param> /// <param name="existing">The existing.</param> /// <param name="OverwriteExisting">if set to <c>true</c> [overwrite existing].</param> /// <returns></returns> public Object SetObjectByMetaEntry(MetaTableEntry entry, MetaTable input, Object existing = null, Boolean OverwriteExisting = true) { if (existing == null) { existing = type.getInstance(null); } object[] o = new object[] { }; foreach (KeyValuePair <MetaTableProperty, PropertyInfo> pair in propertyLinkABs) { MetaTableProperty metaProperty = input.properties.Get(pair.Key.PropertyName); if (metaProperty != null) { Object v = entry.GetOutputValue(metaProperty); SetPropertyValue(metaProperty, pair.Value, v, existing, OverwriteExisting); } } return(existing); }
public TaskPropertyEntry(MetaTableProperty meta) { Meta = meta; propertyName = meta.PropertyName; propertyType = meta.ValueTypeName; }
public TaskPropertyValidation(MetaTableProperty _item) { item = _item; }
public void Deploy(MetaTableProperty property) { foreach (CellContentInfo cci in ContentInfos) { if (property.AllContentTypes == CellContentType.unknown) { property.AllContentTypes = cci.type; } else { property.AllContentTypes |= cci.type; } } property.ContentType = dominantType; if (property.AllContentTypes.HasFlag(CellContentType.formatted)) { property.ValueTypeName = nameof(String); } else { switch (dominantType) { default: case CellContentType.textual: case CellContentType.mixed: case CellContentType.formatted: case CellContentType.bank_account_number: case CellContentType.date_format: property.ValueTypeName = nameof(String); break; case CellContentType.numeric: property.ValueTypeName = ValueTypeName; property.thousantDelimiter = thousantDelimiter; property.decimalDelimiter = decimalDelimiter; String valueFormat = ""; if (decimalPlaces > 0) { valueFormat = "0." + "0".Repeat(decimalPlaces); } if (!thousantDelimiter.isNullOrEmpty()) { if (valueFormat.Length > 0) { valueFormat = "#," + valueFormat; } else { valueFormat = "#,#"; } } property.ValueFormat = valueFormat; break; } } }
public PropertyInfo GetPropertyInfo(MetaTableProperty entityProperty) { return(propertyLinkABs[entityProperty]); }