DataObjectMethodType 列挙体とは? わかりやすく解説

DataObjectMethodType 列挙体

メモ : この列挙体は、.NET Framework version 2.0 で新しく追加されたものです。

メソッドに適用された DataObjectMethodAttribute で指定された、メソッドによって実行されるデータ操作の種類を示します。

名前空間: System.ComponentModel
アセンブリ: System (system.dll 内)
構文構文

Public Enumeration DataObjectMethodType
Dim instance As DataObjectMethodType
public enum DataObjectMethodType
public enum class DataObjectMethodType
public enum DataObjectMethodType
public enum DataObjectMethodType
メンバメンバ
使用例使用例

一般に公開されているメソッドに 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());
  }
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳

英語⇒日本語日本語⇒英語

辞書ショートカット

すべての辞書の索引

「DataObjectMethodType 列挙体」の関連用語

DataObjectMethodType 列挙体のお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



DataObjectMethodType 列挙体のページの著作権

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2026 Microsoft.All rights reserved.

©2026 GRAS Group, Inc.RSS