DataObjectMethodAttribute 생성자
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
DataObjectMethodAttribute 클래스의 새 인스턴스를 초기화합니다.
오버로드
| Name | Description |
|---|---|
| DataObjectMethodAttribute(DataObjectMethodType) |
클래스의 새 인스턴스를 DataObjectMethodAttribute 초기화하고 메서드가 수행하는 데이터 작업의 형식을 식별합니다. |
| DataObjectMethodAttribute(DataObjectMethodType, Boolean) |
클래스의 DataObjectMethodAttribute 새 인스턴스를 초기화하고, 메서드가 수행하는 데이터 작업의 형식을 식별하고, 메서드가 데이터 개체가 노출하는 기본 데이터 메서드인지 여부를 식별합니다. |
DataObjectMethodAttribute(DataObjectMethodType)
- Source:
- DataObjectMethodAttribute.cs
- Source:
- DataObjectMethodAttribute.cs
- Source:
- DataObjectMethodAttribute.cs
- Source:
- DataObjectMethodAttribute.cs
- Source:
- DataObjectMethodAttribute.cs
클래스의 새 인스턴스를 DataObjectMethodAttribute 초기화하고 메서드가 수행하는 데이터 작업의 형식을 식별합니다.
public:
DataObjectMethodAttribute(System::ComponentModel::DataObjectMethodType methodType);
public DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType methodType);
new System.ComponentModel.DataObjectMethodAttribute : System.ComponentModel.DataObjectMethodType -> System.ComponentModel.DataObjectMethodAttribute
Public Sub New (methodType As DataObjectMethodType)
매개 변수
- methodType
- DataObjectMethodType
메서드가 DataObjectMethodType 수행하는 데이터 작업을 설명하는 값 중 하나입니다.
예제
다음 코드 예제에서는 공개적으로 노출 된 메서드에 특성을 적용 DataObjectMethodAttribute 하 고 수행 하는 데이터 작업의 형식 및 형식의 기본 데이터 메서드 인지 여부를 식별 하는 방법을 보여 줍니다. 이 예제에서 형식은 NorthwindData 두 개의 데이터 메서드를 노출합니다. 하나는 명명된 데이터 집합을 검색하고 다른 하나는 명명 GetAllEmployees된 DeleteEmployeeByID데이터를 삭제합니다. 특성은 DataObjectMethodAttribute 두 메서드 모두에 적용되고, GetAllEmployees 메서드는 데이터 선택 작업의 기본 메서드로 표시되며 DeleteEmployeeByID , 메서드는 데이터 삭제 작업의 기본 메서드로 표시됩니다.
[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
설명
이 IsDefault 생성자를 사용하여 개체를 DataObjectMethodAttribute 만들 때 속성이 DataObjectMethodAttribute(DataObjectMethodType) 설정 false 됩니다.
적용 대상
DataObjectMethodAttribute(DataObjectMethodType, Boolean)
- Source:
- DataObjectMethodAttribute.cs
- Source:
- DataObjectMethodAttribute.cs
- Source:
- DataObjectMethodAttribute.cs
- Source:
- DataObjectMethodAttribute.cs
- Source:
- DataObjectMethodAttribute.cs
클래스의 DataObjectMethodAttribute 새 인스턴스를 초기화하고, 메서드가 수행하는 데이터 작업의 형식을 식별하고, 메서드가 데이터 개체가 노출하는 기본 데이터 메서드인지 여부를 식별합니다.
public:
DataObjectMethodAttribute(System::ComponentModel::DataObjectMethodType methodType, bool isDefault);
public DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType methodType, bool isDefault);
new System.ComponentModel.DataObjectMethodAttribute : System.ComponentModel.DataObjectMethodType * bool -> System.ComponentModel.DataObjectMethodAttribute
Public Sub New (methodType As DataObjectMethodType, isDefault As Boolean)
매개 변수
- methodType
- DataObjectMethodType
메서드가 DataObjectMethodType 수행하는 데이터 작업을 설명하는 값 중 하나입니다.
- isDefault
- Boolean
true 특성이 적용되는 메서드가 지정된 methodType데이터 개체의 기본 메서드임을 나타내려면 이고, false그렇지 않으면 입니다.
예제
다음 코드 예제에서는 공개적으로 노출 된 메서드에 특성을 적용 DataObjectMethodAttribute 하 고 수행 하는 데이터 작업의 형식 및 형식의 기본 데이터 메서드 인지 여부를 식별 하는 방법을 보여 줍니다. 이 예제에서 형식은 NorthwindData 두 개의 데이터 메서드를 노출합니다. 하나는 명명된 데이터 집합을 검색하고 다른 하나는 명명 GetAllEmployees된 DeleteEmployeeByID데이터를 삭제합니다. 특성은 DataObjectMethodAttribute 두 메서드 모두에 적용되고, GetAllEmployees 메서드는 데이터 선택 작업의 기본 메서드로 표시되며 DeleteEmployeeByID , 메서드는 데이터 삭제 작업의 기본 메서드로 표시됩니다.
[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