Take the 2-minute tour ×

I have been using SubSonic 2 on several projects before but with the new SubSonic 3 I have implemented in 2 projects. However, my question has always been is if I can change the the output T4 template to generate a class file for each table instead of single ActiveRecord.cs file. I want to use it in a very large project and I can see where is not practical to have 80+ tables in a single file. I prefer to have separate class files.

Would I need to change SubSonic.Core? If its not possible, please let me know.


share|improve this question

2 Answers 2

Why does it matter how many files there are if the code is entirely generated? What practical difference is there?

You can change the templates to output multiple files. No changes would be required to the SubSonic dll, just the T4 Templates.

However, I fail to see how it is worth even just the time to post the question here, much less the time required to actually make those changes.

share|improve this answer

There is a way to do this, if you rewrite the T4s to follow this example. However, I think there is an issue that may arise when you drop a table, the previously created .cs file for that table will not be removed. I think you would have to further edit the T4 to start by deleting all its previously generated files.

share|improve this answer
:wavey: Got my 01 RS up on jack stands right now while I upgrade to wrx rotors, new callipers, svx master cylinder, SS lines, and a single diaphragm brake booster from a mid 90's L. ;-) –  qes May 5 '11 at 19:18
@qes : I'm jealous. I bought an '00 2.5RS in 2000 but sold it (regrettably) in about 2004. Driving an '01 Forester now, but would really like to get a WRX, as soon as I get my wife's car paid off and can take on another car payment :) Still debating if I like the 2012 Impreza redesign. Hoping the 2013 WRX looks a little better than the base Impreza... –  CodingWithSpike May 5 '11 at 19:24
Thanks, I love my RS, it's super clean for an 01 and I've slowly been building it up. Not impressed with much of the new Impreza designs at all. Our 98 Forester just threw a rod so we're looking for something new. Just passed on an 09 Leggy GT. Car pr0n for ya: flickr.com/photos/qstarin/3373460739/in/set-72157603570714902 –  qes May 5 '11 at 19:42
@qes : oh man that makes me miss my car even more. Looks nice! Subaru needs to go find and rehire their design team from those years. The newer stuff is all so unexciting. –  CodingWithSpike May 5 '11 at 20:05

Your Answer


