DataObjectMethodType Enumeración

Definición

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
Herencia
DataObjectMethodType

Campos

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 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 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 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 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.

Ejemplos

DataObjectMethodAttribute En el ejemplo de código siguiente se muestra cómo se puede aplicar 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, NorthwindEmployee el tipo expone dos métodos de datos diferentes: uno para recuperar un conjunto de datos GetAllEmployeesdenominado y otro para eliminar los datos DeleteEmployeeByIDdenominados.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. 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

End Class

Se aplica a

Consulte también: