1 //---------------------------------------------------------------------
2 // <copyright file="EnumMember.cs" company="Microsoft">
3 // Copyright (c) Microsoft Corporation. All rights reserved.
7 // @backupOwner Microsoft
8 //---------------------------------------------------------------------
11 using System
.Collections
.Generic
;
12 using System
.Data
.Common
;
14 using System
.Diagnostics
;
16 namespace System
.Data
.Metadata
.Edm
19 /// Represents an enumeration member.
21 public sealed class EnumMember
: MetadataItem
26 /// The name of this enumeration member.
28 private readonly string _name
;
31 /// The value of this enumeration member.
33 private readonly object _value
;
40 /// Initializes a new instance of the <see cref="EnumMember"/> type by using the specified name and value.
42 /// <param name="name">The name of this enumeration member. Must not be null or the empty string.</param>
43 /// <param name="value">The value of this enumeration member. </param>
44 /// <exception cref="System.ArgumentNullException">Thrown if name argument is null</exception>
45 /// <exception cref="System.ArgumentException">Thrown if name argument is empty string</exception>
46 internal EnumMember(string name
, object value)
47 : base(MetadataFlags
.Readonly
)
49 EntityUtil
.CheckStringArgument(name
, "name");
50 Debug
.Assert(value != null, "value != null");
51 Debug
.Assert(value is SByte
|| value is Byte
|| value is Int16
|| value is Int32
|| value is Int64
, "Unsupported type of enum member value.");
62 /// Gets the kind of this type.
64 public override BuiltInTypeKind BuiltInTypeKind
66 get { return BuiltInTypeKind.EnumMember; }
70 /// Gets the name of this enumeration member.
72 [MetadataProperty(PrimitiveTypeKind
.String
, false)]
82 /// Gets the value of this enumeration member.
84 [MetadataProperty(BuiltInTypeKind
.PrimitiveType
, false)]
94 /// Gets the identity for this item as a string
96 internal override string Identity
109 /// Overriding System.Object.ToString to provide better String representation for this type.
111 public override string ToString()