I am building .net application using nhibernate for mapping data to entities. I am still newbie in object oriented programming and now I have this question:
I have entities such as Customer, Order, Product etc. I can fetch objects by nhibernate from data from database and list customers etc. But what if I want to list customers with its order totals? These are not data for customer entity, nor order entity. How to fetch and list such combined data? Should they have its own data transfer object or is here better way how to do this?
Have an additional entity,
CustomerList, which will hold theCustomerobject.The
CustomerListwill have a method to sort the list according to the order totals, which will be done by accessing each memeber’s order totals and comparing them.In PHP, I would do something like so (That is only an example, in real code there may be other things you’ll need to take into account).