Table<TEntity>.DeleteAllOnSubmit(IEnumerable<TSubEntity>) Table<TEntity>.DeleteAllOnSubmit(IEnumerable<TSubEntity>) Table<TEntity>.DeleteAllOnSubmit(IEnumerable<TSubEntity>) Table<TEntity>.DeleteAllOnSubmit(IEnumerable<TSubEntity>) Method

Definizione

Imposta tutte le entità della raccolta sullo stato pending delete.Puts all entities from the collection into a pending delete state.

public:
generic <typename TSubEntity>
 where TSubEntity : TEntity void DeleteAllOnSubmit(System::Collections::Generic::IEnumerable<TSubEntity> ^ entities);
public void DeleteAllOnSubmit<TSubEntity> (System.Collections.Generic.IEnumerable<TSubEntity> entities) where TSubEntity : TEntity;
member this.DeleteAllOnSubmit : seq<#'Entity> -> unit
Public Sub DeleteAllOnSubmit(Of TSubEntity As TEntity) (entities As IEnumerable(Of TSubEntity))

Parametri di tipo

TSubEntity

Tipo degli elementi da eliminare.The type of the elements to delete.

Parametri

entities
IEnumerable<TSubEntity>

Entità da eliminare.The entities to delete.

Commenti

Le entità inserite nello stato Delete in sospeso con questo metodo non scompaiono dai risultati della query fino a quando SubmitChanges non viene chiamato il metodo.Entities that are put into the pending delete state with this method do not disappear from query results until after SubmitChanges is called. Le entità disconnesse devono essere allegate prima di poter essere eliminate.Disconnected entities must be attached before they can be deleted. Per ulteriori informazioni, vedere recupero di dati e operazioni CUD in applicazioni a più livelli (LINQ to SQL).For more information, see Data Retrieval and CUD Operations in N-Tier Applications (LINQ to SQL).

Il frammento di codice seguente C# Mostra un utilizzo per questo metodo:The following C# snippet shows one use for this method:

IEnumerable<Customer> customersWithoutOrders = (from c in db.Customers  
   where c.Orders.Count == 0  
   select c).ToList();  

db.Customers.DeleteAllOnSubmit(customersWithoutOrders);  
db.SubmitChanges();  

In Visual Basic:In Visual Basic:

Dim customersWithoutOrders As IEnumerable(Of Customer) = (From c In db.Customers _   
    Where c.Orders.Count = 0 _   
    Select c).ToList()  

db.Customers.DeleteAllOnSubmit(customersWithoutOrders)  
db.SubmitChanges()  

Si applica a