Export (0) Print
Expand All
Expand Minimize
1 out of 1 rated this helpful - Rate this topic

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)
public enum DataObjectMethodType
Member nameDescription
Supported by the .NET Compact FrameworkSupported by the XNA FrameworkFillIndicates that a method is used for a data operation that fills a DataSet object.
Supported by the .NET Compact FrameworkSupported by the XNA FrameworkSelectIndicates that a method is used for a data operation that retrieves data.
Supported by the .NET Compact FrameworkSupported by the XNA FrameworkUpdateIndicates that a method is used for a data operation that updates data.
Supported by the .NET Compact FrameworkSupported by the XNA FrameworkInsertIndicates that a method is used for a data operation that inserts data.
Supported by the .NET Compact FrameworkSupported by the XNA FrameworkDeleteIndicates that a method is used for a data operation that deletes 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.

[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 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98, Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC, Xbox 360, Zune

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0

.NET Compact Framework

Supported in: 3.5, 2.0

XNA Framework

Supported in: 3.0, 2.0, 1.0
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.