DataObjectFieldAttribute コンストラクター

定義

DataObjectFieldAttribute クラスの新しいインスタンスを初期化します。

オーバーロード

名前 説明
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.cs
ソース:
DataObjectFieldAttribute.cs
ソース:
DataObjectFieldAttribute.cs
ソース:
DataObjectFieldAttribute.cs
ソース:
DataObjectFieldAttribute.cs

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.cs
ソース:
DataObjectFieldAttribute.cs
ソース:
DataObjectFieldAttribute.cs
ソース:
DataObjectFieldAttribute.cs
ソース:
DataObjectFieldAttribute.cs

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.cs
ソース:
DataObjectFieldAttribute.cs
ソース:
DataObjectFieldAttribute.cs
ソース:
DataObjectFieldAttribute.cs
ソース:
DataObjectFieldAttribute.cs

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 型は、 EmployeeIDFirstNameLastNameの 3 つのデータ プロパティを公開しています。 DataObjectFieldAttribute属性は、3 つのプロパティすべてに適用されます。ただし、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.cs
ソース:
DataObjectFieldAttribute.cs
ソース:
DataObjectFieldAttribute.cs
ソース:
DataObjectFieldAttribute.cs
ソース:
DataObjectFieldAttribute.cs

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

フィールドの長さ (バイト単位)。

適用対象