Kenric Nugteren преди 2 години
родител
ревизия
945a0cfdb8
променени са 2 файла, в които са добавени 7 реда и са изтрити 2 реда
  1. 2 2
      InABox.Core/Aggregate.cs
  2. 5 0
      InABox.Core/Filter.cs

+ 2 - 2
InABox.Core/Aggregate.cs

@@ -159,12 +159,12 @@ namespace InABox.Core
             var intf = Calculator.GetType().GetInterfaces()
                 .FirstOrDefault(i => i.IsGenericType && i.GetGenericTypeDefinition() == typeof(ICoreAggregate<,,>));
             if (intf != null)
-                return intf.GenericTypeArguments.Skip(1).FirstOrDefault();
+                return intf.GenericTypeArguments[1];
             
             intf = Calculator.GetType().GetInterfaces()
                 .FirstOrDefault(i => i.IsGenericType && i.GetGenericTypeDefinition() == typeof(ICoreAggregate<,>));
             if (intf != null)
-                return intf.GenericTypeArguments.FirstOrDefault();
+                return intf.GenericTypeArguments[0];
             
             throw new Exception("Unable to Locate Type Information for Aggregate");
         }

+ 5 - 0
InABox.Core/Filter.cs

@@ -216,6 +216,11 @@ namespace InABox.Core
             var type = typeof(Filter<>).MakeGenericType(concrete);
             return (Activator.CreateInstance(type) as IFilter)!;
         }
+        public static IFilter Create(Type concrete, string property)
+        {
+            var type = typeof(Filter<>).MakeGenericType(concrete);
+            return (Activator.CreateInstance(type, property) as IFilter)!;
+        }
     }
 
     public interface IFilter2<T>