예제 #1
0
 private void CheckConstraintsOnNonNullableMembers(LeftCellWrapper wrapper)
 {
     foreach (MemberPath nonConditionMember in this._domainMap.NonConditionMembers(this._viewgenContext.Extent))
     {
         bool flag = nonConditionMember.EdmType is System.Data.Entity.Core.Metadata.Edm.SimpleType;
         if (!nonConditionMember.IsNullable && flag)
         {
             FragmentQuery query = RewritingValidator.AddNullConditionOnCSideFragment(wrapper, nonConditionMember, this._viewgenContext.MemberMaps);
             if (query != null && this._viewgenContext.RightFragmentQP.IsSatisfiable(query))
             {
                 this._errorLog.AddEntry(new ErrorLog.Record(ViewGenErrorCode.NullableMappingForNonNullableColumn, Strings.Viewgen_NullableMappingForNonNullableColumn((object)wrapper.LeftExtent.ToString(), (object)nonConditionMember.ToFullString()), wrapper.Cells, ""));
             }
         }
     }
 }
예제 #2
0
 private void CheckConstraintsOnProjectedConditionMembers(
     Dictionary <RewritingValidator.MemberValueBinding, CellTreeNode> memberValueTrees,
     LeftCellWrapper wrapper,
     CellTreeNode sQueryTree,
     BoolExpression inExtentCondition)
 {
     foreach (MemberPath conditionMember in this._domainMap.ConditionMembers(this._viewgenContext.Extent))
     {
         int slotNum = this._viewgenContext.MemberMaps.ProjectedSlotMap.IndexOf(conditionMember);
         MemberProjectedSlot memberProjectedSlot = wrapper.RightCellQuery.ProjectedSlotAt(slotNum) as MemberProjectedSlot;
         if (memberProjectedSlot != null)
         {
             foreach (Constant constant in this._domainMap.GetDomain(conditionMember))
             {
                 CellTreeNode cellTreeNode1;
                 if (memberValueTrees.TryGetValue(new RewritingValidator.MemberValueBinding(conditionMember, constant), out cellTreeNode1))
                 {
                     FragmentQuery cQuery = FragmentQuery.Create(RewritingValidator.PropagateCellConstantsToWhereClause(wrapper, wrapper.RightCellQuery.WhereClause, constant, conditionMember, this._viewgenContext.MemberMaps));
                     CellTreeNode  cellTreeNode2;
                     if (sQueryTree != this._basicView)
                     {
                         cellTreeNode2 = (CellTreeNode) new OpCellTreeNode(this._viewgenContext, CellTreeOpType.IJ, new CellTreeNode[2]
                         {
                             cellTreeNode1,
                             sQueryTree
                         });
                     }
                     else
                     {
                         cellTreeNode2 = cellTreeNode1;
                     }
                     CellTreeNode   cellTreeNode3 = cellTreeNode2;
                     BoolExpression unsatisfiedConstraint;
                     if (!this.CheckEquivalence(cQuery, cellTreeNode3.RightFragmentQuery, inExtentCondition, out unsatisfiedConstraint))
                     {
                         this.ReportConstraintViolation(Strings.ViewGen_CQ_DomainConstraint((object)memberProjectedSlot.ToUserString()), unsatisfiedConstraint, ViewGenErrorCode.DomainConstraintViolation, cellTreeNode3.GetLeaves().Concat <LeftCellWrapper>((IEnumerable <LeftCellWrapper>) new LeftCellWrapper[1]
                         {
                             wrapper
                         }));
                     }
                 }
             }
         }
     }
 }
예제 #3
0
        private void ReportConstraintViolation(
            string message,
            BoolExpression extraConstraint,
            ViewGenErrorCode errorCode,
            IEnumerable <LeftCellWrapper> relevantWrappers)
        {
            if (ErrorPatternMatcher.FindMappingErrors(this._viewgenContext, this._domainMap, this._errorLog))
            {
                return;
            }
            extraConstraint.ExpensiveSimplify();
            HashSet <LeftCellWrapper> leftCellWrapperSet = new HashSet <LeftCellWrapper>(relevantWrappers);

            new List <LeftCellWrapper>((IEnumerable <LeftCellWrapper>)leftCellWrapperSet).Sort(LeftCellWrapper.OriginalCellIdComparer);
            StringBuilder builder = new StringBuilder();

            builder.AppendLine(message);
            RewritingValidator.EntityConfigurationToUserString(extraConstraint, builder);
            this._errorLog.AddEntry(new ErrorLog.Record(errorCode, builder.ToString(), (IEnumerable <LeftCellWrapper>)leftCellWrapperSet, ""));
        }
예제 #4
0
 internal static void EntityConfigurationToUserString(
     BoolExpression condition,
     StringBuilder builder)
 {
     RewritingValidator.EntityConfigurationToUserString(condition, builder, true);
 }