protected EdmMultiplicity RequiredMultiplicity(string attributeName)
        {
            XmlAttributeInfo attr = this.GetRequiredAttribute(this.currentElement, attributeName);

            if (!attr.IsMissing)
            {
                switch (attr.Value)
                {
                case CsdlConstants.Value_EndRequired:
                    return(EdmMultiplicity.One);

                case CsdlConstants.Value_EndOptional:
                    return(EdmMultiplicity.ZeroOrOne);

                case CsdlConstants.Value_EndMany:
                    return(EdmMultiplicity.Many);

                default:
                    this.ReportError(this.currentElement.Location, EdmErrorCode.InvalidMultiplicity, Edm.Strings.CsdlParser_InvalidMultiplicity(attr.Value));
                    break;
                }
            }

            return(EdmMultiplicity.One);
        }
        protected string RequiredQualifiedName(string attributeName)
        {
            XmlAttributeInfo attr = this.GetRequiredAttribute(this.currentElement, attributeName);

            if (!attr.IsMissing)
            {
                return(this.ValidateQualifiedName(attr.Value));
            }

            return(null);
        }
        protected string OptionalQualifiedName(string attributeName)
        {
            XmlAttributeInfo attr = GetOptionalAttribute(this.currentElement, attributeName);

            if (!attr.IsMissing)
            {
                return(this.ValidateQualifiedName(attr.Value));
            }

            return(null);
        }
        protected string RequiredEnumMemberPath(string attributeName)
        {
            XmlAttributeInfo attr = this.GetRequiredAttribute(this.currentElement, attributeName);

            if (!attr.IsMissing)
            {
                return(this.ValidateEnumMemberPath(attr.Value));
            }

            return(null);
        }
        protected bool?OptionalBoolean(string attributeName)
        {
            XmlAttributeInfo attr = GetOptionalAttribute(this.currentElement, attributeName);

            if (!attr.IsMissing)
            {
                bool?value;
                if (!EdmValueParser.TryParseBool(attr.Value, out value))
                {
                    this.ReportError(this.currentElement.Location, EdmErrorCode.InvalidBoolean, Edm.Strings.ValueParser_InvalidBoolean(attr.Value));
                }

                return(value);
            }

            return(null);
        }
        protected int?OptionalMaxLength(string attributeName)
        {
            XmlAttributeInfo attr = GetOptionalAttribute(this.currentElement, attributeName);

            if (!attr.IsMissing)
            {
                int?value;
                if (!EdmValueParser.TryParseInt(attr.Value, out value))
                {
                    this.ReportError(this.currentElement.Location, EdmErrorCode.InvalidMaxLength, Edm.Strings.ValueParser_InvalidMaxLength(attr.Value));
                }

                return(value);
            }

            return(null);
        }
        protected long?OptionalLong(string attributeName)
        {
            XmlAttributeInfo attr = this.GetOptionalAttribute(this.currentElement, attributeName);

            if (!attr.IsMissing)
            {
                long?value;
                if (!EdmValueParser.TryParseLong(attr.Value, out value))
                {
                    this.ReportError(this.currentElement.Location, EdmErrorCode.InvalidLong, Edm.Strings.ValueParser_InvalidLong(attr.Value));
                }

                return(value);
            }

            return(null);
        }
        protected EdmOnDeleteAction RequiredOnDeleteAction(string attributeName)
        {
            XmlAttributeInfo attr = this.GetRequiredAttribute(this.currentElement, attributeName);

            if (!attr.IsMissing)
            {
                switch (attr.Value)
                {
                case CsdlConstants.Value_None:
                    return(EdmOnDeleteAction.None);

                case CsdlConstants.Value_Cascade:
                    return(EdmOnDeleteAction.Cascade);

                default:
                    this.ReportError(this.currentElement.Location, EdmErrorCode.InvalidOnDelete, Edm.Strings.CsdlParser_InvalidDeleteAction(attr.Value));
                    break;
                }
            }

            return(EdmOnDeleteAction.None);
        }
        protected EdmConcurrencyMode?OptionalConcurrencyMode(string attributeName)
        {
            XmlAttributeInfo attr = this.GetOptionalAttribute(this.currentElement, attributeName);

            if (!attr.IsMissing)
            {
                switch (attr.Value)
                {
                case CsdlConstants.Value_None:
                    return(EdmConcurrencyMode.None);

                case CsdlConstants.Value_Fixed:
                    return(EdmConcurrencyMode.Fixed);

                default:
                    this.ReportError(this.currentElement.Location, EdmErrorCode.InvalidConcurrencyMode, Edm.Strings.CsdlParser_InvalidConcurrencyMode(attr.Value));
                    break;
                }
            }

            return(null);
        }
        protected int?OptionalScale(string attributeName)
        {
            XmlAttributeInfo attr = GetOptionalAttribute(this.currentElement, attributeName);

            if (!attr.IsMissing)
            {
                int?scale;
                if (attr.Value.EqualsOrdinalIgnoreCase(CsdlConstants.Value_ScaleVariable))
                {
                    scale = null;
                }
                else
                {
                    if (!EdmValueParser.TryParseInt(attr.Value, out scale))
                    {
                        this.ReportError(this.currentElement.Location, EdmErrorCode.InvalidSrid, Edm.Strings.ValueParser_InvalidScale(attr.Value));
                    }
                }

                return(scale);
            }

            return(CsdlConstants.Default_Scale);
        }
        protected string Required(string attributeName)
        {
            XmlAttributeInfo attr = this.GetRequiredAttribute(this.currentElement, attributeName);

            return(!attr.IsMissing ? attr.Value : string.Empty);
        }
        protected string Optional(string attributeName)
        {
            XmlAttributeInfo attr = GetOptionalAttribute(this.currentElement, attributeName);

            return(!attr.IsMissing ? attr.Value : null);
        }