c# - Linq to Sql Many to Many relationships -
I have just started a new project using Linq for a SQL model and I have many I'm implementing I have found this blog how it executes:
When I add some child objects If I try and try to delete one before saving, then I get an error,
system. Resident Operation Exception: An entity can not be removed which was not attached is.
Any ideas? Someone has already commented on the blog author, but there is no response.
Greatly appreciate!
You are calling the Onsubmit removed on an entity, which has not been sucked into datacentext.
To test it (rather than a hamy way), do the following:
var e = some_entity; Var CS = DC Chat changet (); If (cs.Inserts.Any (x => x == e)) {d.SomeTable.DeleteOnSubmit (e); } DC. Submit changelog ();
Comments
Post a Comment