Add Patch 1 EntityMapper Objetos anidados
All checks were successful
CI/CD Pipeline / Build and Deploy with Docker Compose (push) Successful in 2m48s

This commit is contained in:
Leandro Hernan Rojas 2025-04-04 15:37:05 -03:00
parent b2ace78329
commit aa24ee1dc7

View File

@ -49,6 +49,18 @@ namespace Models.Helpers
{
destProp.SetValue(destination, sourceValue);
}
else if (!destProp.PropertyType.IsPrimitive &&
destProp.PropertyType != typeof(string) &&
destProp.PropertyType.GetConstructor(Type.EmptyTypes) != null)
{
// Mapeo de objetos anidados
var mapMethod = typeof(EntityMapper)
.GetMethod(nameof(MapEntity), BindingFlags.Public | BindingFlags.Static)!
.MakeGenericMethod(sourceProp.PropertyType, destProp.PropertyType);
var mappedValue = mapMethod.Invoke(null, new[] { sourceValue });
destProp.SetValue(destination, mappedValue);
}
}
return destination;