diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-01-25 14:12:56 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-01-25 14:12:56 +0200 |
| commit | dc11398ba5728af943256ca99eba8c9d66e1b6e2 (patch) | |
| tree | 5ff3d0f64f2361d254511810258d7824eeab98d3 /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels | |
| parent | d36a5ab7115ec53405622e4437cd3f8f615d515d (diff) | |
| download | Tango-dc11398ba5728af943256ca99eba8c9d66e1b6e2.tar.gz Tango-dc11398ba5728af943256ca99eba8c9d66e1b6e2.zip | |
Refactored ObservableEntity:
Observables comparison is now done by GUID.
Implemented != == Equals overrides.
Save and load are now done only on decorated properties so properties on partial class are allowed!
Implemented dynamic graph sizes on developer module.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels')
| -rw-r--r-- | Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/DbTableViewModel.cs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/DbTableViewModel.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/DbTableViewModel.cs index a3d3e2486..ae4fa8a07 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/DbTableViewModel.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/DbTableViewModel.cs @@ -140,7 +140,7 @@ namespace Tango.MachineStudio.DB.ViewModels base.OnValidating(); ValidationErrors.Clear(); - foreach (var prop in typeof(T).GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(x => !x.PropertyType.IsGenericType && x.PropertyType.IsClass && !x.Name.Contains("Guid"))) + foreach (var prop in typeof(T).GetPropertiesWithAttribute<EntityFieldNameAttribute>(BindingFlags.Public | BindingFlags.Instance).Where(x => !x.PropertyType.IsGenericType && x.PropertyType.IsClass && !x.Name.Contains("Guid"))) { if (prop.GetValue(EditEntity) == null) { @@ -298,13 +298,13 @@ namespace Tango.MachineStudio.DB.ViewModels private bool FilterEntity(T entity, String filter) { - foreach (var prop in entity.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(x => x.PropertyType.IsClass && x.PropertyType != typeof(String) && x.PropertyType != typeof(byte[]) && !x.PropertyType.IsGenericType)) + foreach (var prop in entity.GetType().GetPropertiesWithAttribute<EntityFieldNameAttribute>(BindingFlags.Public | BindingFlags.Instance).Where(x => x.PropertyType.IsClass && x.PropertyType != typeof(String) && x.PropertyType != typeof(byte[]) && !x.PropertyType.IsGenericType)) { object obj = prop.GetValue(entity); if (obj != null) { - foreach (var innerProp in obj.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(x => x.Name != "Deleted" && x.Name != "ID" && x.Name != "LastUpdated").Where(x => !x.PropertyType.IsGenericType && (x.PropertyType.IsClass || x.PropertyType == typeof(String)))) + foreach (var innerProp in obj.GetType().GetPropertiesWithAttribute<EntityFieldNameAttribute>(BindingFlags.Public | BindingFlags.Instance).Where(x => x.Name != "Deleted" && x.Name != "ID" && x.Name != "LastUpdated").Where(x => !x.PropertyType.IsGenericType && (x.PropertyType.IsClass || x.PropertyType == typeof(String)))) { object value = innerProp.GetValue(obj); @@ -322,7 +322,7 @@ namespace Tango.MachineStudio.DB.ViewModels return entity. GetType(). - GetProperties(BindingFlags.Public | BindingFlags.Instance). + GetPropertiesWithAttribute<EntityFieldNameAttribute>(BindingFlags.Public | BindingFlags.Instance). Where(x => x.Name != "Deleted" && x.Name != "ID" && x.Name != "LastUpdated"). Where(x => !x.PropertyType.IsGenericType && (x.PropertyType.IsClass || x.PropertyType == typeof(String))). Select(prop => prop.GetValue(entity).ToString()). |
