DataObjectAttribute Constructors

Definition

DataObjectAttribute 클래스의 새 인스턴스를 초기화합니다.Initializes a new instance of the DataObjectAttribute class.

Overloads

DataObjectAttribute() DataObjectAttribute 클래스의 새 인스턴스를 초기화합니다.Initializes a new instance of the DataObjectAttribute class.
DataObjectAttribute(Boolean)

DataObjectAttribute 클래스의 새 인스턴스를 초기화하고 개체가 ObjectDataSource 개체에 바인딩하는 데 적합한지 여부를 나타냅니다.Initializes a new instance of the DataObjectAttribute class and indicates whether an object is suitable for binding to an ObjectDataSource object.

DataObjectAttribute()

DataObjectAttribute 클래스의 새 인스턴스를 초기화합니다.Initializes a new instance of the DataObjectAttribute class.
public:
 DataObjectAttribute();
public DataObjectAttribute ();
Public Sub New ()

Examples

다음 코드 예제에서는 DataObjectAttribute() 생성자를 사용 하는 방법을 보여 줍니다.The following code example demonstrates using the DataObjectAttribute() constructor.

[DataObjectAttribute]
public class NorthwindData
{  
  public NorthwindData() {}

  [DataObjectMethodAttribute(DataObjectMethodType.Select, true)]
  public static IEnumerable GetAllEmployees()
  {
    AccessDataSource ads = new AccessDataSource();
    ads.DataSourceMode = SqlDataSourceMode.DataReader;
    ads.DataFile = "~//App_Data//Northwind.mdb";
    ads.SelectCommand = "SELECT EmployeeID,FirstName,LastName FROM Employees";
    return ads.Select(DataSourceSelectArguments.Empty);
  }

  // Delete the Employee by ID.
  [DataObjectMethodAttribute(DataObjectMethodType.Delete, true)]
  public void DeleteEmployeeByID(int employeeID)
  {
    throw new Exception("The value passed to the delete method is "
                         + employeeID.ToString());
  }
}
<DataObjectAttribute()> _
Public Class NorthwindData

  <DataObjectMethodAttribute(DataObjectMethodType.Select, True)> _
  Public Shared Function GetAllEmployees() As IEnumerable
    Dim ads As New AccessDataSource()
    ads.DataSourceMode = SqlDataSourceMode.DataReader
    ads.DataFile = "~/App_Data/Northwind.mdb"
    ads.SelectCommand = "SELECT EmployeeID,FirstName,LastName FROM Employees"
    Return ads.Select(DataSourceSelectArguments.Empty)
  End Function 'GetAllEmployees

  ' Delete the Employee by ID.
  <DataObjectMethodAttribute(DataObjectMethodType.Delete, True)> _
  Public Sub DeleteEmployeeByID(ByVal employeeID As Integer)
    Throw New Exception("The value passed to the delete method is " + employeeID.ToString())
  End Sub

End Class

Remarks

DataObjectAttribute() 생성자를 사용 하는 경우 IsDataObject 속성이 true로 설정 됩니다.The IsDataObject property is set to true when you use the DataObjectAttribute() constructor.

DataObjectAttribute(Boolean)

DataObjectAttribute 클래스의 새 인스턴스를 초기화하고 개체가 ObjectDataSource 개체에 바인딩하는 데 적합한지 여부를 나타냅니다.Initializes a new instance of the DataObjectAttribute class and indicates whether an object is suitable for binding to an ObjectDataSource object.

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

Parameters

isDataObject
Boolean

개체가 ObjectDataSource 개체에 바인딩하는 데 적합하면 true이고, 그렇지 않으면 false입니다.true if the object is suitable for binding to an ObjectDataSource object; otherwise, false.

Remarks

DataObjectAttribute(Boolean) 생성자를 사용 하 여 ObjectDataSource 개체에 바인딩하는 데 적합 한 개체 목록에서 개체를 제외 해야 하는 ObjectDataSourceDesigner 클래스와 같은 디자인 타임 클래스를 지정 합니다.Use the DataObjectAttribute(Boolean) constructor to indicate to a design-time class such as the ObjectDataSourceDesigner class that an object should be excluded from the list of suitable objects for binding to an ObjectDataSource object.

합니다 IsDataObject 속성의 값으로 설정 되는 isDataObject 매개 변수입니다.The IsDataObject property is set to the value of the isDataObject parameter.

Applies to