Updated MapData
Had data going in the wrong direction, corrected this.
This commit is contained in:
parent
4985dc4179
commit
e670ad5701
1 changed files with 7 additions and 3 deletions
|
|
@ -4,7 +4,7 @@ namespace FreeTubeSync.Database;
|
|||
|
||||
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 t1Type = obj1.GetType();
|
||||
|
|
@ -18,8 +18,12 @@ public static class MapData
|
|||
properties = t2Type.GetProperties();
|
||||
foreach (var property in properties)
|
||||
{
|
||||
if (props[property.Name] is not IEnumerable)
|
||||
property.SetValue(obj2, props[property.Name]);
|
||||
if (props.ContainsKey(property.Name))
|
||||
{
|
||||
var value = props[property.Name];
|
||||
if (value is string || value is not IEnumerable)
|
||||
property.SetValue(obj2, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue