cascade operation in transaction scope failed

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
repekcan
Posts: 4
Joined: Mon 16 May 2011 18:26

cascade operation in transaction scope failed

Post by repekcan » Thu 04 Aug 2011 11:02

Hi,

I have a problem and i can not resolve it when I used cascade operation in a transaction scope.

TARIFE entity has a child entity is called TARIFEARACTIP.
In that code you can see below I try to delete a TARIFE record. In order to this I need to delete all related data at TARIFEARACTIP.
At second savechanges statement I got an exception said:
TARIFE has a child rows.

However, I am deleting all TARIFEARACTIPs using this code . It did not worked;

foreach (var item in result)
{
context.TARIFEARACTIPs.DeleteObject(item);
}

context.SaveChanges();



Code snip:

using (TransactionScope ts = new TransactionScope())
{
using (DataEntities context = new DataEntities(Global.CONNECTIONSTRING_NAME))
{
TARIFE tarife = (from item in context.TARIFEs
where item.TARIFEID == tarifeID
select item).First();


var result = (from item in context.TARIFEARACTIPs
where item.TARIFEID == tarife.TARIFEID
select item).ToList();

foreach (var item in result)
{
context.TARIFEARACTIPs.DeleteObject(item);
}

context.SaveChanges();

context.TARIFEs.DeleteObject(tarife);

context.SaveChanges();
ts.Complete();
}
}

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Mon 08 Aug 2011 10:16

I have tried your code with DEPT-EMP entities (%ProgramFiles%\Devart\dotConnect\Oracle\Samples\tables.sql) using the 6.30.196 version of dotConnect for Oracle. Cascade operation on disposing TransactionScope object was executed successfully.

Please try dotConnect for Oracle v 6.30.196. If the problem persists, send us a small test project with your model and corresponding DDL/DML script. We will try to reproduce the issue in our environment. Notify us about the results.

repekcan
Posts: 4
Joined: Mon 16 May 2011 18:26

transaction problem

Post by repekcan » Sat 13 Aug 2011 15:02

Hi,

I sent support team code example and sql. I should have a information before
that I used sequence and trigger to generate autoincrement value for primary keys. When I inserted child table row which has a foreign key from parent table, primary key not found in parent tables error message occured. I also did
an example using your sample sql you offered me. I added triggers and sequence in that examples.Results was same.

Sincerely,

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Wed 17 Aug 2011 07:17

We have answered you by e-mail.

Post Reply