private void MatchMissingMappingErrors() { if (this.m_viewgenContext.ViewTarget != ViewTarget.QueryView) { return; } Set <EdmType> set = new Set <EdmType>(MetadataHelper.GetTypeAndSubtypesOf((EdmType)this.m_viewgenContext.Extent.ElementType, (ItemCollection)this.m_viewgenContext.EdmItemCollection, false)); foreach (LeftCellWrapper leftCellWrapper in this.m_viewgenContext.AllWrappersForExtent) { foreach (Cell cell in leftCellWrapper.Cells) { foreach (MemberRestriction condition in cell.CQuery.Conditions) { foreach (Constant constant in condition.Domain.Values) { TypeConstant typeConstant = constant as TypeConstant; if (typeConstant != null) { set.Remove(typeConstant.EdmType); } } } } } if (set.Count <= 0) { return; } this.m_errorLog.AddEntry(new ErrorLog.Record(ViewGenErrorCode.ErrorPatternMissingMappingError, Strings.ViewGen_Missing_Type_Mapping((object)ErrorPatternMatcher.BuildCommaSeparatedErrorString <EdmType>((IEnumerable <EdmType>)set)), (IEnumerable <LeftCellWrapper>) this.m_viewgenContext.AllWrappersForExtent, "")); }
private void MatchConditionErrors() { List <LeftCellWrapper> wrappersForExtent = this.m_viewgenContext.AllWrappersForExtent; Set <MemberPath> mappedConditionMembers = new Set <MemberPath>(); Set <Dictionary <MemberPath, Set <Constant> > > set1 = new Set <Dictionary <MemberPath, Set <Constant> > >((IEqualityComparer <Dictionary <MemberPath, Set <Constant> > >) new ConditionComparer()); Dictionary <Dictionary <MemberPath, Set <Constant> >, LeftCellWrapper> dictionary = new Dictionary <Dictionary <MemberPath, Set <Constant> >, LeftCellWrapper>((IEqualityComparer <Dictionary <MemberPath, Set <Constant> > >) new ConditionComparer()); foreach (LeftCellWrapper leftCellWrapper in wrappersForExtent) { Dictionary <MemberPath, Set <Constant> > index = new Dictionary <MemberPath, Set <Constant> >(); foreach (MemberRestriction memberRestriction in leftCellWrapper.OnlyInputCell.GetLeftQuery(this.m_viewgenContext.ViewTarget).GetConjunctsFromWhereClause()) { MemberPath memberPath = memberRestriction.RestrictedMemberSlot.MemberPath; if (this.m_domainMap.IsConditionMember(memberPath)) { ScalarRestriction scalarRestriction = memberRestriction as ScalarRestriction; if (scalarRestriction != null && !mappedConditionMembers.Contains(memberPath) && (!leftCellWrapper.OnlyInputCell.CQuery.WhereClause.Equals((object)leftCellWrapper.OnlyInputCell.SQuery.WhereClause) && !ErrorPatternMatcher.IsMemberPartOfNotNullCondition((IEnumerable <LeftCellWrapper>)wrappersForExtent, memberPath, this.m_viewgenContext.ViewTarget))) { this.CheckThatConditionMemberIsNotMapped(memberPath, wrappersForExtent, mappedConditionMembers); } if (this.m_viewgenContext.ViewTarget == ViewTarget.UpdateView && scalarRestriction != null && memberPath.IsNullable) { if (ErrorPatternMatcher.IsMemberPartOfNotNullCondition((IEnumerable <LeftCellWrapper>) new LeftCellWrapper[1] { leftCellWrapper }, memberPath, this.m_viewgenContext.ViewTarget)) { MemberPath rightMemberPath = ErrorPatternMatcher.GetRightMemberPath(memberPath, leftCellWrapper); if (rightMemberPath != null && rightMemberPath.IsNullable) { if (!ErrorPatternMatcher.IsMemberPartOfNotNullCondition((IEnumerable <LeftCellWrapper>) new LeftCellWrapper[1] { leftCellWrapper }, rightMemberPath, this.m_viewgenContext.ViewTarget)) { this.m_errorLog.AddEntry(new ErrorLog.Record(ViewGenErrorCode.ErrorPatternConditionError, Strings.Viewgen_ErrorPattern_NotNullConditionMappedToNullableMember((object)memberPath, (object)rightMemberPath), leftCellWrapper.OnlyInputCell, "")); } } } } foreach (Constant element in memberRestriction.Domain.Values) { Set <Constant> set2; if (!index.TryGetValue(memberPath, out set2)) { set2 = new Set <Constant>(Constant.EqualityComparer); index.Add(memberPath, set2); } set2.Add(element); } } } if (index.Count > 0) { if (set1.Contains(index)) { if (!this.RightSideEqual(dictionary[index], leftCellWrapper)) { this.m_errorLog.AddEntry(new ErrorLog.Record(ViewGenErrorCode.ErrorPatternConditionError, Strings.Viewgen_ErrorPattern_DuplicateConditionValue((object)ErrorPatternMatcher.BuildCommaSeparatedErrorString <MemberPath>((IEnumerable <MemberPath>)index.Keys)), ErrorPatternMatcher.ToIEnum(dictionary[index].OnlyInputCell, leftCellWrapper.OnlyInputCell), "")); } } else { set1.Add(index); dictionary.Add(index, leftCellWrapper); } } } }