Ejemplo n.º 1
0
        /// <summary>
        /// When we are dealing with an update view, this method
        /// finds out if the given Table is mapped to different EntitySets
        /// </summary>
        private void MatchSplitErrors()
        {
            List <LeftCellWrapper> leftCellWrappers = m_viewgenContext.AllWrappersForExtent;

            //Check that the given Table is mapped to only one EntitySet (avoid AssociationSets)
            var nonAssociationWrappers = leftCellWrappers.Where(r => !(r.LeftExtent is AssociationSet) && !(r.RightCellQuery.Extent is AssociationSet));

            if (m_viewgenContext.ViewTarget == ViewTarget.UpdateView && nonAssociationWrappers.Any())
            {
                LeftCellWrapper firstLeftCWrapper = nonAssociationWrappers.First();
                EntitySetBase   rightExtent       = firstLeftCWrapper.RightCellQuery.Extent;

                foreach (var leftCellWrapper in nonAssociationWrappers)
                {
                    //!(leftCellWrapper.RightCellQuery.Extent is AssociationSet) &&
                    if (!leftCellWrapper.RightCellQuery.Extent.EdmEquals(rightExtent))
                    {
                        //A Table may be mapped to two extents but the extents may be Equal (by some form of Refconstraint)
                        if (!RightSideEqual(leftCellWrapper, firstLeftCWrapper))
                        {
                            //Report Error
                            m_errorLog.AddEntry(new ErrorLog.Record(true, ViewGenErrorCode.ErrorPatternSplittingError,
                                                                    Strings.Viewgen_ErrorPattern_TableMappedToMultipleES(leftCellWrapper.LeftExtent.ToString(), leftCellWrapper.RightCellQuery.Extent.ToString(), rightExtent.ToString()),
                                                                    leftCellWrapper.Cells.First(), ""));
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
 private static string Identity(EntitySetBase entitySet)
 {
     return(entitySet.ToString());
 }
        private void MatchSplitErrors()
        {
            IEnumerable <LeftCellWrapper> source = this.m_viewgenContext.AllWrappersForExtent.Where <LeftCellWrapper>((Func <LeftCellWrapper, bool>)(r =>
            {
                if (!(r.LeftExtent is AssociationSet))
                {
                    return(!(r.RightCellQuery.Extent is AssociationSet));
                }
                return(false);
            }));

            if (this.m_viewgenContext.ViewTarget != ViewTarget.UpdateView || !source.Any <LeftCellWrapper>())
            {
                return;
            }
            LeftCellWrapper wrapper2 = source.First <LeftCellWrapper>();
            EntitySetBase   extent   = wrapper2.RightCellQuery.Extent;

            foreach (LeftCellWrapper wrapper1 in source)
            {
                if (!wrapper1.RightCellQuery.Extent.EdmEquals((MetadataItem)extent) && !this.RightSideEqual(wrapper1, wrapper2))
                {
                    this.m_errorLog.AddEntry(new ErrorLog.Record(ViewGenErrorCode.ErrorPatternSplittingError, Strings.Viewgen_ErrorPattern_TableMappedToMultipleES((object)wrapper1.LeftExtent.ToString(), (object)wrapper1.RightCellQuery.Extent.ToString(), (object)extent.ToString()), wrapper1.Cells.First <Cell>(), ""));
                }
            }
        }