private static ColumnMapping GetMapping(IColumnInspector inspector) { var type = inspector.GetType(); var field = type.GetField("mapping", BindingFlags.Instance | BindingFlags.NonPublic); if (field == null) { throw new MissingMemberException($"field 'mapping' was not found in type {type}"); } return(field.GetValue(inspector) as ColumnMapping); }
public static void SetAttribute(this IColumnInspector columnInspector, string attributeName, object value, int layer) { var layeredValues = TypeHelper.GetNestedFieldValue(columnInspector, "mapping.attributes.layeredValues.inner") as Dictionary <string, LayeredValues>; if (layeredValues.ContainsKey(attributeName)) { layeredValues[attributeName][layer] = value; } else { layeredValues.Add(attributeName, new LayeredValues() { { layer, value } }); } }
public void CreateDsl() { mapping = new ColumnMapping(); inspector = new ColumnInspector(typeof(Record), mapping); }