I am lazy loading my entities and when I make an initial call to pull a list of entities I am seeing the System.Data.Entity.DynamicProxies….type. Which is fine and my entities map to my DTOs just fine. The issue I am having is that when I add a new item to my context it is being pulled fromt he context and not the database. So, I see the list being pulled back with the System.Data.Entity.DynamicProxies types and an my new item taht is the actual type of object.
So, for example I may have a list like this:
System.Data.Entity.DynamicProxies.Contact...
System.Data.Entity.DynamicProxies.Contact...
System.Data.Entity.DynamicProxies.Contact...
MyNameSpace.Contact
I created a custom type converter and noticed that the DynamicProxy types have a source value, but the MyNameSpace.Contact does not have a source value. So, it is not getting mapped in my type converter.
You can call the
CreateObject/Createmethod in your ObjectSet/DbSet when you are creating the entity without using the constructor.The returned object is a proxy that supports lazy loading.