DataObjectFieldAttribute 생성자

정의

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

오버로드

Name Description
DataObjectFieldAttribute(Boolean)

클래스의 새 인스턴스를 DataObjectFieldAttribute 초기화하고 필드가 데이터 행의 기본 키인지 여부를 나타냅니다.

DataObjectFieldAttribute(Boolean, Boolean)

클래스의 새 인스턴스를 DataObjectFieldAttribute 초기화하고 필드가 데이터 행의 기본 키인지 여부와 필드가 데이터베이스 ID 필드인지 여부를 나타냅니다.

DataObjectFieldAttribute(Boolean, Boolean, Boolean)

클래스의 DataObjectFieldAttribute 새 인스턴스를 초기화하고 필드가 데이터 행의 기본 키인지 여부, 필드가 데이터베이스 ID 필드인지 여부 및 필드가 null일 수 있는지 여부를 나타냅니다.

DataObjectFieldAttribute(Boolean, Boolean, Boolean, Int32)

클래스의 새 인스턴스를 초기화하고 필드가 데이터 행의 DataObjectFieldAttribute 기본 키인지 여부, 데이터베이스 ID 필드인지 여부, null일 수 있는지 여부 및 필드 길이를 설정합니다.

DataObjectFieldAttribute(Boolean)

클래스의 새 인스턴스를 DataObjectFieldAttribute 초기화하고 필드가 데이터 행의 기본 키인지 여부를 나타냅니다.

public:
 DataObjectFieldAttribute(bool primaryKey);
public DataObjectFieldAttribute(bool primaryKey);
new System.ComponentModel.DataObjectFieldAttribute : bool -> System.ComponentModel.DataObjectFieldAttribute
Public Sub New (primaryKey As Boolean)

매개 변수

primaryKey
Boolean

true필드가 데이터 행의 기본 키에 있음을 나타내려면 입니다. 그렇지 않으면 . false

적용 대상

DataObjectFieldAttribute(Boolean, Boolean)

클래스의 새 인스턴스를 DataObjectFieldAttribute 초기화하고 필드가 데이터 행의 기본 키인지 여부와 필드가 데이터베이스 ID 필드인지 여부를 나타냅니다.

public:
 DataObjectFieldAttribute(bool primaryKey, bool isIdentity);
public DataObjectFieldAttribute(bool primaryKey, bool isIdentity);
new System.ComponentModel.DataObjectFieldAttribute : bool * bool -> System.ComponentModel.DataObjectFieldAttribute
Public Sub New (primaryKey As Boolean, isIdentity As Boolean)

매개 변수

primaryKey
Boolean

true필드가 데이터 행의 기본 키에 있음을 나타내려면 입니다. 그렇지 않으면 . false

isIdentity
Boolean

true필드가 데이터 행을 고유하게 식별하는 ID 필드임을 나타내려면 입니다. 그렇지 않으면 . false

적용 대상

DataObjectFieldAttribute(Boolean, Boolean, Boolean)

클래스의 DataObjectFieldAttribute 새 인스턴스를 초기화하고 필드가 데이터 행의 기본 키인지 여부, 필드가 데이터베이스 ID 필드인지 여부 및 필드가 null일 수 있는지 여부를 나타냅니다.

public:
 DataObjectFieldAttribute(bool primaryKey, bool isIdentity, bool isNullable);
public DataObjectFieldAttribute(bool primaryKey, bool isIdentity, bool isNullable);
new System.ComponentModel.DataObjectFieldAttribute : bool * bool * bool -> System.ComponentModel.DataObjectFieldAttribute
Public Sub New (primaryKey As Boolean, isIdentity As Boolean, isNullable As Boolean)

매개 변수

primaryKey
Boolean

true필드가 데이터 행의 기본 키에 있음을 나타내려면 입니다. 그렇지 않으면 . false

isIdentity
Boolean

true필드가 데이터 행을 고유하게 식별하는 ID 필드임을 나타내려면 입니다. 그렇지 않으면 . false

isNullable
Boolean

true데이터 저장소에서 필드가 null일 수 있음을 나타내려면 입니다. 그렇지 않으면 . false

예제

다음 코드 예제에서는 공개적으로 노출 된 속성에 적용 DataObjectFieldAttribute 하 고 속성과 연결 된 메타 데이터를 식별 하는 방법을 보여 줍니다. 이 예제에서 형식은 NorthwindEmployee 세 가지 데이터 속성인 EmployeeID, FirstNameLastName.를 노출합니다. DataObjectFieldAttribute 이 특성은 세 가지 속성 모두에 적용되지만 속성 특성만 EmployeeID 데이터 행의 기본 키임을 나타냅니다.

public class NorthwindEmployee
{
  public NorthwindEmployee() { }

  private int _employeeID;
  [DataObjectFieldAttribute(true, true, false)]
  public int EmployeeID
  {
    get { return _employeeID; }
    set { _employeeID = value; }
  }

  private string _firstName = String.Empty;
  [DataObjectFieldAttribute(false, false, true)]
  public string FirstName
  {
    get { return _firstName; }
    set { _firstName = value; }
  }

  private string _lastName = String.Empty;
  [DataObjectFieldAttribute(false, false, true)]
  public string LastName
  {
    get { return _lastName; }
    set { _lastName = value; }
  }
}
Public Class NorthwindEmployee

  Public Sub New()
  End Sub

  Private _employeeID As Integer
  <DataObjectFieldAttribute(True, True, False)> _
  Public Property EmployeeID() As Integer
    Get
      Return _employeeID
    End Get
    Set(ByVal value As Integer)
      _employeeID = value
    End Set
  End Property

  Private _firstName As String = String.Empty
  <DataObjectFieldAttribute(False, False, False)> _
  Public Property FirstName() As String
    Get
      Return _firstName
    End Get
    Set(ByVal value As String)
      _firstName = value
    End Set
  End Property

  Private _lastName As String = String.Empty
  <DataObjectFieldAttribute(False, False, False)> _
  Public Property LastName() As String
    Get
      Return _lastName
    End Get
    Set(ByVal value As String)
      _lastName = value
    End Set
  End Property

End Class

적용 대상

DataObjectFieldAttribute(Boolean, Boolean, Boolean, Int32)

클래스의 새 인스턴스를 초기화하고 필드가 데이터 행의 DataObjectFieldAttribute 기본 키인지 여부, 데이터베이스 ID 필드인지 여부, null일 수 있는지 여부 및 필드 길이를 설정합니다.

public:
 DataObjectFieldAttribute(bool primaryKey, bool isIdentity, bool isNullable, int length);
public DataObjectFieldAttribute(bool primaryKey, bool isIdentity, bool isNullable, int length);
new System.ComponentModel.DataObjectFieldAttribute : bool * bool * bool * int -> System.ComponentModel.DataObjectFieldAttribute
Public Sub New (primaryKey As Boolean, isIdentity As Boolean, isNullable As Boolean, length As Integer)

매개 변수

primaryKey
Boolean

true필드가 데이터 행의 기본 키에 있음을 나타내려면 입니다. 그렇지 않으면 . false

isIdentity
Boolean

true필드가 데이터 행을 고유하게 식별하는 ID 필드임을 나타내려면 입니다. 그렇지 않으면 . false

isNullable
Boolean

true데이터 저장소에서 필드가 null일 수 있음을 나타내려면 입니다. 그렇지 않으면 . false

length
Int32

필드의 길이(바이트)입니다.

적용 대상