DataSourceView.ExecuteDelete(IDictionary, IDictionary) Método
Definición
Realiza una operación de eliminación en la lista de datos que el objeto DataSourceView representa.Performs a delete operation on the list of data that the DataSourceView object represents.
protected:
virtual int ExecuteDelete(System::Collections::IDictionary ^ keys, System::Collections::IDictionary ^ oldValues);
protected virtual int ExecuteDelete (System.Collections.IDictionary keys, System.Collections.IDictionary oldValues);
abstract member ExecuteDelete : System.Collections.IDictionary * System.Collections.IDictionary -> int
override this.ExecuteDelete : System.Collections.IDictionary * System.Collections.IDictionary -> int
Protected Overridable Function ExecuteDelete (keys As IDictionary, oldValues As IDictionary) As Integer
Parámetros
- keys
- IDictionary
Interfaz IDictionary de claves de objetos o filas que se va a eliminar mediante la operación de ExecuteDelete(IDictionary, IDictionary).An IDictionary of object or row keys to be deleted by the ExecuteDelete(IDictionary, IDictionary) operation.
- oldValues
- IDictionary
Interfaz IDictionary de pares de nombre/valor que representan los elementos de datos y sus valores originales.An IDictionary of name/value pairs that represent data elements and their original values.
Devoluciones
Número de elementos que se eliminaron del espacio de almacenamiento de datos subyacente.The number of items that were deleted from the underlying data storage.
Excepciones
El objeto ExecuteDelete(IDictionary, IDictionary) no admite la operación de DataSourceView.The ExecuteDelete(IDictionary, IDictionary) operation is not supported by the DataSourceView.
Ejemplos
En el ejemplo de código siguiente se muestra cómo una clase que extiende la DataSourceView clase puede invalidar la CanDelete propiedad y el ExecuteDelete método.The following code example demonstrates how a class that extends the DataSourceView class can override the CanDelete property and the ExecuteDelete method. Este ejemplo de código forma parte de un ejemplo más extenso proporcionado para la DataSourceView clase.This code example is part of a larger example provided for the DataSourceView class.
// The CsvDataSourceView does not currently
// permit deletion. You can modify or extend
// this sample to do so.
public override bool CanDelete {
get {
return false;
}
}
protected override int ExecuteDelete(IDictionary keys, IDictionary values)
{
throw new NotSupportedException();
}
' The CsvDataSourceView does not currently
' permit deletion. You can modify or extend
' this sample to do so.
Public Overrides ReadOnly Property CanDelete() As Boolean
Get
Return False
End Get
End Property
Protected Overrides Function ExecuteDelete(keys As IDictionary, values As IDictionary) As Integer
Throw New NotSupportedException()
End Function 'ExecuteDelete
Comentarios
Los controles enlazados a datos pueden determinar si la ExecuteDelete operación es compatible con un control de origen de datos mediante la recuperación del DataSourceView objeto mediante el DataSourceControl.GetView método y la comprobación de la CanDelete propiedad.Data-bound controls can determine whether the ExecuteDelete operation is supported by a data source control by retrieving the DataSourceView object using the DataSourceControl.GetView method, and checking the CanDelete property.
El keys
parámetro representa las claves de objeto o fila de los datos que se van a eliminar.The keys
parameter represents the object or row keys of the data to delete. En el caso de los orígenes de datos que representan datos relacionales, como el SqlDataSource control, el keys
parámetro es una colección de claves principales de la base de datos.For data sources that represent relational data, such as the SqlDataSource control, the keys
parameter is a collection of database primary keys. En otros escenarios, el keys
parámetro es una colección de pares nombre-valor y se utiliza para filtrar una lista de datos.In other scenarios, the keys
parameter is a collection of name/value pairs and is used to filter a list of data. Se eliminarán todos los datos que coincidan con un par de nombre y valor.Any data matching a name/value pair is deleted.
Nota
La DataSourceView implementación predeterminada de la clase es iniciar una NotSupportedException excepción.The DataSourceView class's default implementation is to throw a NotSupportedException exception. Si extiende la DataSourceView clase, invalide el ExecuteDelete método si la clase admite la eliminación del almacenamiento de datos subyacente.If you extend the DataSourceView class, override the ExecuteDelete method if your class supports deletion from the underlying data storage.