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();
}
}
cascade operation in transaction scope failed
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.
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.
transaction problem
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,
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,