public static void MapPropertiesToModel(this IHaveProperties dto, IExtendedProperties model) { foreach (var property in dto.Properties) { if (model.Properties.ContainsKey(property.Key)) { var type = GetMetaFieldType(property.Key, out MetaField metaField); if (type == null || metaField == null) { continue; } if (property.Value == null && !IsNullable(type)) { continue; } var converter = TypeDescriptor.GetConverter(type); var parsedValue = GetValue(metaField.AllowNulls, property, converter); model.Properties[property.Key] = parsedValue; } } }
public static void MapPropertiesToDto(this IExtendedProperties model, IHaveProperties dto) { dto.Properties = model.ToPropertyList(); }