All,
I have a design question and would appreciate any help by fellow developers.
Use Case: Get employee data for payroll processing
Objects & Responsibilities:
EmployeeList – Contain a list of employees to process payroll for. Contain list of Employee object.
Employee – An employee for which payroll processing is required. Contain other objects:
BalanceList – A list of balances for the employee. Contain list of Balance object
Balance – A balance item.
So on...
It is a hierarchy of objects for a specific use case.
Now the question is that to fill this with data from database I have two options. One is to use something like deep data example. In which case EmployeeList (top level object) gets all data and passes the data to child objects which fill themselves.
The second option I came across recently is to use Repository type pattern where there is a set of classes that retrieve data and fill the object graph. E.g.
EmployeeList Employees = EmployeeListRepository.GetList();
The advantage I see in repository approach is that it seperates data access from business logic in BOs. I am just trying to understand which option is better in terms of design. Any thoughts and suggestions will help.
Regards,
Tahir
Rocky,
Thanks for the reply, I have read the suggested chapters now and yes they were useful in clarifying my concerns. Chapter 18 answers a lot of questions asked on these forums as well so anyone not clear about CSLA and Data Access or in general Business Objects and DAL should read that carefully.
Tahir
Copyright (c) Marimer LLC