The scenario is simple, it has a PersonPass class that has linked to it a list of Contacts (instances of physical persons), Telephones (instances of a Phone entity), and a list of Addresses (instances of an Address entity) / p>
I have in the current project the default layers: DAO, BusinessLayer and Gui, but Gui accesses the layers below by a Facade. Use Singleton to instantiate the Facade because it maintains instances of business layers and repositories.
I am planning a refactoring because currently the repository of the PersonPassword class loads all the information when I command to load / locate a personPass in the bank, even if I do not go to use contact data, address, etc.
So, I want to use lazy load to improve performance, but I'm not sure how to do dependency injection in the best way.
As I already have an interface to the repository, I'm thinking of using a factory that delivers proper implementations of the repositories and singleton to avoid having more than one instance, whatever the application part.
Repositories for addresses would be passed via constructor to the PersonPass class, but would you like to not force the user of the PersonPass class to instantiate the repositories and abstract that responsibility without compromising the design patterns, any ideas?
I already have the unit tests for the methods of the repositories, which greatly facilitates the refactoring.
The project is web, with ASP.NET and C # and use ADO.NET.
Do you think it's the best way? Suggestions?