/// <summary> /// Used for the final population result. /// </summary> /// <param name="flattened"></param> /// <param name="typeMap"></param> public PopulationResult(IDictionary <string, object> flattened, TypeMap typeMap) { OriginTypeMap = typeMap; var filteredResult = new Dictionary <string, object>( flattened.Where(v => OriginTypeMap.ContainsKey(v.Key)) .ToDictionary(kv => kv.Key, kv => kv.Value)); ; var neededTransformation = typeMap.Where(pair => pair.Value.Transformation != null || FluentOlapConfiguration.TransformationsMasterList.ContainsKey(pair.Value .InternalType.typeString) ).Select(i => i.Key).ToList(); foreach (string key in neededTransformation) { NodeProperties props = typeMap[key]; // Default to the master list. props.Transformation ??= FluentOlapConfiguration.TransformationsMasterList[props.InternalType]; if (filteredResult.TryGetValue(key, out object current)) { filteredResult[key] = props.Transformation(current); } else { filteredResult[key] = props.Transformation(null); } } inner = filteredResult; }
public static NodeProperties FromString(string s) { //TODO: Get name NodeProperties props = new NodeProperties(""); Dictionary <string, string> pairs = new Dictionary <string, string>(); foreach (string segment in s.Split('&')) { var segArr = segment.Split('='); pairs.Add(segArr[0], segArr[1]); } props.InternalType = new InternalType(pairs[SQLTYPEKEY]); props.NodeName = pairs[NODENAMEKEY] != "NULL"? pairs["node_name"] : null; props.ServiceName = pairs[SERVICENAMEKEY] != "NULL"? pairs[SERVICENAMEKEY] : null; props.Unique = bool.Parse(pairs[UNIQUEKEY]); return(props); }
public void Update(NodeProperties other) { if (other.Transformation != null) { Transformation = other.Transformation; } if (other.InternalType != null) { InternalType = other.InternalType; } if (other.NodeName != null) { NodeName = other.NodeName; } if (other.ServiceName != null) { ServiceName = other.ServiceName; } }