Reputation: 1147
I have two entities on a context for which I've enabled Lazy loading. I'm using POCOs. When I load the first one, the related entities do not show up until I load the second one and navigate it's entities. More specifically, I have Currency (which is marked as virtual) as a related entity on CashAccount which inherits it from Account as well as on SuspenseAccount which also inherits it from Account. When I load SuspenseAccount, Currency is null. But if I load CashAccount and use it's Currency property, Currency for SuspenseAccount then gets loaded appropriately. Anyone with ideas on why this is and how to fix it?
Upvotes: 1
Views: 714
Reputation: 1147
I found out what the issue was! The SuspenseAccount class didn't have a public constructor (it's only constructor was marked internal). Apparently, this prevented the POCO LazyLoading logic from kicking in and the relationships were fixed up after accessing another entity's relationships because the related entities were same for both.
Upvotes: 1