예제 #1
0
        internal static bool ValidateValueCanBeWrittenAsXmlElementAnnotation(IEdmValue value, string annotationNamespace, string annotationName, out EdmError error)
        {
            IEdmStringValue edmStringValue = value as IEdmStringValue;
            if (edmStringValue == null)
            {
                error = new EdmError(value.Location(), EdmErrorCode.InvalidElementAnnotation, Edm.Strings.EdmModel_Validator_Semantic_InvalidElementAnnotationNotIEdmStringValue);
                return false;
            }

            string rawString = edmStringValue.Value;

            XmlReader reader = XmlReader.Create(new StringReader(rawString));

            try
            {
                // Skip to root element.
                if (reader.NodeType != XmlNodeType.Element)
                {
                    while (reader.Read() && reader.NodeType != XmlNodeType.Element)
                    {
                    }
                }

                // The annotation must be an element.
                if (reader.EOF)
                {
                    error = new EdmError(value.Location(), EdmErrorCode.InvalidElementAnnotation, Edm.Strings.EdmModel_Validator_Semantic_InvalidElementAnnotationValueInvalidXml);
                    return false;
                }

                // The root element must corespond to the term of the annotation
                string elementNamespace = reader.NamespaceURI;
                string elementName = reader.LocalName;

                if (EdmUtil.IsNullOrWhiteSpaceInternal(elementNamespace) || EdmUtil.IsNullOrWhiteSpaceInternal(elementName))
                {
                    error = new EdmError(value.Location(), EdmErrorCode.InvalidElementAnnotation, Edm.Strings.EdmModel_Validator_Semantic_InvalidElementAnnotationNullNamespaceOrName);
                    return false;
                }

                if (!((annotationNamespace == null || elementNamespace == annotationNamespace) && (annotationName == null || elementName == annotationName)))
                {
                    error = new EdmError(value.Location(), EdmErrorCode.InvalidElementAnnotation, Edm.Strings.EdmModel_Validator_Semantic_InvalidElementAnnotationMismatchedTerm);
                    return false;
                }

                // Parse the entire fragment to determine if the XML is valid
                while (reader.Read())
                {
                }

                error = null;
                return true;
            }
            catch (XmlException)
            {
                error = new EdmError(value.Location(), EdmErrorCode.InvalidElementAnnotation, Edm.Strings.EdmModel_Validator_Semantic_InvalidElementAnnotationValueInvalidXml);
                return false;
            }
        }
        private IEnumerable <IEdmStructuralProperty> ComputeDependentProperties()
        {
            List <IEdmStructuralProperty> edmStructuralProperties = new List <IEdmStructuralProperty>();
            IEdmEntityType entityType               = this.DependentEnd.EntityType;
            var            principalRoleType        = this.PrincipalEnd.EntityType;
            CsdlReferentialConstraintRole principal = this.constraint.Principal;
            CsdlReferentialConstraintRole dependent = this.constraint.Dependent;

            if (principalRoleType.Key().Count <IEdmStructuralProperty>() != principal.Properties.Count <CsdlPropertyReference>() || principal.Properties.Count <CsdlPropertyReference>() != dependent.Properties.Count <CsdlPropertyReference>() || this.PrincipalKeyPropertiesNotFoundInPrincipalProperties.Count <string>() != 0 || this.DependentPropertiesNotFoundInDependentType.Count <string>() != 0)
            {
                edmStructuralProperties = new List <IEdmStructuralProperty>();
                foreach (CsdlPropertyReference property in dependent.Properties)
                {
                    EdmError[] edmError = new EdmError[1];
                    edmError[0] = new EdmError(base.Location, EdmErrorCode.TypeMismatchRelationshipConstraint, Strings.CsdlSemantics_ReferentialConstraintMismatch);
                    edmStructuralProperties.Add(new BadProperty(entityType, property.PropertyName, edmError));
                }
            }
            else
            {
                IEnumerator <IEdmStructuralProperty> enumerator = this.PrincipalEnd.EntityType.Key().GetEnumerator();
                using (enumerator)
                {
                    Func <CsdlPropertyReference, bool> func = null;
                    while (enumerator.MoveNext())
                    {
                        IEdmStructuralProperty current = enumerator.Current;
                        IEnumerable <CsdlPropertyReference> properties = principal.Properties;
                        if (func == null)
                        {
                            func = (CsdlPropertyReference reference) => principalRoleType.FindProperty(reference.PropertyName).Equals(current);
                        }
                        CsdlPropertyReference csdlPropertyReference = properties.Where <CsdlPropertyReference>(func).FirstOrDefault <CsdlPropertyReference>();
                        int num = principal.IndexOf(csdlPropertyReference);
                        CsdlPropertyReference  csdlPropertyReference1 = dependent.Properties.ElementAt <CsdlPropertyReference>(num);
                        IEdmStructuralProperty edmStructuralProperty  = entityType.FindProperty(csdlPropertyReference1.PropertyName) as IEdmStructuralProperty;
                        edmStructuralProperties.Add(edmStructuralProperty);
                    }
                }
            }
            return(edmStructuralProperties);
        }
예제 #3
0
        private static bool VerifyAndGetVersion(IEdmModel model, out Version edmxVersion, out IEnumerable <EdmError> errors)
        {
            Debug.Assert(model != null);

            edmxVersion = model.GetEdmxVersion();

            errors = model.GetSerializationErrors();
            if (errors.Any())
            {
                return(false);
            }

            if (edmxVersion != null)
            {
                if (!CsdlConstants.SupportedEdmxVersions.ContainsKey(edmxVersion))
                {
                    errors = new EdmError[]
                    {
                        new EdmError(new CsdlLocation(0, 0), EdmErrorCode.UnknownEdmxVersion, Strings.Serializer_UnknownEdmxVersion(edmxVersion.ToString()))
                    };

                    return(false);
                }
            }
            else
            {
                Version edmVersion = model.GetEdmVersion() ?? EdmConstants.EdmVersionDefault;
                if (!CsdlConstants.EdmToEdmxVersions.TryGetValue(edmVersion, out edmxVersion))
                {
                    errors = new EdmError[]
                    {
                        new EdmError(new CsdlLocation(0, 0), EdmErrorCode.UnknownEdmVersion, Strings.Serializer_UnknownEdmVersion(edmVersion.ToString()))
                    };

                    return(false);
                }
            }

            errors = Enumerable.Empty <EdmError>();
            return(true);
        }
        private IEdmAssociationEnd ComputeFrom()
        {
            IEdmAssociation association = this.Association;
            string          fromRole    = this.navigationProperty.FromRole;

            if (association.End1.Name != fromRole)
            {
                if (association.End2.Name != fromRole)
                {
                    EdmError[] edmError = new EdmError[1];
                    edmError[0] = new EdmError(base.Location, EdmErrorCode.BadNavigationProperty, Strings.EdmModel_Validator_Semantic_BadNavigationPropertyUndefinedRole(this.Name, fromRole, association.Name));
                    return(new CsdlSemanticsNavigationProperty.BadCsdlSemanticsNavigationPropertyToEnd(this.Association, fromRole, edmError));
                }
                else
                {
                    return(association.End2);
                }
            }
            else
            {
                return(association.End1);
            }
        }
예제 #5
0
 internal static bool TryWriteCsdl(IEdmModel model, Func <string, XmlWriter> writerProvider, bool singleFileExpected, out IEnumerable <EdmError> errors)
 {
     EdmUtil.CheckArgumentNull <IEdmModel>(model, "model");
     EdmUtil.CheckArgumentNull <Func <string, XmlWriter> >(writerProvider, "writerProvider");
     errors = model.GetSerializationErrors();
     if (errors.FirstOrDefault <EdmError>() == null)
     {
         IEnumerable <EdmSchema> schemas = (new EdmModelSchemaSeparationSerializationVisitor(model)).GetSchemas();
         if (schemas.Count <EdmSchema>() <= 1 || !singleFileExpected)
         {
             if (schemas.Count <EdmSchema>() != 0)
             {
                 CsdlWriter.WriteSchemas(model, schemas, writerProvider);
                 errors = Enumerable.Empty <EdmError>();
                 return(true);
             }
             else
             {
                 EdmError[] edmError = new EdmError[1];
                 edmError[0] = new EdmError(new CsdlLocation(0, 0), EdmErrorCode.NoSchemasProduced, Strings.Serializer_NoSchemasProduced);
                 errors      = edmError;
                 return(false);
             }
         }
         else
         {
             EdmError[] edmErrorArray = new EdmError[1];
             edmErrorArray[0] = new EdmError(new CsdlLocation(0, 0), EdmErrorCode.SingleFileExpected, Strings.Serializer_SingleFileExpected);
             errors           = edmErrorArray;
             return(false);
         }
     }
     else
     {
         return(false);
     }
 }
        /// <summary>
        /// Outputs an EDMX artifact to the provided XmlWriter.
        /// </summary>
        /// <param name="model">Model to be written.</param>
        /// <param name="writer">XmlWriter the generated EDMX will be written to.</param>
        /// <param name="target">Target implementation of the EDMX being generated.</param>
        /// <param name="errors">Errors that prevented successful serialization, or no errors if serialization was successfull. </param>
        /// <returns>A value indicating whether serialization was successful.</returns>
        public static bool TryWriteEdmx(IEdmModel model, XmlWriter writer, EdmxTarget target, out IEnumerable <EdmError> errors)
        {
            EdmUtil.CheckArgumentNull(model, "model");
            EdmUtil.CheckArgumentNull(writer, "writer");

            errors = model.GetSerializationErrors();
            if (errors.FirstOrDefault() != null)
            {
                return(false);
            }

            Version edmxVersion = model.GetEdmxVersion();

            if (edmxVersion != null)
            {
                if (!CsdlConstants.SupportedEdmxVersions.ContainsKey(edmxVersion))
                {
                    errors = new EdmError[] { new EdmError(new CsdlLocation(0, 0), EdmErrorCode.UnknownEdmxVersion, Edm.Strings.Serializer_UnknownEdmxVersion) };
                    return(false);
                }
            }
            else if (!CsdlConstants.EdmToEdmxVersions.TryGetValue(model.GetEdmVersion() ?? EdmConstants.EdmVersionLatest, out edmxVersion))
            {
                errors = new EdmError[] { new EdmError(new CsdlLocation(0, 0), EdmErrorCode.UnknownEdmVersion, Edm.Strings.Serializer_UnknownEdmVersion) };
                return(false);
            }

            IEnumerable <EdmSchema> schemas = new EdmModelSchemaSeparationSerializationVisitor(model).GetSchemas();

            EdmxWriter edmxWriter = new EdmxWriter(model, schemas, writer, edmxVersion, target);

            edmxWriter.WriteEdmx();

            errors = Enumerable.Empty <EdmError>();
            return(true);
        }
예제 #7
0
        public void ParseCsdlAnnotationWorksButWithErrors()
        {
            string annotation = @"""@UI.DisplayName#Tablet"": {
  ""$Path"": [""FirstName""]
}";

            JsonParserContext context;
            CsdlAnnotation    csdlAnnotation = ParseAnnotation(annotation, out context);

            Assert.NotNull(csdlAnnotation);

            Assert.Equal("UI.DisplayName", csdlAnnotation.Term);
            Assert.Equal("Tablet", csdlAnnotation.Qualifier);
            Assert.NotNull(csdlAnnotation.Expression);
            CsdlPathExpression pathExp = Assert.IsType <CsdlPathExpression>(csdlAnnotation.Expression);

            Assert.Null(pathExp.Path);

            EdmError error = Assert.Single(context.Errors);

            Assert.Equal(EdmErrorCode.UnexpectedValueKind, error.ErrorCode);
            Assert.Equal("[email protected]#Tablet.$Path", error.ErrorLocation.ToString());
            Assert.Equal("An unexpected 'Array' value kind was found when parsing the JSON path '[email protected]#Tablet.$Path'. A 'String' value kind was expected.", error.ErrorMessage);
        }
예제 #8
0
        internal static bool ValidateValueCanBeWrittenAsXmlElementAnnotation(IEdmValue value, string annotationNamespace, string annotationName, out EdmError error)
        {
            IEdmStringValue edmStringValue = value as IEdmStringValue;

            if (edmStringValue == null)
            {
                error = new EdmError(value.Location(), EdmErrorCode.InvalidElementAnnotation, Edm.Strings.EdmModel_Validator_Semantic_InvalidElementAnnotationNotIEdmStringValue);
                return(false);
            }

            string rawString = edmStringValue.Value;

            XmlReader reader = XmlReader.Create(new StringReader(rawString));

            try
            {
                // Skip to root element.
                if (reader.NodeType != XmlNodeType.Element)
                {
                    while (reader.Read() && reader.NodeType != XmlNodeType.Element)
                    {
                    }
                }

                // The annotation must be an element.
                if (reader.EOF)
                {
                    error = new EdmError(value.Location(), EdmErrorCode.InvalidElementAnnotation, Edm.Strings.EdmModel_Validator_Semantic_InvalidElementAnnotationValueInvalidXml);
                    return(false);
                }

                // The root element must corespond to the term of the annotation
                string elementNamespace = reader.NamespaceURI;
                string elementName      = reader.LocalName;

                if (EdmUtil.IsNullOrWhiteSpaceInternal(elementNamespace) || EdmUtil.IsNullOrWhiteSpaceInternal(elementName))
                {
                    error = new EdmError(value.Location(), EdmErrorCode.InvalidElementAnnotation, Edm.Strings.EdmModel_Validator_Semantic_InvalidElementAnnotationNullNamespaceOrName);
                    return(false);
                }

                if (!((annotationNamespace == null || elementNamespace == annotationNamespace) && (annotationName == null || elementName == annotationName)))
                {
                    error = new EdmError(value.Location(), EdmErrorCode.InvalidElementAnnotation, Edm.Strings.EdmModel_Validator_Semantic_InvalidElementAnnotationMismatchedTerm);
                    return(false);
                }

                // Parse the entire fragment to determine if the XML is valid
                while (reader.Read())
                {
                }

                error = null;
                return(true);
            }
            catch (Exception)
            {
                error = new EdmError(value.Location(), EdmErrorCode.InvalidElementAnnotation, Edm.Strings.EdmModel_Validator_Semantic_InvalidElementAnnotationValueInvalidXml);
                return(false);
            }
        }
예제 #9
0
 internal static bool IsInterfaceCritical(EdmError error)
 {
     return(error.ErrorCode >= EdmErrorCode.InterfaceCriticalPropertyValueMustNotBeNull && error.ErrorCode <= EdmErrorCode.InterfaceCriticalCycleInTypeHierarchy);
 }
예제 #10
0
        public static bool TryParse(IEnumerable <XmlReader> csdlReaders, out CsdlModel entityModel, out IEnumerable <EdmError> errors)
        {
            bool flag;

            EdmUtil.CheckArgumentNull <IEnumerable <XmlReader> >(csdlReaders, "csdlReaders");
            CsdlParser csdlParser = new CsdlParser();
            int        num        = 0;
            IEnumerator <XmlReader> enumerator = csdlReaders.GetEnumerator();

            using (enumerator)
            {
                while (enumerator.MoveNext())
                {
                    XmlReader current = enumerator.Current;
                    if (current == null)
                    {
                        entityModel = null;
                        EdmError[] edmError = new EdmError[1];
                        edmError[0] = new EdmError(null, EdmErrorCode.NullXmlReader, Strings.CsdlParser_NullXmlReader);
                        errors      = edmError;
                        flag        = false;
                        return(flag);
                    }
                    else
                    {
                        try
                        {
                            csdlParser.AddReader(current);
                        }
                        catch (XmlException xmlException1)
                        {
                            XmlException xmlException = xmlException1;
                            entityModel = null;
                            EdmError[] edmErrorArray = new EdmError[1];
                            edmErrorArray[0] = new EdmError(new CsdlLocation(xmlException.LineNumber, xmlException.LinePosition), EdmErrorCode.XmlError, xmlException.Message);
                            errors           = edmErrorArray;
                            flag             = false;
                            return(flag);
                        }
                        num++;
                    }
                }
                goto Label0;
            }
            return(flag);

Label0:
            if (num != 0)
            {
                bool result = csdlParser.GetResult(out entityModel, out errors);
                if (!result)
                {
                    entityModel = null;
                }
                return(result);
            }
            else
            {
                entityModel = null;
                EdmError[] edmError1 = new EdmError[1];
                edmError1[0] = new EdmError(null, EdmErrorCode.NoReadersProvided, Strings.CsdlParser_NoReadersProvided);
                errors       = edmError1;
                return(false);
            }
        }
예제 #11
0
        internal static bool ValidateValueCanBeWrittenAsXmlElementAnnotation(IEdmValue value, string annotationNamespace, string annotationName, out EdmError error)
        {
            bool            flag;
            IEdmStringValue edmStringValue = value as IEdmStringValue;

            if (edmStringValue != null)
            {
                string    str       = edmStringValue.Value;
                XmlReader xmlReader = XmlReader.Create(new StringReader(str));
                try
                {
                    if (xmlReader.NodeType != XmlNodeType.Element)
                    {
                        while (xmlReader.Read() && xmlReader.NodeType != XmlNodeType.Element)
                        {
                        }
                    }
                    if (!xmlReader.EOF)
                    {
                        string namespaceURI = xmlReader.NamespaceURI;
                        string localName    = xmlReader.LocalName;
                        if (EdmUtil.IsNullOrWhiteSpaceInternal(namespaceURI) || EdmUtil.IsNullOrWhiteSpaceInternal(localName))
                        {
                            error = new EdmError(value.Location(), EdmErrorCode.InvalidElementAnnotation, Strings.EdmModel_Validator_Semantic_InvalidElementAnnotationNullNamespaceOrName);
                            flag  = false;
                        }
                        else
                        {
                            if ((annotationNamespace == null || namespaceURI == annotationNamespace) && (annotationName == null || localName == annotationName))
                            {
                                while (xmlReader.Read())
                                {
                                }
                                error = null;
                                flag  = true;
                            }
                            else
                            {
                                error = new EdmError(value.Location(), EdmErrorCode.InvalidElementAnnotation, Strings.EdmModel_Validator_Semantic_InvalidElementAnnotationMismatchedTerm);
                                flag  = false;
                            }
                        }
                    }
                    else
                    {
                        error = new EdmError(value.Location(), EdmErrorCode.InvalidElementAnnotation, Strings.EdmModel_Validator_Semantic_InvalidElementAnnotationValueInvalidXml);
                        flag  = false;
                    }
                }
                catch (Exception exception)
                {
                    error = new EdmError(value.Location(), EdmErrorCode.InvalidElementAnnotation, Strings.EdmModel_Validator_Semantic_InvalidElementAnnotationValueInvalidXml);
                    flag  = false;
                }
                return(flag);
            }
            else
            {
                error = new EdmError(value.Location(), EdmErrorCode.InvalidElementAnnotation, Strings.EdmModel_Validator_Semantic_InvalidElementAnnotationNotIEdmStringValue);
                return(false);
            }
        }
예제 #12
0
        private IEdmVocabularyAnnotatable ComputeTarget()
        {
            IEdmEntityContainer edmEntityContainer;

            if (this.targetContext == null)
            {
                string target   = this.annotationsContext.Annotations.Target;
                char[] chrArray = new char[1];
                chrArray[0] = '/';
                string[] strArrays = target.Split(chrArray);
                int      num       = strArrays.Count <string>();
                if (num != 1)
                {
                    if (num != 2)
                    {
                        if (num == 3)
                        {
                            edmEntityContainer = this.Model.FindEntityContainer(strArrays[0]);
                            if (edmEntityContainer != null)
                            {
                                IEdmEntityContainer edmEntityContainer1 = edmEntityContainer;
                                IEdmFunctionImport  edmFunctionImport   = this.FindParameterizedFunction <IEdmFunctionImport>(strArrays[1], new Func <string, IEnumerable <IEdmFunctionImport> >(edmEntityContainer1.FindFunctionImports), new Func <IEnumerable <IEdmFunctionImport>, IEdmFunctionImport>(this.CreateAmbiguousFunctionImport));
                                if (edmFunctionImport != null)
                                {
                                    IEdmFunctionParameter edmFunctionParameter = edmFunctionImport.FindParameter(strArrays[2]);
                                    if (edmFunctionParameter == null)
                                    {
                                        return(new UnresolvedParameter(edmFunctionImport, strArrays[1], base.Location));
                                    }
                                    else
                                    {
                                        return(edmFunctionParameter);
                                    }
                                }
                            }
                        }
                        EdmError[] edmError = new EdmError[1];
                        edmError[0] = new EdmError(base.Location, EdmErrorCode.ImpossibleAnnotationsTarget, Strings.CsdlSemantics_ImpossibleAnnotationsTarget(target));
                        return(new BadElement(edmError));
                    }
                    else
                    {
                        edmEntityContainer = this.schema.FindEntityContainer(strArrays[0]);
                        if (edmEntityContainer == null)
                        {
                            IEdmStructuredType edmStructuredType = this.schema.FindType(strArrays[0]) as IEdmStructuredType;
                            if (edmStructuredType == null)
                            {
                                IEdmFunction edmFunction = this.FindParameterizedFunction <IEdmFunction>(strArrays[0], new Func <string, IEnumerable <IEdmFunction> >(this.Schema.FindFunctions), new Func <IEnumerable <IEdmFunction>, IEdmFunction>(this.CreateAmbiguousFunction));
                                if (edmFunction == null)
                                {
                                    return(new UnresolvedProperty(new UnresolvedEntityType(this.Schema.UnresolvedName(strArrays[0]), base.Location), strArrays[1], base.Location));
                                }
                                else
                                {
                                    IEdmFunctionParameter edmFunctionParameter1 = edmFunction.FindParameter(strArrays[1]);
                                    if (edmFunctionParameter1 == null)
                                    {
                                        return(new UnresolvedParameter(edmFunction, strArrays[1], base.Location));
                                    }
                                    else
                                    {
                                        return(edmFunctionParameter1);
                                    }
                                }
                            }
                            else
                            {
                                IEdmProperty edmProperty = edmStructuredType.FindProperty(strArrays[1]);
                                if (edmProperty == null)
                                {
                                    return(new UnresolvedProperty(edmStructuredType, strArrays[1], base.Location));
                                }
                                else
                                {
                                    return(edmProperty);
                                }
                            }
                        }
                        else
                        {
                            IEdmEntityContainerElement edmEntityContainerElement = edmEntityContainer.FindEntitySet(strArrays[1]);
                            if (edmEntityContainerElement == null)
                            {
                                IEdmEntityContainer edmEntityContainer2 = edmEntityContainer;
                                IEdmFunctionImport  edmFunctionImport1  = this.FindParameterizedFunction <IEdmFunctionImport>(strArrays[1], new Func <string, IEnumerable <IEdmFunctionImport> >(edmEntityContainer2.FindFunctionImports), new Func <IEnumerable <IEdmFunctionImport>, IEdmFunctionImport>(this.CreateAmbiguousFunctionImport));
                                if (edmFunctionImport1 == null)
                                {
                                    return(new UnresolvedEntitySet(strArrays[1], edmEntityContainer, base.Location));
                                }
                                else
                                {
                                    return(edmFunctionImport1);
                                }
                            }
                            else
                            {
                                return(edmEntityContainerElement);
                            }
                        }
                    }
                }
                else
                {
                    string         str           = strArrays[0];
                    IEdmSchemaType edmSchemaType = this.schema.FindType(str);
                    if (edmSchemaType == null)
                    {
                        IEdmValueTerm edmValueTerm = this.schema.FindValueTerm(str);
                        if (edmValueTerm == null)
                        {
                            IEdmFunction edmFunction1 = this.FindParameterizedFunction <IEdmFunction>(str, new Func <string, IEnumerable <IEdmFunction> >(this.Schema.FindFunctions), new Func <IEnumerable <IEdmFunction>, IEdmFunction>(this.CreateAmbiguousFunction));
                            if (edmFunction1 == null)
                            {
                                edmEntityContainer = this.schema.FindEntityContainer(str);
                                if (edmEntityContainer == null)
                                {
                                    return(new UnresolvedType(this.Schema.UnresolvedName(strArrays[0]), base.Location));
                                }
                                else
                                {
                                    return(edmEntityContainer);
                                }
                            }
                            else
                            {
                                return(edmFunction1);
                            }
                        }
                        else
                        {
                            return(edmValueTerm);
                        }
                    }
                    else
                    {
                        return(edmSchemaType);
                    }
                }
            }
            else
            {
                return(this.targetContext);
            }
        }
예제 #13
0
 internal static bool IsInterfaceCritical(EdmError error)
 {
     return error.ErrorCode >= EdmErrorCode.InterfaceCriticalPropertyValueMustNotBeNull && error.ErrorCode <= EdmErrorCode.InterfaceCriticalCycleInTypeHierarchy;
 }
예제 #14
0
 internal static bool SignificantToSerialization(EdmError error)
 {
     if (!ValidationHelper.IsInterfaceCritical(error))
     {
         EdmErrorCode errorCode = error.ErrorCode;
         if (errorCode > EdmErrorCode.RowTypeMustNotHaveBaseType)
         {
             if (errorCode > EdmErrorCode.EnumMemberTypeMustMatchEnumUnderlyingType)
             {
                 if (errorCode != EdmErrorCode.ReferencedTypeMustHaveValidName)
                 {
                     if (errorCode == EdmErrorCode.InvalidFunctionImportParameterMode || errorCode == EdmErrorCode.TypeMustNotHaveKindOfNone || errorCode == EdmErrorCode.PrimitiveTypeMustNotHaveKindOfNone || errorCode == EdmErrorCode.PropertyMustNotHaveKindOfNone || errorCode == EdmErrorCode.TermMustNotHaveKindOfNone || errorCode == EdmErrorCode.SchemaElementMustNotHaveKindOfNone || errorCode == EdmErrorCode.EntityContainerElementMustNotHaveKindOfNone || errorCode == EdmErrorCode.BinaryValueCannotHaveEmptyValue)
                     {
                         return(true);
                     }
                     if (errorCode != EdmErrorCode.EnumMustHaveIntegerUnderlyingType)
                     {
                         return(false);
                     }
                 }
             }
             else
             {
                 if (errorCode == EdmErrorCode.OnlyInputParametersAllowedInFunctions || errorCode == EdmErrorCode.FunctionImportParameterIncorrectType)
                 {
                     return(true);
                 }
                 else if (errorCode == EdmErrorCode.ComplexTypeMustHaveProperties)
                 {
                     return(false);
                 }
                 if (errorCode == EdmErrorCode.EnumMemberTypeMustMatchEnumUnderlyingType)
                 {
                     return(true);
                 }
                 return(false);
             }
         }
         else
         {
             if (errorCode > EdmErrorCode.NameTooLong)
             {
                 if (errorCode != EdmErrorCode.FunctionImportEntitySetExpressionIsInvalid)
                 {
                     if (errorCode == EdmErrorCode.SystemNamespaceEncountered || errorCode == EdmErrorCode.InvalidNamespaceName)
                     {
                         return(true);
                     }
                     else if ((int)errorCode == 162)
                     {
                         return(false);
                     }
                     if (errorCode == EdmErrorCode.RowTypeMustNotHaveBaseType)
                     {
                         return(true);
                     }
                     return(false);
                 }
             }
             else
             {
                 if (errorCode == EdmErrorCode.InvalidName || errorCode == EdmErrorCode.NameTooLong)
                 {
                     return(true);
                 }
                 return(false);
             }
         }
         return(true);
     }
     else
     {
         return(true);
     }
 }