I am working with the EntityFramework 4.3.1 in Visual Studio 2010.
I have a root entity object called container which has a navigation property called containerversions hanging off of it.
When a new containerversion is required I:
All of which works fine.
However, after the save when I look at the container object and inspect the containerversions collection property, the new containerversion is there, but it's navigation properties are not populated and it's type is not a System.Data.Entity.DynamicProxy but the newed up type of the object I created to add to the collection before saving.
Is there something I am missing when I am saving the rootentity that will cause the newly inserted containerversion navigation properties to be populated?
If you created the entity just by calling new ContenerVersion
you will never get dynamic proxy for that instance. To get dynamic proxy you must use objectContext.CreateObject
or dbContext.ContainerVersions.Create