DataObjectAttribute DataObjectAttribute DataObjectAttribute DataObjectAttribute Constructors

정의

오버로드

DataObjectAttribute() DataObjectAttribute() DataObjectAttribute()

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

DataObjectAttribute(Boolean) DataObjectAttribute(Boolean) DataObjectAttribute(Boolean) 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() DataObjectAttribute()

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

public:
 DataObjectAttribute();
public DataObjectAttribute ();
Public Sub New ()

예제

다음 코드 예제는 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 'DeleteEmployeeByID

End Class 'NorthwindData

설명

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

DataObjectAttribute(Boolean) DataObjectAttribute(Boolean) DataObjectAttribute(Boolean) 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)

매개 변수

isDataObject
Boolean Boolean Boolean Boolean

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

설명

사용 하 여는 DataObjectAttribute(Boolean) 생성자와 같은 디자인 타임 클래스에 알리기 위해 합니다 ObjectDataSourceDesigner 클래스 개체에 대 한 바인딩에 적합 한 개체의 목록에서 제외 되어야 합니다는 ObjectDataSource 개체.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.

적용 대상