This repository was archived by the owner on Aug 18, 2021. It is now read-only.
This repository was archived by the owner on Aug 18, 2021. It is now read-only.
Duplicated logic to copy from/to LightModel and LightViewModels #28
Open
Description
Both LightModel and LightViewModel have methods to copy properties from one object to another via reflection:
We can notice a couple of issues
Violation of the DRY Principle
Both classes have this DynamicHelperData
method which does the exact same thing.
Also, the DynamicHelperData
and the MapTo
methods have essentially the same logic.
They don't make a deep copy of the object
They just pass the reference around on complex types, resulting in a shallow copy.
The framework already provides a method to make a deep copy of an object. This method can be found at the WorkBenchExtensions class:
We should favor the use of this method as it solves the problems listed above