I am using PLINQO for my LINQ-TO-SQL data layer.
I have the following piece of code (not real code, just to re-produce the error I am getting):
var context = new MyDataContext();
var user = context.User.GetByKey("username");
user.Detach();
context.User.Attach(user);
Executing the last line of code results with InvalidOperationException with the following error message: "Cannot attach an entity that already exists."
I thought that the Detach method should detach the entity from the context and it seems that it just removing the link from the entity to the context but the context still "remembers" the entity.
How can I detach the entity completely so I will not get the error ?
Thanks, Koby