Switching from Linq-To-SQL to Entity Framework for WCF Data Services Issue with FK "Properties"
Someone asked on Stack Overflow:
So, In my old Linq-To-SQL I would write code like this
var tableItem = new Table { Prop1 = var1 Prop2 = var2, Prop3 = var3, ParentTableID = parentRecordID }; db.Table.InsertOnSubmit(tableItem); db.SubmitChanges();After converting my working code from Linq-To-SQL to Entity Framework (v3.5) the
ParentTableIDproperty is no longer there and I’m at a loss as to how I can create this related child record.I’m not sure what I should change for my entity framework version, besides the obvious call to
SaveChanges();instead ofSubmitChanges():(
I posted the following answer, which was chosen as the accepted answer:
I ended up using the solution here: Entity Framework: Setting a Foreign Key Property.
Originally posted on Stack Overflow — 0 upvotes (accepted answer). Licensed under CC BY-SA.