소스 검색

Fixed that things weren't checking for ComplexFormulaAttribute when determining calculated columns

Kenric Nugteren 11 달 전
부모
커밋
194c337fd2

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

@@ -89,6 +89,7 @@ namespace InABox.Core
                      && x.GetCustomAttribute<DoNotSerialize>() == null 
                      && x.PropertyType != typeof(UserProperties)
                      && x.GetCustomAttribute<AggregateAttribute>() == null
+                     && x.GetCustomAttribute<ComplexFormulaAttribute>() == null
                      //&& x.GetCustomAttribute<FormulaAttribute>() == null
                      && x.GetCustomAttribute<ConditionAttribute>() == null
             ).Where(x => predicate(x));

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

@@ -140,6 +140,7 @@ namespace InABox.Core
                 if (!_calculated.HasValue)
                 {
                     _calculated = Property.GetCustomAttribute<AggregateAttribute>() != null
+                        || Property.GetCustomAttribute<ComplexFormulaAttribute>() != null
                         || Property.GetCustomAttribute<FormulaAttribute>() != null
                         || Property.GetCustomAttribute<ConditionAttribute>() != null
                         || Property.GetCustomAttribute<ChildEntityAttribute>() != null

+ 4 - 4
InABox.Core/Editors/Utils/EditorTypeUtils.cs

@@ -130,10 +130,10 @@ namespace InABox.Core
 
         public static bool IsCalculated(this PropertyInfo prop)
         {
-            var aggregate = prop.GetCustomAttribute<AggregateAttribute>();
-            var formula = prop.GetCustomAttribute<FormulaAttribute>();
-            var result = aggregate != null || formula != null;
-            return result;
+            return prop.GetCustomAttribute<AggregateAttribute>() != null
+                || prop.GetCustomAttribute<FormulaAttribute>() != null
+                || prop.GetCustomAttribute<ConditionAttribute>() != null
+                || prop.GetCustomAttribute<ComplexFormulaAttribute>() != null;
         }
     }
 }

+ 1 - 1
InABox.Core/Query/Column.cs

@@ -393,7 +393,7 @@ namespace InABox.Core
                         if (!failed)
                         {
                             failed = (!flags.HasFlag(ColumnTypeFlags.IncludeAggregates) && prop.HasAttribute<AggregateAttribute>())
-                                || (!flags.HasFlag(ColumnTypeFlags.IncludeFormulae) && prop.HasAttribute<FormulaAttribute>());
+                                || (!flags.HasFlag(ColumnTypeFlags.IncludeFormulae) && (prop.HasAttribute<FormulaAttribute>() || prop.HasAttribute<ComplexFormulaAttribute>()));
                         }
                         if (!failed)
                         {

+ 1 - 0
InABox.Core/Serialization.cs

@@ -682,6 +682,7 @@ namespace InABox.Core
                 && x.GetCustomAttribute<AggregateAttribute>() == null
                 && x.GetCustomAttribute<FormulaAttribute>() == null
                 && x.GetCustomAttribute<ConditionAttribute>() == null
+                && x.GetCustomAttribute<ComplexFormulaAttribute>() == null
                 && x.GetCustomAttribute<ChildEntityAttribute>() == null
                 && x.CanWrite);
             foreach (var prop in props)

+ 1 - 0
inabox.database.sqlite/SQLiteProvider.cs

@@ -503,6 +503,7 @@ public class SQLiteProviderFactory : IProviderFactory
             && x.GetCustomAttributes().FirstOrDefault(a => a.GetType().Equals(typeof(AggregateAttribute))) == null
             && x.GetCustomAttributes().FirstOrDefault(a => a.GetType().Equals(typeof(FormulaAttribute))) == null
             && x.GetCustomAttributes().FirstOrDefault(a => a.GetType().Equals(typeof(ConditionAttribute))) == null
+            && x.GetCustomAttributes().FirstOrDefault(a => a.GetType().Equals(typeof(ComplexFormulaAttribute))) == null
             && x.GetCustomAttributes().FirstOrDefault(a => a.GetType().Equals(typeof(ChildEntityAttribute))) == null
             && x.CanWrite
             && x.PropertyType != typeof(UserProperties)