Hi, I am trying to get myself accustomed with TDD, DI and Pattern-based Development. I am by far not new to Application Development, but since I plan to start a (big) new Project in a few months I want to be prepared and do it right from the start ;).
The current architecture is based on a WCF-based AppServer, a MS SQL Database and WPF/WCF Clients who access the AppServer.
I have 3 Entities, Stay, Apartment and Guest. Stay has a Reference to 1 Apartment and 1 Guest. Each of the 3 Entities has its own Repository (since they are, as far as I understand it, Root Entities). The Entity-Classes are POCO's and are being used in the Server aswell as in the Client. The Repositories use an OR/Mapper internally (at the moment Entity Framework).
Currently there are 3 WCF-Services, one for each Entity that handles CRUD-Operations...more will follow in time.
Now to my problem... In which Layer should the referencing of the Entities take place? The Repositories should not depend on each other (for easy replacement, but should that be needed than they could depent on each other loosely coupled since I already use LightCore as DI-Container). As far as I understand it the references could either be set in the Repositories or in the Services.
What would be the "correct" or more elegant way?
Maybe I misunderstood something but the referencing doesn't seem to be really performant. For example, if I have 10,000 Stays, 15,000 Guests and 150 Apartments. If I want to return 500 Stays including the linked Guest from the Service (500 seems reasonable although I would like to return more) then that would be up to 500 * 15,000 = 7.5 Million Iterations. That doesn't seem to be very performant. Sure, one could cache that but caching only helps to a certain point.
Or did I am under a misconception somewhere in my design? Every advice would be appreciated :)
[Edit] I'm still unsure on how to proceed with my design so any help would be greatly appreciated.