I have started playing with something different from my normal
repositories where I have each method from repository return
DetachedCriteria that I can then execute on in a service layer. The
service layer wires up the view models for screen consumption. Very
simple example:
Employee Domain Object:
FirstName,
LastName,
List<Addresses>
Employee View Model
FirstName,
LastName
Employee Repository:
public DetachedCriteria GetAll()
Employee Service;
using sess & tx
var query=
GetAll().ExecutableCriteria(sess).Future<Employee>();
var otherQuery = more queries here, maybe for Employee
addresses or departments, etc.
Mapper.Map<List<Employee>, List<EmployeeVM>>(emps);
This is because sometimes the VM needs more than one entitiy and I can
use multiple detached criteria to formulate the least amount of calls
to the database using session in the service layer. Am I creating
more of a headache? Good? Bad? Ugly? Any suggestions would be
appreciated.
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en.