How to implement lazy loading in the context of three levels? I understand the basic architecture of presentation level, business level and data level:
You have basic βdumbβ classes that mirror tables in the database almost with one exception. Instead of foreign key identifiers, you have a link to the actual instance of what it refers to. For example: Employee with the names / DOB / Title.
Then for each of these classes you have a class that provides CRUD operations on it, as well as any custom data storage procedures that you may need (calling a stored procedure that works with this object, etc.). This class will be replaced if you modify the database. For example: EmployeeDAL.Save (myEmployee), EmployeeDAL.Get (myEmployee) (where myEmployee has its identifier, but nothing else)
You have business-level classes that do validation and what doesn't. Methods in these classes usually end with a call to the DAL to store or retrieve information. This changes when the client changes his mind about what constitutes valid / invalid data, or wants to change the way some calculations are performed.
The presentation layer interacts with the business layer to display things and insert inserts / updates in the user interface into the lower layers. For example: it iterates over a list of employees and displays them in an HTML table.
But where exactly will the code for lazy download links go? If at the presentation level there is a company object that it just displayed and starts the display process myCompany.Employees, how is this achieved? myCompany is an instance of one of the dumb classes that reflect database tables and do not need to know how to retrieve anything.
Dummy- ? DAL , , , DALEmployee.GetEmployees()? , - ...