DataObjectMethodType DataObjectMethodType DataObjectMethodType DataObjectMethodType Enum

Definition

Identifica el tipo de operación de datos que realiza un método, según especifica el atributo DataObjectMethodAttribute aplicado al método. Identifies the type of data operation performed by a method, as specified by the DataObjectMethodAttribute applied to the method.

public enum class DataObjectMethodType
public enum DataObjectMethodType
type DataObjectMethodType = 
Public Enum DataObjectMethodType
Inheritance
DataObjectMethodTypeDataObjectMethodTypeDataObjectMethodTypeDataObjectMethodType

Fields

Delete Delete Delete Delete 4

Indica que un método se utiliza para una operación de datos que elimina datos. Indicates that a method is used for a data operation that deletes data.

Fill Fill Fill Fill 0

Indica que un método se utiliza para una operación de datos que rellena un objeto DataSet. Indicates that a method is used for a data operation that fills a DataSet object.

Insert Insert Insert Insert 3

Indica que un método se utiliza para una operación de datos que inserta datos. Indicates that a method is used for a data operation that inserts data.

Select Select Select Select 1

Indica que un método se utiliza para una operación de datos que recupera datos. Indicates that a method is used for a data operation that retrieves data.

Update Update Update Update 2

Indica que un método se utiliza para una operación de datos que actualiza datos. Indicates that a method is used for a data operation that updates data.

Examples

En el ejemplo de código siguiente se muestra cómo se puede aplicar el DataObjectMethodAttribute a un método expuesto públicamente e identificar el tipo de operación de datos que realiza, así como si es el método de datos predeterminado del tipo.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. En este ejemplo el NorthwindEmployee tipo expone dos métodos de datos diferentes: uno para recuperar un conjunto de datos denominada GetAllEmployeesy otro para eliminar datos con el nombre DeleteEmployeeByID.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. El DataObjectMethodAttribute se aplica a ambos métodos.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());
  }
}
<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

Applies to

See Also