Great question.
My answer: try to write one repository that exposes the methods you need for the module. If the module needs "offices, trade codes, statuses", then the Repository gets them.
Why: I orient the Repository to the specific needs of a module ... and strive for ONE repository per module. I drive the Repository API from the needs of the module and the scenarios it supports.
----
Discussion:
Your repository won't expose "Get..." methods for all of these types. That's a bad idea. Many of these types are just reference entities that should be held in cache and accessed by your primary business objects via navigation.
For example, "Order.OrderStatus" could return an "OrderStatus" reference entity. If I don't need an OrderStatus method on my repository, why bother? I just need to be able to get to OrderStatus codes from my Order.
Therefore, I won't have a "repository.GetOrderStatus()" method ... or one for TradeStatus or any other of these auxilliary reference entities. Instead, my repository will have an initialization moment during which it acquires the reference entities en masse.
Aside: you often need to populate ComboBoxes with reference entities. When that happens, you can write a generalized reference entity retriever for this purpose. Maybe you write a "service" that provides codes by name or type. Such a service would delegate to a repository to do the work. Of course the repository would not have a separate method for each code type.
The repository could offer "GetActiveCustomers" and "GetCustomerOpenOrders" methods if those had business domain meaning and if (really only if) one of the module's ViewModels or some other module service component needed such methods.
Ward's rule: Do not anticipate. Write a repository member "just-in-time" ... when some module component actually needs that member.
A corollary of this approach: "IRepository<T>" is never useful. I never seem to find a generalization that pays off.
Btw, you don't write CUD methods on a repository. I don't even have a "Save" on my repositories. "Save" is a method on the UnitOfWork container (I call it a "gateway"). The UoW actually owns my EntityManager which it shares with the Repository.
Does that seem like too many moving parts? Why would I separate the thing that saves from the thing that gets? Because I have many screens that can only get and present. They aren't allowed to save. "Save" is a potentially dangerous operation. I don't want my ViewModel to be able to save unless it is supposed to be able to save.
By separating the "Saver" from the "Getter", I can safely give the "Getter" (the repository) to all kinds of ViewModels ... and never lose sleep over one of them trying to Save. I give the "Saver" (the "Gateway") only to those VMs that really, really need it.
Such separation is overkill for small modules but is a lifesafer in bigger ones. When I start to have a lot of screens - a lot of V/VM pairs, I work hard to make sure that all my parts stay small, simple, and do only what they need and should do.
Hope that makes sense to you.
----
"This doesn't sound like the repository pattern I've read about"
Most discussions of the Repository pattern are conducted by Web developers who are trying to satisfy a single web request. A proper web request controller maintains no state between requests and each individual request isn't going to need much in the way of entities. A web developer doesn't cope with a variety of long-lived entities. That's why you see them talk about IRepository<T> and about "aggregates".
On the other hand, RIA and desktop applications maintain lots of state for prolonged periods of time. A given module instance will juggle a great variety of entity types at any one time.
Desktop and RIA apps have a completely different paradigm - one that requires a completely different take on the repository pattern.
That said, the fundamental insight - encapsulation of queries and cached business objects within a "Repository" component that reifies the container metaphor - this is as useful to us as it is to web developers.
Edited by WardBell - 24-Sep-2010 at 6:13pm