DataObjectMethodType DataObjectMethodType DataObjectMethodType DataObjectMethodType Enum

정의

메서드가 수행하는 데이터 작업의 형식을 식별합니다. 데이터 작업의 형식은 메서드에 적용된 DataObjectMethodAttribute에 지정됩니다.Identifies the type of data operation performed by a method, as specified by the DataObjectMethodAttribute applied to the method.

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

필드

Delete Delete Delete Delete 4

메서드가 데이터를 삭제하는 데이터 작업에 사용됨을 나타냅니다.Indicates that a method is used for a data operation that deletes data.

Fill Fill Fill Fill 0

메서드가 DataSet 개체를 채우는 데이터 작업에 사용됨을 나타냅니다.Indicates that a method is used for a data operation that fills a DataSet object.

Insert Insert Insert Insert 3

메서드가 데이터를 삽입하는 데이터 작업에 사용됨을 나타냅니다.Indicates that a method is used for a data operation that inserts data.

Select Select Select Select 1

메서드가 데이터를 검색하는 데이터 작업에 사용됨을 나타냅니다.Indicates that a method is used for a data operation that retrieves data.

Update Update Update Update 2

메서드가 데이터를 업데이트하는 데이터 작업에 사용됨을 나타냅니다.Indicates that a method is used for a data operation that updates data.

예제

다음 코드 예제에서는 적용 하는 방법을 보여 줍니다를 DataObjectMethodAttribute 공개적으로 노출 된 메서드 뿐 아니라 형식의 기본 데이터 메서드인지 인지 수행 하는 데이터 작업의 형식을 식별 합니다.The following code example demonstrates how you can apply the DataObjectMethodAttribute to a publicly exposed method and identify the type of data operation it performs as well as whether it is the type's default data method. 이 예제는 NorthwindEmployee 형식에서는 두 가지 데이터 메서드를 노출: 라는 데이터 집합을 검색 하 GetAllEmployees, 및 명명 된 데이터를 삭제 하려면 DeleteEmployeeByID합니다.In this example the NorthwindEmployee type exposes two different data methods: one to retrieve a set of data named GetAllEmployees, and one to delete data named DeleteEmployeeByID. DataObjectMethodAttribute 두 메서드 모두에 적용 됩니다.The DataObjectMethodAttribute is applied to both methods.

[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

적용 대상

추가 정보