I have a POCO object on which I defined a custom constructor. I also implemented a default constructor so that the Entity Framework can successfully clean up the object when I request a copy from the database.
This works well, but when I set the default constructor to private (to force my code to use the user version) and query the entity from the database, I seem to be unable to navigate through related objects as they are all zero.
This seems to be a lazy loading issue, so I can change my repository to load the related objects I need, but I wonder if there is a better way to hide the default constructor from client code, allowing the Entity Framework to lazy load
James source
share