Hi,
I'm trying to retrieve an object from my database using entity (framework 4) When I use the following code it gives an ArgumentException: An item with the same key has already been added.
if (databaseContext.TryGetObjectByKey(entityKey, out result))
{
return (result != null && result is TEntityObject) ? result as TEntityObject : null;
}
else
{
return null;
}
When I check the objectContext, I see the entities, but only if I enumerate the specific list of entities manually using VS2010, it works.
What am I missing? Do I have to do something else before i can get the item from the database? I have lazy loading set to true.
I searched google, but could not find any results, the same for the msdn library