LINQ Remove

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
halley73to
Posts: 29
Joined: Wed 07 Oct 2009 07:24

LINQ Remove

Post by halley73to » Tue 27 Oct 2009 09:22

Hi,
why the Remove form a child collection perform an update on the child setting the id of the parent to 0 and not the delete?

UPDATE MAGAZZINO.A_RIGHE_ORDINE SET ID_ORDINE = :p1 WHERE ID_RIGA_ORDINE = :key1 AND ID_ORDINE = :key2 AND ID_PRODOTTO = :key3 AND QUANTITA = :key4 AND QUANTITA_EVASA = :key5 AND ID_STATO_RIGA_ORDINE = :key6 AND ((:nullkey7 = 1 AND IMPORTO IS NULL) OR (IMPORTO = :key7)) AND OMAGGIO = :key8 RETURNING ID_ORDINE, ID_PRODOTTO, QUANTITA, QUANTITA_EVASA, ID_STATO_RIGA_ORDINE, IMPORTO, OMAGGIO, NOTE INTO :ret1, :ret2, :ret3, :ret4, :ret5, :ret6, :ret7, :ret8
ParameterName = p1
DbType = Decimal
Value = 0
ParameterName = key1
DbType = Decimal
Value = 6
ParameterName = key2
DbType = Decimal
Value = 1
ParameterName = key3
DbType = Decimal
Value = 84
ParameterName = key4
DbType = Decimal

Thanks, Luca

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Fri 30 Oct 2009 15:54

If you make Parent.ChildCollection.Remove(Child instance), you simply set the foreign key to null in this case.
To delete the child object you should explicitly delete it from DataContext.Children EntitySet
using theDeleteOnSubmit method.

Post Reply