diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2019-12-20 21:34:50 +0200 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2019-12-20 21:34:50 +0200 |
| commit | 76cdf188e28544cd5056c30f35d77590d9a79cae (patch) | |
| tree | e83b12220517378e4499dc47c6261f8862f37f46 /Software/Visual_Studio/Tango.BL/ObservableEntityDTO.cs | |
| parent | 5cb75f4b026a7842171369f58f5aba1c9678f60f (diff) | |
| download | Tango-76cdf188e28544cd5056c30f35d77590d9a79cae.tar.gz Tango-76cdf188e28544cd5056c30f35d77590d9a79cae.zip | |
Improvements to ActionLogs.
Implemented ActionLogs for hw comparison.
Diffstat (limited to 'Software/Visual_Studio/Tango.BL/ObservableEntityDTO.cs')
| -rw-r--r-- | Software/Visual_Studio/Tango.BL/ObservableEntityDTO.cs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Software/Visual_Studio/Tango.BL/ObservableEntityDTO.cs b/Software/Visual_Studio/Tango.BL/ObservableEntityDTO.cs index ee8d2f40f..4c5ca6ae4 100644 --- a/Software/Visual_Studio/Tango.BL/ObservableEntityDTO.cs +++ b/Software/Visual_Studio/Tango.BL/ObservableEntityDTO.cs @@ -1,12 +1,14 @@ using System; using System.Collections; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using System.Reflection; using System.Text; using System.Threading.Tasks; using Tango.BL.ActionLogs; using Tango.BL.ValueObjects; +using Tango.Core.ExtensionMethods; namespace Tango.BL { @@ -72,6 +74,19 @@ namespace Tango.BL prop.SetValue(dto, collection); } } + else if (prop.GetCustomAttribute<ObservableDTOPropertyAttribute>() != null) + { + var att = prop.GetCustomAttribute<ObservableDTOPropertyAttribute>(); + + try + { + prop.SetValue(dto, observable.GetPropertyValueByPath(att.MapsTo)); + } + catch + { + Debug.WriteLine($"Error mapping '{typeof(DTO).Name}.{prop.PropertyType}' to '{typeof(T)}.{att.MapsTo}'."); + } + } } return dto; |
