src/Misc/EFTools/EntityDesignModel/Validation/RuntimeMetadataValidator.cs
/// <summary>
///     This method returns true if the passed-in error code is one that requires the document to be opened in the XML editor,
///     with no designer.
/// </summary>
This method returns true if the passed-in error code is one that requires the document to be opened in the XML editor,
with no designer.
This method returns true if the passed - in error code is one that requires the document to be opened in the XML editor with no designer .
internal static bool IsOpenInEditorError(ErrorInfo errorInfo, EFArtifact artifact)
        {
            if ((errorInfo.ErrorClass & ErrorClass.Runtime_All) == 0)
            {
                return false;
            }
            var o = artifact.FindEFObjectForLineAndColumn(errorInfo.GetLineNumber(), errorInfo.GetColumnNumber());
            if (errorInfo.ErrorCode == (int)MappingErrorCode.XmlSchemaValidationError
                && o is ModificationFunctionMapping)
            {
                return false;
            }
            if (errorInfo.ErrorCode == (int)ErrorCode.XmlError
                && o is ReferentialConstraintRole)
            {
                return false;
            }
            if (errorInfo.ErrorCode == (int)MappingErrorCode.ConditionError
                && o is Condition)
            {
                return false;
            }
            if (errorInfo.ErrorCode == (int)ErrorCode.InvalidPropertyInRelationshipConstraint
                && o is ReferentialConstraint)
            {
                return false;
            }
            if (errorInfo.ErrorCode == ErrorCodes.ESCHER_VALIDATOR_UNDEFINED_COMPLEX_PROPERTY_TYPE
                || (errorInfo.ErrorCode == (int)ErrorCode.NotInNamespace && o is ComplexConceptualProperty))
            {
                return false;
            }
            if (errorInfo.ErrorCode == (int)ErrorCode.XmlError)
            {
                var navigationProperty = o as NavigationProperty;
                if (navigationProperty != null)
                {
                    return
                        string.IsNullOrEmpty(navigationProperty.LocalName.Value) ||
                        navigationProperty.Relationship.Status != BindingStatus.Undefined ||
                        navigationProperty.ToRole.Status != BindingStatus.Undefined ||
                        navigationProperty.FromRole.Status != BindingStatus.Undefined;
                }
            }
            return
                UnrecoverableRuntimeErrors.SchemaObjectModelErrorCodes.Any(c => c == (ErrorCode)errorInfo.ErrorCode) ||
                UnrecoverableRuntimeErrors.StorageMappingErrorCodes.Any(c => c == (MappingErrorCode)errorInfo.ErrorCode);
        }
internal static bool IsOpenInEditorError ( ErrorInfo errorInfo , EFArtifact artifact ) { if ( ( errorInfo . ErrorClass & ErrorClass . Runtime_All ) == 0 ) { return false ; } var o = artifact . FindEFObjectForLineAndColumn ( errorInfo . GetLineNumber ( ) , errorInfo . GetColumnNumber ( ) ) ; if ( errorInfo . ErrorCode == ( int ) MappingErrorCode . XmlSchemaValidationError && o is ModificationFunctionMapping ) { return false ; } if ( errorInfo . ErrorCode == ( int ) ErrorCode . XmlError && o is ReferentialConstraintRole ) { return false ; } if ( errorInfo . ErrorCode == ( int ) MappingErrorCode . ConditionError && o is Condition ) { return false ; } if ( errorInfo . ErrorCode == ( int ) ErrorCode . InvalidPropertyInRelationshipConstraint && o is ReferentialConstraint ) { return false ; } if ( errorInfo . ErrorCode == ErrorCodes . ESCHER_VALIDATOR_UNDEFINED_COMPLEX_PROPERTY_TYPE || ( errorInfo . ErrorCode == ( int ) ErrorCode . NotInNamespace && o is ComplexConceptualProperty ) ) { return false ; } if ( errorInfo . ErrorCode == ( int ) ErrorCode . XmlError ) { var navigationProperty = o as NavigationProperty ; if ( navigationProperty != null ) { return string . IsNullOrEmpty ( navigationProperty . LocalName . Value ) || navigationProperty . Relationship . Status != BindingStatus . Undefined || navigationProperty . ToRole . Status != BindingStatus . Undefined || navigationProperty . FromRole . Status != BindingStatus . Undefined ; } } return UnrecoverableRuntimeErrors . SchemaObjectModelErrorCodes . Any ( c => c == ( ErrorCode ) errorInfo . ErrorCode ) || UnrecoverableRuntimeErrors . StorageMappingErrorCodes . Any ( c => c == ( MappingErrorCode ) errorInfo . ErrorCode ) ; }
This method returns true if the passed-in error code is one that requires the document to be opened in the XML editor,
with no designer.
This method returns true if the passed - in error code is one that requires the document to be opened in the XML editor with no designer .
// we don't trigger safe-mode for XSD errors on ModificationFunctionMapping, since these can be fixed in the designer // we don't trigger safe-mode for XSD errors on referential constraint roles.  This is so we can leave the RC  // and the Role, even if it has no properties. // don't trigger safe-mode for errors based around condition validation // don't trigger safe-mode for error about Principal not being exactly identical to the EntityType key, // since we can run into this problem just by adding new key Property to the EntityType that is Principal Role for some Referential Constraint // don't trigger safe-mode for underfined/deleted complex property types, the user should be able to fix the problem in the designer. // we allow the user to have navigation properties not bound to any association via an AssociationEnd if the Name property is defined as it's still required. /* invalid name */
errorInfo
ErrorInfo
artifact
EFArtifact