DataObjectMethodType 열거형
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
메서드에 적용된 DataObjectMethodAttribute 지정된 대로 메서드에서 수행하는 데이터 작업의 형식을 식별합니다.
public enum class DataObjectMethodType
public enum DataObjectMethodType
type DataObjectMethodType =
Public Enum DataObjectMethodType
- 상속
필드
| Name | 값 | Description |
|---|---|---|
| Fill | 0 | 개체를 채우는 데이터 작업에 메서드가 사용됨을 DataSet 나타냅니다. |
| Select | 1 | 메서드가 데이터를 검색하는 데이터 작업에 사용됨을 나타냅니다. |
| Update | 2 | 데이터를 업데이트하는 데이터 작업에 메서드가 사용됨을 나타냅니다. |
| Insert | 3 | 메서드가 데이터를 삽입하는 데이터 작업에 사용됨을 나타냅니다. |
| Delete | 4 | 데이터를 삭제하는 데이터 작업에 메서드가 사용됨을 나타냅니다. |
예제
다음 코드 예제에서는 공개적으로 노출 된 메서드에 적용 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