Parent - Child insert with .Net Entity Framework
Posted: Fri 08 Jan 2010 08:56
Hi,
I'm using dotConnect Oracle 5.35.62 trial version. I want to ask how to insert parent child association in one transaction.
Maybe similiar like this in SQL Server version http://social.msdn.microsoft.com/forums ... bc480ee8a/
I've tried this following code :
The record successfully insert to both table in database but the reference id (MasterId Column) in Detail table always refer to 0.
I've use trigger and sequence to produce auto increment number both in Master table and Detail table and it work fine if i do this with sql insert query.
Is there any idea how to do this with valid reference id?
Thanks,
I'm using dotConnect Oracle 5.35.62 trial version. I want to ask how to insert parent child association in one transaction.
Maybe similiar like this in SQL Server version http://social.msdn.microsoft.com/forums ... bc480ee8a/
I've tried this following code :
Code: Select all
Master ap = new Master();
Detail ad = new Detail();
ap.Name = "Test Data";
ad.Visited = "US";
ap.Detail.Add(ad);
db.AddToMaster(ap);
db.SaveChanges();I've use trigger and sequence to produce auto increment number both in Master table and Detail table and it work fine if i do this with sql insert query.
Is there any idea how to do this with valid reference id?
Thanks,