Updated MapData

Had data going in the wrong direction, corrected this.
This commit is contained in:
Mario Steele 2025-07-24 04:21:10 -05:00
parent 4985dc4179
commit e670ad5701

View file

@ -4,7 +4,7 @@ namespace FreeTubeSync.Database;
public static class MapData public static class MapData
{ {
public static void MapFrom(this object obj1, object obj2) public static void MapFrom(this object obj2, object obj1)
{ {
var props = new Dictionary<string, object?>(); var props = new Dictionary<string, object?>();
var t1Type = obj1.GetType(); var t1Type = obj1.GetType();
@ -18,8 +18,12 @@ public static class MapData
properties = t2Type.GetProperties(); properties = t2Type.GetProperties();
foreach (var property in properties) foreach (var property in properties)
{ {
if (props[property.Name] is not IEnumerable) if (props.ContainsKey(property.Name))
property.SetValue(obj2, props[property.Name]); {
var value = props[property.Name];
if (value is string || value is not IEnumerable)
property.SetValue(obj2, value);
}
} }
} }