Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
Previous Versions
.NET Framework 2.0
 DataObjectMethodType Enumeration
Collapse All/Expand All Collapse All
This page is specific to
Microsoft Visual Studio 2005/.NET Framework 2.0

Other versions are also available for the following:
DataObjectMethodType Enumeration
Identifies the type of data operation performed by a method, as specified by the DataObjectMethodAttribute applied to the method.

Namespace: System.ComponentModel
Assembly: System (in system.dll)

Visual Basic (Declaration)
Public Enumeration DataObjectMethodType
Visual Basic (Usage)
Dim instance As DataObjectMethodType
C#
public enum DataObjectMethodType
C++
public enum class DataObjectMethodType
J#
public enum DataObjectMethodType
JScript
public enum DataObjectMethodType
 Member nameDescription
Supported by the .NET Compact FrameworkDeleteIndicates that a method is used for a data operation that deletes data. 
Supported by the .NET Compact FrameworkFillIndicates that a method is used for a data operation that fills a DataSet object. 
Supported by the .NET Compact FrameworkInsertIndicates that a method is used for a data operation that inserts data. 
Supported by the .NET Compact FrameworkSelectIndicates that a method is used for a data operation that retrieves data. 
Supported by the .NET Compact FrameworkUpdateIndicates that a method is used for a data operation that updates data. 

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. 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. The DataObjectMethodAttribute is applied to both methods.

Visual Basic
<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
C#
[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 Server 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

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

.NET Compact Framework

Supported in: 2.0

XNA Framework

Supported in: 1.0
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker