Explorar el Código

Added some utility functions for aggregates

Kenric Nugteren hace 8 meses
padre
commit
5f3baef6bd
Se han modificado 1 ficheros con 12 adiciones y 0 borrados
  1. 12 0
      InABox.Core/Aggregate.cs

+ 12 - 0
InABox.Core/Aggregate.cs

@@ -184,6 +184,12 @@ namespace InABox.Core
             Links.Add(aggLink, masterLink);
             return this;
         }
+        public ComplexFormulaAggregateNode<TType, TAggregate, TResult> WithLinks(
+            IEnumerable<KeyValuePair<Expression<Func<TAggregate, object?>>, Expression<Func<TType, object?>>>> links)
+        {
+            Links.AddRange(links);
+            return this;
+        }
 
         #region IComplexFormulaAggregateNode
 
@@ -244,6 +250,12 @@ namespace InABox.Core
             node.Links.Add(aggLink, masterLink);
             return node;
         }
+        public ComplexFormulaAggregateNode<TType, TAggregate, TResult> WithLinks(
+            IEnumerable<KeyValuePair<Expression<Func<TAggregate, object?>>, Expression<Func<TType, object?>>>> links)
+        {
+            return new ComplexFormulaAggregateNode<TType, TAggregate, TResult>(Expression, Calculation, Filter,
+                new Dictionary<Expression<Func<TAggregate, object?>>, Expression<Func<TType, object?>>>().AddRange(links));
+        }
         public ComplexFormulaAggregateNode<TType, TAggregate, TResult> WithLinks(
             Dictionary<Expression<Func<TAggregate, object?>>, Expression<Func<TType, object?>>> links)
         {