internal static FieldMapping DeserializeFieldMapping(JsonElement element) { string sourceFieldName = default; string targetFieldName = default; FieldMappingFunction mappingFunction = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sourceFieldName")) { sourceFieldName = property.Value.GetString(); continue; } if (property.NameEquals("targetFieldName")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } targetFieldName = property.Value.GetString(); continue; } if (property.NameEquals("mappingFunction")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } mappingFunction = FieldMappingFunction.DeserializeFieldMappingFunction(property.Value); continue; } } return(new FieldMapping(sourceFieldName, targetFieldName, mappingFunction)); }
internal FieldMapping(string sourceFieldName, string targetFieldName, FieldMappingFunction mappingFunction) { SourceFieldName = sourceFieldName; TargetFieldName = targetFieldName; MappingFunction = mappingFunction; }