DataObjectFieldAttribute Constructor (Boolean, Boolean, Boolean)

 

Initializes a new instance of the DataObjectFieldAttribute class and indicates whether the field is the primary key for the data row, whether the field is a database identity field, and whether the field can be null.

Namespace:   System.ComponentModel
Assembly:  System (in System.dll)

public:
DataObjectFieldAttribute(
	bool primaryKey,
	bool isIdentity,
	bool isNullable
)

Parameters

primaryKey
Type: System::Boolean

true to indicate that the field is in the primary key of the data row; otherwise, false.

isIdentity
Type: System::Boolean

true to indicate that the field is an identity field that uniquely identifies the data row; otherwise, false.

isNullable
Type: System::Boolean

true to indicate that the field can be null in the data store; otherwise, false.

The following code example demonstrates how you can apply the DataObjectFieldAttribute to a publicly exposed property to identify metadata associated with the property. In this example the NorthwindEmployee type exposes three data properties: EmployeeID, FirstName, and LastName. The DataObjectFieldAttribute attribute is applied to all three properties; however, only the EmployeeID property attribute indicates it is the primary key for the data row.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 2.0
Return to top
Show: