diff options
| author | Roy <roy.mail.net@gmail.com> | 2018-03-01 22:46:28 +0200 |
|---|---|---|
| committer | Roy <roy.mail.net@gmail.com> | 2018-03-01 22:46:28 +0200 |
| commit | 7281ce18b916f327f263e938624e8c0d25374620 (patch) | |
| tree | 0f8b4234f5c0d6c3d7af74fa46d73e48c8d36f77 /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels | |
| parent | 1e0bf3a26354f8a0f1e21990ec07706427a0761f (diff) | |
| download | Tango-7281ce18b916f327f263e938624e8c0d25374620.tar.gz Tango-7281ce18b916f327f263e938624e8c0d25374620.zip | |
Some work on BL..
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 | 9 |
1 files changed, 5 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 2a3760e17..b77d02f4f 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 @@ -15,6 +15,7 @@ using System.Collections.ObjectModel; using System.Reflection; using Tango.MachineStudio.Common.StudioApplication; using System.ComponentModel; +using System.ComponentModel.DataAnnotations.Schema; namespace Tango.MachineStudio.DB.ViewModels { @@ -140,7 +141,7 @@ namespace Tango.MachineStudio.DB.ViewModels base.OnValidating(); ValidationErrors.Clear(); - foreach (var prop in typeof(T).GetPropertiesWithAttribute<EntityFieldNameAttribute>(BindingFlags.Public | BindingFlags.Instance).Where(x => !x.PropertyType.IsGenericType && x.PropertyType.IsClass && !x.Name.Contains("Guid"))) + foreach (var prop in typeof(T).GetPropertiesWithAttribute<ColumnAttribute>(BindingFlags.Public | BindingFlags.Instance).Where(x => !x.PropertyType.IsGenericType && x.PropertyType.IsClass && !x.Name.Contains("Guid"))) { if (prop.GetValue(EditEntity) == null) { @@ -299,13 +300,13 @@ namespace Tango.MachineStudio.DB.ViewModels private bool FilterEntity(T entity, String filter) { - 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)) + foreach (var prop in entity.GetType().GetPropertiesWithAttribute<ColumnAttribute>(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().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)))) + foreach (var innerProp in obj.GetType().GetPropertiesWithAttribute<ColumnAttribute>(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); @@ -323,7 +324,7 @@ namespace Tango.MachineStudio.DB.ViewModels return entity. GetType(). - GetPropertiesWithAttribute<EntityFieldNameAttribute>(BindingFlags.Public | BindingFlags.Instance). + GetPropertiesWithAttribute<ColumnAttribute>(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()). |
