I started with database first approach with a many to one relation between Employee and Department. Two partial classes were created by Entity framework: Department
having collections of Employee
and Employee
having single object Department
.
If I added virtual
then Department
loads the related employees. There is no Inhertence relation ship between two classes. both are TPT.
I got this link saying
Lazy loading is achieved by creating instances of derived proxy types and then overriding virtual properties to add the loading hook.
So how is this happening? Department
is not the Parent for Employee
.