2
So, is it possible for me to look at the execution order of the Querys
that the Entity Framework
mount?
My problem is that it is trying to make a deletion in the wrong order, even after I make the calls in the order that sql server works.
Code:
itensPVF.ForEach(e => this.pvfService.RemoverPorChave(e.Chave));
RemoverItemSolicitado(chaveOS, numeroItensPvf);
In this case, this itemPVF
has to be deleted first on account of its relationship with the table that is deleted in sequence, only at the time of the commit
for entity
, he does not understand this way and bursts the error:
{"The DELETE statement conflicted with the REFERENCE constraint \"FK_TB_ITEM_OS_PVF_TB_ITEM_SOLICITADO\". The conflict occurred in database \"BANCO\", table \ "dbo.TB_ITEM_OS_PVF\", column 'CD_ITEM_SOLICITADO'. \r\nThe statement has been terminated."}
What is your context?
– Maniero
What is
pvrService
? What’s in the code forRemoverPorChave
?– Leonel Sanches da Silva
pvrService is my business rule service, removerPorChave is a Generics that will eventually call . Remove.
– AbnoanMuniz