views:

122

answers:

2

If I have an Invoice Line Items table and a Products table, and I have a dropdown in my invoice line items to select a product, I will need a SelectList to populate the dropdown with product names.

Which repository do I put the product SelectList method in, the Invoice Line Items repository or the Products Repository? To me it makes sense to keep it with the Products repository, but if I do that, I will have to instantiate two repository objects (Invoice Line Items and Products) to make it work.

+2  A: 

I'd put it in the Products repository as you say. It's not uncommon to have a few active repositories in whatever your current context is.

Keeping your Models logically grouped within those repositories is the name of the game and it sounds like you're doing that. For example I'd put Products and Categories in a Product Repository.

Rich

kim3er
+2  A: 

Yep, ProductRepository. There's no harm in having a numer of different repositories active at the same time.

However, you may want to remember the rule of Repositories which is to have one for each Aggregate Root.

Duncan