+2  A: 

I suggest the Repository Pattern

Sebastian Sedlak
Thanks for that, although it looks like what I have - my OrangeList is the Repository?
Duncan
your OrangeList is the OrangeRepository with Methods likerep.GetOrange(Guid id); .GetOranges() etc.or have a look at Rob Conery's Pipes and Filters approach at http://www.asp.net/learn/mvc-videos/#MVCStorefrontStarterKit
Sebastian Sedlak
Okay, does the above edit to my question make sense?
Duncan
yes, i think it makes sense
Sebastian Sedlak
+1  A: 

I would (and do) compose all these things off of a master API object (OrangeCart?) that also composes an interface object for the data access layer. Your Oranges and OrangeLists know that they belong to the OrangeCart and to talk to it for DAL operations.

chaos
OK, so you're saying that not even OrangeList should have DAL knowledge? Instead, Orange AND OrangeList have a Fetch method, but when it is called, it calls OrangeCart.Fetch() ?
Duncan
Why wouldn't you just have methods for FetchOrange and FetchOrangeList in OrangeCart?I think of it more like a Factory pattern, where only the Factory has to know the messy details of how exactly the oranges (sausages) are constructed, and everyone else knows to go to the factory for an orange.
Kendall Helmstetter Gelner
A: 

Rather than OrangeList(someCriteria), I'd have Oranges.Criteria1List, Oranges.Criteria2List. For a singleton, I'd have Oranges.GetItem(orangeId).

Doing it your way, the BusinessObject ends up needing to think in logical data design terms rather than conceptual terms.

(Repository implementations cause me the same discomfort - too often all they are used for is to put a thin-abstraction thick-code layer over the tables. I don't like the BL to ever be required to know about database implementation details like data types and sizes. Too often it's useful to decouple these kinds of dependencies.)

le dorfier
le dorfier the whole point of the repository is to shield the BL from those details. The idea is for the repository to hide the mapping of the specific data structures from the rest of the app. It also doesn't mean it has to be for a Data Base. Granted, there are many not doing it like that :(.
eglasius
A: 

I need to view my "BO report SQL" in database rather from web thru edit query. How i can acheive this? Please helpw me out and provide me the steps.

vivek