DataObjectMethodType 열거형

정의

메서드가 수행하는 데이터 작업의 형식을 식별합니다. 데이터 작업의 형식은 메서드에 적용된 DataObjectMethodAttribute에 지정됩니다.

public enum class DataObjectMethodType
public enum DataObjectMethodType
type DataObjectMethodType = 
Public Enum DataObjectMethodType
상속
DataObjectMethodType

필드

Delete 4

메서드가 데이터를 삭제하는 데이터 작업에 사용됨을 나타냅니다.

Fill 0

메서드가 DataSet 개체를 채우는 데이터 작업에 사용됨을 나타냅니다.

Insert 3

메서드가 데이터를 삽입하는 데이터 작업에 사용됨을 나타냅니다.

Select 1

메서드가 데이터를 검색하는 데이터 작업에 사용됨을 나타냅니다.

Update 2

메서드가 데이터를 업데이트하는 데이터 작업에 사용됨을 나타냅니다.

예제

다음 코드 예제에서는 적용 하는 방법을 보여 줍니다를 DataObjectMethodAttribute 공개적으로 노출 된 메서드 뿐 아니라 형식의 기본 데이터 메서드인지 인지 수행 하는 데이터 작업의 형식을 식별 합니다. 이 예제는 NorthwindEmployee 형식에서는 두 가지 데이터 메서드를 노출: 라는 데이터 집합을 검색 하 GetAllEmployees, 및 명명 된 데이터를 삭제 하려면 DeleteEmployeeByID합니다. DataObjectMethodAttribute 두 메서드 모두에 적용 됩니다.

[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

적용 대상

추가 정보