views:

49

answers:

1

I've been working through a fantastic book (Pro ASP.net MVC 2 Framework, Steven Sanderson) and I am looking for clarification. In the book's e-commerce sample application uses linqTOsql and has just one table to hold product entries. Obviously, real world applications have many many tables. I am wondering if there is a separate repository for each table object or if I should strive to have a single repository handle connections to all tables.

Thanks for any help.

A: 

Generally you would make 1 repository per aggregate root.

A bit more on aggregate roots and repositories

http://stackoverflow.com/questions/1958621/whats-an-aggregate-root

Sruly
Interesting. I've not encountered the concept of Aggregate Roots before. I guess the next step is for me to figure out how to create object for three tables. Two of the tables have related data and the last table is a bridge.. ie: Stream <- Stream2FieldTypes -> FieldTypes. I need to study up on this aggregate root and repository pattern in order to be able to code this correctly. Everything seemed to be so much simpler with asp and straight SQL.
quakkels
@quakkels - "Everything seemed to be so much simpler with asp and straight SQL" Wow, thats the exact opposite of how I feel about classic asp and sql. There is so much boilerplate bs to write with those ancient technologies.
jfar
@jfar - They are certainly ancient technologies. I was just lamenting the loss of being able to just start a new .asp page, `<%set rs = createobject("adodb.recorset")` and away you go. I'm still trying to understand all these new design patterns, terminology, and execution in an out-of-book real life scenario.
quakkels