1 //---------------------------------------------------------------------
2 // <copyright file="SchemaEnumMember.cs" company="Microsoft">
3 // Copyright (c) Microsoft Corporation. All rights reserved.
8 //---------------------------------------------------------------------
10 using System.Data.Metadata.Edm;
11 using System.Diagnostics;
12 using System.Globalization;
15 namespace System.Data.EntityModel.SchemaObjectModel
18 /// Represents enum Member element from the CSDL.
20 internal class SchemaEnumMember : SchemaElement
23 /// Value for this member.
28 /// Initializes a new instance of the <see cref="SchemaEnumMember"/> class.
30 /// <param name="parentElement">
33 public SchemaEnumMember(SchemaElement parentElement)
38 /// Gets the value of this enum member. Possibly null if not specified in the CSDL.
49 Debug.Assert(value != null, "value != null");
56 /// Generic handler for the Member element attributes
58 /// <param name="reader">Xml reader positioned on an attribute.</param>
59 /// <c>true</c> if the attribute is a known attribute and was handled. Otherwise <c>false</c>
60 protected override bool HandleAttribute(XmlReader reader)
62 Debug.Assert(reader != null, "reader != null");
64 bool handled = base.HandleAttribute(reader);
65 if (!handled && (handled = CanHandleAttribute(reader, XmlConstants.Value)))
67 HandleValueAttribute(reader);
74 /// Handler for the Member Value attribute.
76 /// <param name="reader">XmlReader positioned on the Member Value attribute.</param>
77 private void HandleValueAttribute(XmlReader reader)
79 Debug.Assert(reader != null, "reader != null");
81 // xsd validation will report an error if the value is not a valid xs:long number. If the number is valid
82 // xs:long number then long.TryParse will succeed.
84 if (long.TryParse(reader.Value, NumberStyles.AllowLeadingSign, CultureInfo.InvariantCulture, out tmpValue))