protected override void Inject(object source, object target) { foreach (var sourceProp in source.GetProps()) { var prop = sourceProp; var endpoints = UberFlatter.Unflat(sourceProp.Name, target, t => TypesMatch(prop.PropertyType, t)); if (endpoints.Count() == 0) { continue; } var value = sourceProp.GetValue(source); if (AllowSetValue(value)) { foreach (var endpoint in endpoints) { endpoint.Property.SetValue(endpoint.Component, SetValue(value)); } } } }
protected override void Inject(object source, object target) { foreach (var t in target.GetProps()) { var t1 = t; var es = UberFlatter.Flat(t.Name, source, type => TypesMatch(type, t1.PropertyType)); if (es.Count() == 0) { continue; } var endpoint = es.First(); if (endpoint == null) { continue; } var val = endpoint.Property.GetValue(endpoint.Component); if (AllowSetValue(val)) { t.SetValue(target, SetValue(val)); } } }