EnumDataTypeAttribute 클래스

정의

.NET 열거형을 데이터 열에 매핑할 수 있습니다.

public ref class EnumDataTypeAttribute sealed : System::ComponentModel::DataAnnotations::DataTypeAttribute
[System.AttributeUsage(System.AttributeTargets.Field | System.AttributeTargets.Method | System.AttributeTargets.Parameter | System.AttributeTargets.Property, AllowMultiple=false)]
public sealed class EnumDataTypeAttribute : System.ComponentModel.DataAnnotations.DataTypeAttribute
[<System.AttributeUsage(System.AttributeTargets.Field | System.AttributeTargets.Method | System.AttributeTargets.Parameter | System.AttributeTargets.Property, AllowMultiple=false)>]
type EnumDataTypeAttribute = class
    inherit DataTypeAttribute
Public NotInheritable Class EnumDataTypeAttribute
Inherits DataTypeAttribute
상속
특성

예제

다음 예제에서는 열거형의 숫자 값을 해당 선언으로 바꾸는 방법을 보여줍니다.

public enum ReorderLevel
{
    Zero = 0,
    Five = 5,
    Ten = 10,
    Fifteen = 15,
    Twenty = 20,
    TwentyFive = 25,
    Thirty = 30
}

[MetadataType(typeof(ProductMD))]  
public partial class Product
{  
    public class ProductMD
    {  
        [EnumDataType(typeof(ReorderLevel))]  
        public object ReorderLevel { get; set; }  
    }  
}  
Imports Public Enum eReorderLvl  
    zero = 0  
    five = 5  
    ten = 10  
    fifteen = 15  
    twenty = 20  
    twenty_five = 25  
    thirty = 30  
End Enum  
<MetadataType(GetType(Product_MD))>  _  
Public Class Product  
    Public Class Product_MD  
        <EnumDataType(GetType(eReorderLvl))>  _  
        Public Property ReorderLevel As Object  
        End Property  
    End Class  
End Class  

설명

이 클래스를 사용하면 열의 기본 값을 해당 열거형 상수 이름에 매핑할 수 있습니다. 이렇게 하면 데이터베이스 값에 해당하는 설명이 포함된 열거형을 정의한 다음 데이터가 표시될 때 데이터베이스 값 대신 열거형 상수 이름을 사용할 수 있습니다.

생성자

Name Description
EnumDataTypeAttribute(Type)

EnumDataTypeAttribute 클래스의 새 인스턴스를 초기화합니다.

속성

Name Description
CustomDataType

데이터 필드와 연결된 사용자 지정 필드 템플릿의 이름을 가져옵니다.

(다음에서 상속됨 DataTypeAttribute)
DataType

데이터 필드와 연결된 형식을 가져옵니다.

(다음에서 상속됨 DataTypeAttribute)
DisplayFormat

데이터 필드 표시 형식을 가져옵니다.

(다음에서 상속됨 DataTypeAttribute)
EnumType

열거형 형식을 가져오거나 설정합니다.

ErrorMessage

유효성 검사에 실패할 경우 유효성 검사 컨트롤과 연결할 오류 메시지를 가져오거나 설정합니다.

(다음에서 상속됨 ValidationAttribute)
ErrorMessageResourceName

유효성 검사에 실패할 경우 속성 값을 조회 ErrorMessageResourceType 하기 위해 사용할 오류 메시지 리소스 이름을 가져오거나 설정합니다.

(다음에서 상속됨 ValidationAttribute)
ErrorMessageResourceType

유효성 검사에 실패할 경우 오류 메시지 조회에 사용할 리소스 유형을 가져오거나 설정합니다.

(다음에서 상속됨 ValidationAttribute)
ErrorMessageString

지역화된 유효성 검사 오류 메시지를 가져옵니다.

(다음에서 상속됨 ValidationAttribute)
RequiresValidationContext

특성에 유효성 검사 컨텍스트가 필요한지 여부를 나타내는 값을 가져옵니다.

(다음에서 상속됨 ValidationAttribute)
TypeId

파생 클래스에서 구현되는 경우 이 Attribute대한 고유 식별자를 가져옵니다.

(다음에서 상속됨 Attribute)

메서드

Name Description
Equals(Object)

이 인스턴스가 지정된 개체와 같은지 여부를 나타내는 값을 반환합니다.

(다음에서 상속됨 Attribute)
FormatErrorMessage(String)

오류가 발생한 데이터 필드에 따라 오류 메시지에 서식을 적용합니다.

(다음에서 상속됨 ValidationAttribute)
GetDataTypeName()

데이터 필드와 연결된 형식의 이름을 반환합니다.

(다음에서 상속됨 DataTypeAttribute)
GetHashCode()

이 인스턴스의 해시 코드를 반환합니다.

(다음에서 상속됨 Attribute)
GetType()

현재 인스턴스의 Type 가져옵니다.

(다음에서 상속됨 Object)
GetValidationResult(Object, ValidationContext)

현재 유효성 검사 특성과 관련하여 지정된 값이 유효한지 확인합니다.

(다음에서 상속됨 ValidationAttribute)
IsDefaultAttribute()

파생 클래스에서 재정의되는 경우 이 인스턴스의 값이 파생 클래스의 기본값인지 여부를 나타냅니다.

(다음에서 상속됨 Attribute)
IsValid(Object, ValidationContext)

현재 유효성 검사 특성과 관련하여 지정된 값의 유효성을 검사합니다.

(다음에서 상속됨 ValidationAttribute)
IsValid(Object)

데이터 필드의 값이 유효한지 확인합니다.

Match(Object)

파생 클래스에서 재정의되는 경우 이 인스턴스가 지정된 개체와 같은지 여부를 나타내는 값을 반환합니다.

(다음에서 상속됨 Attribute)
MemberwiseClone()

현재 Object단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)
Validate(Object, String)

지정된 개체의 유효성을 검사합니다.

(다음에서 상속됨 ValidationAttribute)
Validate(Object, ValidationContext)

지정된 개체의 유효성을 검사합니다.

(다음에서 상속됨 ValidationAttribute)

명시적 인터페이스 구현

Name Description
_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

이름 집합을 해당 디스패치 식별자 집합에 매핑합니다.

(다음에서 상속됨 Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

인터페이스의 형식 정보를 가져오는 데 사용할 수 있는 개체의 형식 정보를 검색합니다.

(다음에서 상속됨 Attribute)
_Attribute.GetTypeInfoCount(UInt32)

개체가 제공하는 형식 정보 인터페이스의 수를 검색합니다(0 또는 1).

(다음에서 상속됨 Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

개체에 의해 노출되는 속성 및 메서드에 대한 액세스를 제공합니다.

(다음에서 상속됨 Attribute)

적용 대상