DataSourceView.CanDelete Propriedade
Definição
Obtém um valor que indica se o objeto DataSourceView associado ao objeto DataSourceControl atual dá suporte à operação ExecuteDelete(IDictionary, IDictionary).Gets a value indicating whether the DataSourceView object associated with the current DataSourceControl object supports the ExecuteDelete(IDictionary, IDictionary) operation.
public:
virtual property bool CanDelete { bool get(); };
public virtual bool CanDelete { get; }
member this.CanDelete : bool
Public Overridable ReadOnly Property CanDelete As Boolean
Valor da propriedade
true se a operação for suportada; caso contrário, false .true if the operation is supported; otherwise, false. A implementação da classe base retorna false .The base class implementation returns false.
Exemplos
O exemplo de código a seguir demonstra como substituir a CanDelete propriedade e o ExecuteDelete método em uma classe que estende a DataSourceView classe.The following code example demonstrates how to override the CanDelete property and the ExecuteDelete method in a class that extends the DataSourceView class. Este exemplo de código faz parte de um exemplo maior fornecido para a DataSourceView classe.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
Comentários
A CanDelete propriedade reflete não apenas a capacidade do controle da fonte de dados, mas também se é apropriada para executar uma operação.The CanDelete property reflects not only a capability of the data source control, but also whether it is currently appropriate to perform an operation. Por exemplo, embora uma exibição da fonte de dados dê suporte à ExecuteDelete operação em geral, se uma propriedade obrigatória ou alguns outros dados não estiverem definidos, a CanDelete propriedade retornará false , uma vez que uma operação de exclusão falhará.For example, even though a data source view supports the ExecuteDelete operation in general, if a required property or some other data is not set, the CanDelete property returns false, as a delete operation would fail.