Esempio n. 1
0
        private OutputFromComputeCellGroups ComputeCellGroups(InputForComputingCellGroups args)
        {
            var result = new OutputFromComputeCellGroups();

            result.Success = true;

            var cellCreator = new CellCreator(args.ContainerMapping);

            result.Cells       = cellCreator.GenerateCells();
            result.Identifiers = cellCreator.Identifiers;

            if (result.Cells.Count <= 0)
            {
                //When type-specific QVs are asked for but not defined in the MSL we should return without generating
                // Query pipeline will handle this appropriately by asking for UNION ALL view.
                result.Success = false;
                return(result);
            }

            result.ForeignKeyConstraints = ForeignConstraint.GetForeignConstraints(args.ContainerMapping.StorageEntityContainer);

            // Go through each table and determine their foreign key constraints
            var partitioner = new CellPartitioner(result.Cells, result.ForeignKeyConstraints);
            var cellGroups  = partitioner.GroupRelatedCells();

            //Clone cell groups- i.e, List<Set<Cell>> - upto cell before storing it in the cache because viewgen modified the Cell structure
            result.CellGroups = cellGroups.Select(setOfcells => new CellGroup(setOfcells.Select(cell => new Cell(cell)))).ToList();

            return(result);
        }
        private OutputFromComputeCellGroups ComputeCellGroups(
            InputForComputingCellGroups args)
        {
            OutputFromComputeCellGroups computeCellGroups = new OutputFromComputeCellGroups();

            computeCellGroups.Success = true;
            CellCreator cellCreator = new CellCreator(args.ContainerMapping);

            computeCellGroups.Cells       = cellCreator.GenerateCells();
            computeCellGroups.Identifiers = cellCreator.Identifiers;
            if (computeCellGroups.Cells.Count <= 0)
            {
                computeCellGroups.Success = false;
                return(computeCellGroups);
            }
            computeCellGroups.ForeignKeyConstraints = ForeignConstraint.GetForeignConstraints(args.ContainerMapping.StorageEntityContainer);
            List <Set <Cell> > source = new CellPartitioner((IEnumerable <Cell>)computeCellGroups.Cells, (IEnumerable <ForeignConstraint>)computeCellGroups.ForeignKeyConstraints).GroupRelatedCells();

            computeCellGroups.CellGroups = source.Select <Set <Cell>, Set <Cell> >((Func <Set <Cell>, Set <Cell> >)(setOfcells => new Set <Cell>(setOfcells.Select <Cell, Cell>((Func <Cell, Cell>)(cell => new Cell(cell)))))).ToList <Set <Cell> >();
            return(computeCellGroups);
        }