Bug #61601 | Entity Framework attach() method does not update the database. | ||
---|---|---|---|
Submitted: | 22 Jun 2011 22:16 | Modified: | 28 Jun 2011 21:11 |
Reporter: | Mike Hillyer | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | Connector / NET | Severity: | S2 (Serious) |
Version: | 6.4.1 | OS: | Windows |
Assigned to: | Julio Casal | CPU Architecture: | Any |
Tags: | Connector/Net, entity framework |
[22 Jun 2011 22:16]
Mike Hillyer
[23 Jun 2011 18:52]
Richard Deeming
I think you're using the wrong method. Try "me.liked_places.Add(dest);" instead.
[26 Jun 2011 1:44]
Mike Hillyer
As you can see from my example, both entities already exist. .add() is used when the object in the collection does not previously exist, whereas .attach() is used to create a relationship between two entities that already exist. See http://msdn.microsoft.com/en-us/library/bb896271.aspx
[26 Jun 2011 2:52]
Mike Hillyer
It appears my source was wrong, the add method worked. My apologies.
[28 Jun 2011 21:11]
Julio Casal
Thank you for taking the time to write to us, but this is not a bug. Attach will not insert new records in a joining table. Please use Add to get the expected result.