 |
|
| .NET DotNet Forum Index » ADO .NET Forum » EF - How do I attach a "EntityKey" object for... |
|
Page 1 of 1 |
|
| Author |
Message |
| Colbert Zhou [MSFT]... |
Posted: Wed Sep 30, 2009 4:08 am |
|
|
|
Guest
|
Hello Richs,
Attach() method is used to attach an object to an ObjectContext. The object
attached is usually retrieve from another place, like remote method call or
WCF service, or deserialized from file and so on. These objects are
supposed to have entity keys. AddObject() is supposed to add a new created
object to the ObjectContext. So we will see that prompt error message.
Actually, to add related objects, we can call Attach on ObjectContext to
attach object to the object context. Do this when the object already exists
in the data source but is currently not attched to the context. For more
information, see,
http://msdn.microsoft.com/en-us/library/bb896271.aspx
http://msdn.microsoft.com/en-us/library/bb896245.aspx
Best regards,
Ji Zhou
Microsoft Managed Newsgroup Support Team |
|
|
| Back to top |
|
|
|
|
|
All times are GMT - 5 Hours
The time now is Fri Dec 11, 2009 5:17 pm
|
|