Example #1
0
        public static bool FindMappingErrors(ViewgenContext context, MemberDomainMap domainMap, ErrorLog errorLog)
        {
            //Can't get here if Update Views have validation disabled
            Debug.Assert(context.ViewTarget == ViewTarget.QueryView || context.Config.IsValidationEnabled);

            if (context.ViewTarget == ViewTarget.QueryView &&
                !context.Config.IsValidationEnabled)
            {
                return(false); // Rules for QV under no validation are different
            }

            var matcher = new ErrorPatternMatcher(context, domainMap, errorLog);

            matcher.MatchMissingMappingErrors();
            matcher.MatchConditionErrors();
            matcher.MatchSplitErrors();

            if (matcher.m_errorLog.Count
                == matcher.m_originalErrorCount)
            {
                //this will generate redundant errors if one of the above routine finds an error
                // so execute it only when we dont have any other errors
                matcher.MatchPartitionErrors();
            }

            if (matcher.m_errorLog.Count
                > matcher.m_originalErrorCount)
            {
                ExceptionHelpers.ThrowMappingException(matcher.m_errorLog, matcher.m_viewgenContext.Config);
            }

            return(false);
        }
        public static bool FindMappingErrors(
            ViewgenContext context,
            MemberDomainMap domainMap,
            ErrorLog errorLog)
        {
            if (context.ViewTarget == ViewTarget.QueryView && !context.Config.IsValidationEnabled)
            {
                return(false);
            }
            ErrorPatternMatcher errorPatternMatcher = new ErrorPatternMatcher(context, domainMap, errorLog);

            errorPatternMatcher.MatchMissingMappingErrors();
            errorPatternMatcher.MatchConditionErrors();
            errorPatternMatcher.MatchSplitErrors();
            if (errorPatternMatcher.m_errorLog.Count == errorPatternMatcher.m_originalErrorCount)
            {
                errorPatternMatcher.MatchPartitionErrors();
            }
            if (errorPatternMatcher.m_errorLog.Count > errorPatternMatcher.m_originalErrorCount)
            {
                ExceptionHelpers.ThrowMappingException(errorPatternMatcher.m_errorLog, errorPatternMatcher.m_viewgenContext.Config);
            }
            return(false);
        }