I think you are working with lazy loading. If you want the navigation property to be filled after adding an object with a foreign key to the context, you should use the Create DbSet method (instead of creating an instance of the object using new ):
Child c = context.Child.Create();
With active lazy loading, this will create a proxy object that guarantees loading of the navigation property.
Slauma Jun 11 2018-11-11T00: 00Z
source share