Example #1
0
        // effects: Given a cell, determines the paths to which the paths in
        // columns map to in the C-space and returns them. If some columns
        // are not projected in the cell, or if the corresponding properties
        // are not mapped into C-space, returns null
        internal Set <EdmProperty> GetCSlotsForTableColumns(IEnumerable <MemberPath> columns)
        {
            var fieldNums = SQuery.GetProjectedPositions(columns);

            if (fieldNums == null)
            {
                return(null);
            }

            // The fields are mapped -- see if they are mapped on the
            // cSide and they correspond to the primary key of the
            // entity set

            var cSideMembers = new Set <EdmProperty>();

            foreach (var fieldNum in fieldNums)
            {
                var projectedSlot = CQuery.ProjectedSlotAt(fieldNum);
                var slot          = projectedSlot as MemberProjectedSlot;
                if (slot != null)
                {
                    // We can call LastMember since columns do not map to
                    // extents or memberEnds. Can cast to EdmProperty since it
                    // cannot be an association end
                    cSideMembers.Add((EdmProperty)slot.MemberPath.LeafEdmMember);
                }
                else
                {
                    return(null);
                }
            }
            return(cSideMembers);
        }
Example #2
0
        private void GenerateCellRelations(int cellNumber)
        {
            // Generate the view cell relation
            var projectedSlots = new List <ViewCellSlot>();

            // construct a ViewCellSlot for each slot
            Debug.Assert(
                CQuery.NumProjectedSlots == SQuery.NumProjectedSlots,
                "Cell queries in cell have a different number of slots");
            for (var i = 0; i < CQuery.NumProjectedSlots; i++)
            {
                var cSlot = CQuery.ProjectedSlotAt(i);
                var sSlot = SQuery.ProjectedSlotAt(i);
                Debug.Assert(cSlot != null, "Has cell query been normalized?");
                Debug.Assert(sSlot != null, "Has cell query been normalized?");

                // These slots better be MemberProjectedSlots. We do not have constants etc at this point.
                Debug.Assert(cSlot is MemberProjectedSlot, "cSlot is expected to be MemberProjectedSlot");
                Debug.Assert(sSlot is MemberProjectedSlot, "sSlot is expected to be MemberProjectedSlot");

                var cJoinSlot = (MemberProjectedSlot)cSlot;
                var sJoinSlot = (MemberProjectedSlot)sSlot;

                var slot = new ViewCellSlot(i, cJoinSlot, sJoinSlot);
                projectedSlots.Add(slot);
            }
            m_viewCellRelation = new ViewCellRelation(this, projectedSlots, cellNumber);
        }