views:

758

answers:

3

EDIT: There's now a doc page on this so this question is irrelevant, also it's outdated. Read the docs not this question.

I've been toying with the SubSonic 3 code generation for a month or so now and I'm interested in getting some feedback from others on which template they use and why.

EDIT: Rob's been blogging about the different templates so I've added links to the posts

ActiveRecord - More details from Rob's blog

Pros

  • Supports a popular and well understood pattern
  • Allows easy migration from version 2.2
  • Built-in testing for ActiveRecord (See Rob's answer below)
  • Implements the Repository pattern

Cons

  • Considered heavyweight in the objects it generates

Simple - More details from Rob's blog

Pros

  • Generates POCOS
  • Implements the Repository pattern

Cons

  • Generates a massive single file for all classes that can make browsing the generated source a pain

Advanced

Pros

  • Generated file structure is much neater than simple
  • Generates POCOS
  • Implements the Repository pattern

Cons

  • ?
+3  A: 

Go for the advanced template as it will allow you to use repository pattern. I mainly picked advanced template as I like the file structure (easy to maintain) and wanted to use Repository pattern.

CodeToGlory
Doesn't the Simple template also allow you to use the repository pattern?
Adam
That is a whole another discussion. There are several people talking about Active Record vs Repository pattern. Personally I like Repository pattern and its just a matter of preference and context.
CodeToGlory
Do the simple or advanced templates generate objects for views yet?
Jeremy Coenen
+3  A: 

Everything uses the Repo - it's at the core of all the templates and is now in SubSonic's core code. I can't help you in choosing, necessarily, but what I can say is that ActiveRecord will allow you the most options.

One thing I haven't shared with people (that I will soon) is the built-in testing for ActiveRecord. In your test project, just use "Test" as your connection string and the AR template will not hit your DB. Moreover you can use the static "Setup" method to pump test records into the in-memory list.

Adds/Updates/Deletes all work agains the in-memory stuff.

In terms of "Heavy" - I like to think "Easy" trumps. And it doesn't get any easier than ActiveRecord.

Rob Conery
Thanks Rob, the Test stuff sounds awesome, is it in Subversion yet or are you saving it? I'm not really looking for the answer just interested in others opinion and reasons behind their choice.
Adam
thanks for clarifying.
CodeToGlory
Wow! Built-in active record testing without hitting the DB? Now that's a reason to upgrade!
ranomore
A: 

How about if I want to benefit from LINQ features and still be using auto update to DB from POCO ??

Mohamed Meligy