Ejemplo n.º 1
0
        private IAggregatorFactory BuildAggregatorFactory(ReteBuilderContext context, AggregateElement element)
        {
            IAggregatorFactory factory;

            switch (element.Name)
            {
            case AggregateElement.CollectName:
                factory = new CollectionAggregatorFactory();
                break;

            case AggregateElement.GroupByName:
                factory = new GroupByAggregatorFactory();
                break;

            case AggregateElement.ProjectName:
                factory = new ProjectionAggregatorFactory();
                break;

            case AggregateElement.FlattenName:
                factory = new FlatteningAggregatorFactory();
                break;

            default:
                factory = GetCustomFactory(element);
                break;
            }
            var compiledExpressions = CompileExpressions(context, element);

            factory.Compile(element, compiledExpressions);
            return(factory);
        }
Ejemplo n.º 2
0
        private IAggregatorFactory BuildAggregatorFactory(ReteBuilderContext context, AggregateElement element)
        {
            IAggregatorFactory factory;

            switch (element.Name)
            {
            case AggregateElement.CollectName:
                factory = new CollectionAggregatorFactory();
                break;

            case AggregateElement.GroupByName:
                factory = new GroupByAggregatorFactory();
                break;

            case AggregateElement.ProjectName:
                factory = new ProjectionAggregatorFactory();
                break;

            case AggregateElement.FlattenName:
                factory = new FlatteningAggregatorFactory();
                break;

            default:
                throw new ArgumentException(
                          $"Unrecognized aggregate element. Name={element.Name}");
            }
            var compiledExpressions = CompileExpressions(context, element);

            factory.Compile(element, compiledExpressions);
            return(factory);
        }