Sfoglia il codice sorgente

Fixed an issue with CoreRow empty values being DBNull, rather than NULL
(Re)fixed an issue when populating Entity User Properties
Fixed an Issue where Code Popup Editors would detect the wrong property to update

frogsoftware 1 anno fa
parent
commit
edc704900f

+ 1 - 1
InABox.Core/CoreTable/CoreRow.cs

@@ -106,7 +106,7 @@ namespace InABox.Core
                         }
                         }
 
 
                         var setter = setters[i];
                         var setter = setters[i];
-                        if (setter != null && value != null)
+                        if (setter != null && value != null && !(value is System.DBNull))
                             setter.Invoke(obj, value);
                             setter.Invoke(obj, value);
                         else
                         else
                             CoreUtils.SetPropertyValue(obj, column, value);
                             CoreUtils.SetPropertyValue(obj, column, value);

+ 1 - 0
InABox.Core/DatabaseSchema/CustomProperty.cs

@@ -118,6 +118,7 @@ namespace InABox.Core
                 {
                 {
                     type = typeof(object);
                     type = typeof(object);
                 }
                 }
+                CheckExpressions();
 
 
                 IsEntityLink = type.GetInterfaces().Contains(typeof(IEntityLink));
                 IsEntityLink = type.GetInterfaces().Contains(typeof(IEntityLink));
                 IsEnclosedEntity = type.GetInterfaces().Contains(typeof(IEnclosedEntity));
                 IsEnclosedEntity = type.GetInterfaces().Contains(typeof(IEnclosedEntity));

+ 1 - 1
InABox.Core/DatabaseSchema/DatabaseSchema.cs

@@ -334,7 +334,7 @@ namespace InABox.Core
         {
         {
             entity.UserProperties.Load(Properties(entity.GetType())
             entity.UserProperties.Load(Properties(entity.GetType())
                 .Where(x => x is CustomProperty)
                 .Where(x => x is CustomProperty)
-                .Select(x => new KeyValuePair<string, object?>(x.Name, x.PropertyType)));
+                .Select(x => new KeyValuePair<string, object?>(x.Name, DefaultValue(x.PropertyType))));
         }
         }
     }
     }
 }
 }

+ 1 - 1
inabox.wpf/DynamicGrid/Editors/CodePopupEditor/CodePopupEditorControl.cs

@@ -314,7 +314,7 @@ public class CodePopupEditorControl : DynamicEditorControl<Guid, CodePopupEditor
     private string GetCodeColumn(Type type)
     private string GetCodeColumn(Type type)
     {
     {
         var prop = DatabaseSchema.Properties(type)
         var prop = DatabaseSchema.Properties(type)
-            .Where(x => x.Editor is BaseCodeEditor && !x.HasParentEntityLink())
+            .Where(x => x.Editor is UniqueCodeEditor && !x.HasParentEntityLink())
             .FirstOrDefault() ?? throw new Exception($"No code property for {type.EntityName()}");
             .FirstOrDefault() ?? throw new Exception($"No code property for {type.EntityName()}");
         return prop.Name;
         return prop.Name;
     }
     }