Add Patch 1 EntityMapper Objetos anidados
All checks were successful
CI/CD Pipeline / Build and Deploy with Docker Compose (push) Successful in 2m48s
All checks were successful
CI/CD Pipeline / Build and Deploy with Docker Compose (push) Successful in 2m48s
This commit is contained in:
parent
b2ace78329
commit
aa24ee1dc7
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user