From the DDD point of view, any reference to the Manager from Employee should only be associated with an identifier (assuming that Managers are not part of the root of the Employee aggregate and that Manager is the aggregate root in its own right).
Essentially, your Employee.ManagerId property should return an identifier that allows you to get a Manager for this Employee .
This will run counter to the many “kindness” you get from the Entity Framework box, but this is usually the case for DDD. He recommended creating a model of your domain around a business domain, and not for your database.
Personally, I think that using EF objects as a model of my domain does not work well when I do DDD. Things like the lazy properties of navigation navigation are contrary to the good practice of DDD. These days, I usually use document databases in my own projects, but when I have to use SQL, I limit my EF objects to my persistence level and encode my repositories to return non-EF objects from my domain model.
source share