/// <summary> /// Sets data annotation from the column /// </summary> public void SetFrom(settingsPropertyEntry sPE, Boolean skipExisting = true) { name = sPE.name; PropertyCollection pce = sPE.exportPropertyCollection(definitions); foreach (var p in pce.Keys) { definitions.Add(p, pce[p]); } }
/// <summary> /// Builds a <see cref="settingsPropertyEntry"/> from contained data /// </summary> /// <param name="column">The column.</param> /// <param name="skipExisting">if set to <c>true</c> [skip existing].</param> /// <param name="log">The log.</param> /// <returns></returns> public settingsPropertyEntry BuildPCE(DataColumn column, Boolean skipExisting = true, ILogBuilder log = null) { settingsPropertyEntry pce = new settingsPropertyEntry(column); PropertyCollection pc = pce.exportPropertyCollection(); foreach (var pair in definitions.keyValuePairs) { if (skipExisting) { if (pc.ContainsKey(pair.resolvedKey)) { if (!pc[pair.resolvedKey].toStringSafe().isNullOrEmpty()) { if (log != null) { log.log(" Deploy [" + pair.key + "] = false, because destination is not empty (skipExisting=" + skipExisting.ToString() + ")"); } continue; } } } switch (pair.resolvedKey) { default: if (pair.resolvedKey is imbAttributeName attName) { pce.deploy(attName, pair.value); if (log != null) { log.log("Set[" + pair.key + "] = " + pair.value.toStringSafe()); } } else if (pair.resolvedKey is templateFieldDataTable tfdt) { pce.deploy(tfdt, pair.value); if (log != null) { log.log("Set[" + pair.key + "] = " + pair.value.toStringSafe()); } } else { if (log != null) { log.log(column.Table.GetTitle() + "." + column.ColumnName + " <- entry not recognized [" + pair.key + "]"); } } break; } } return(pce); }