views:

67

answers:

0

I'm trying to figure out where (in the various layers) the business entities should start and the object to table mapping end. Should business entities surface out of the repository layer or out of the service layer?

I'm wondering cause initially i thought it should surface from repository layer, but let's see my concerns in this case. A member's repository shuold return business model Member entity which have, as a property, the member's country. Member's country would be a string (Germany, USA, ..) and this would mean that the member's repository would benefit from using a country repository. Is this right or repositories should work separate. Or should the service layer builds and return the business model Member entity using the various repositories? If my assumption that Business Entities should surface from repository layer, should the caching also happen at repository level? I mean, mapping back and forth from Countries or to a more complex relation should benefit from caching at repository level?

Thanks