DataObjectMethodType 列挙体
アセンブリ: System (system.dll 内)

Public Enumeration DataObjectMethodType

メンバ名 | 説明 | |
---|---|---|
![]() | Delete | メソッドが、データを削除するデータ操作に使用されることを示します。 |
![]() | Fill | メソッドが、DataSet オブジェクトにデータを格納するデータ操作に使用されることを示します。 |
![]() | Insert | メソッドが、データを挿入するデータ操作に使用されることを示します。 |
![]() | Select | メソッドが、データを取得するデータ操作に使用されることを示します。 |
![]() | Update | メソッドが、データを更新するデータ操作に使用されることを示します。 |

一般に公開されているメソッドに DataObjectMethodAttribute を適用し、そのメソッドによって実行されるデータ操作の種類、およびそのメソッドがその型の既定のデータ メソッドかどうかを識別する方法を次のコード例に示します。この例では、NorthwindEmployee 型によって 2 つの異なるデータ メソッドが公開されています。GetAllEmployees という名前のデータのセットを取得するメソッドと、DeleteEmployeeByID という名前のデータを削除するメソッドです。どちらのメソッドにも、DataObjectMethodAttribute が適用されています。
<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
[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()); } }

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- DataObjectMethodType 列挙体のページへのリンク