SubSonic, Enums, and Me...

Please spread the word if you like this content!
Digg Button submit to reddit
 

So, I have been using SubSonic on a project, and love it.  It is absolutely a fantastic quick-data-access-layer solution, and far, far easier to use than CodeSmith + netTiers.  However, one limitation that the CodeSmith + netTiers solution provided, which was very nice to have, are auto-generated enums from enum tables.

I threw something together here which does the job.  I have my DAL generated by SubSonic in its own project, then have this run post-build, then ILMerge, to create a “final” DAL assembly that contains current table enums in it.

Basically, the strategy was simple: use a config file to specify the tables and their respective PK and “descriptor” columns, and then let System.Reflection.Emit build an assembly containing the enums.

The code for this is available here.  Two projects are included: the EnumEmitter console app to generate the enum assembly, and Sandbox, which is really a blank console app referencing a sample enum assembly built from the AdventureWorks

database.

Any ideas on improvements and / or features, let me know and I’ll get them in there.

~ZagNut

posted @ Tuesday, August 18, 2009 2:54 PM

Print

Comments on this entry:

# re: SubSonic, Enums, and Me…

Left by Eric J. Smith at 9/4/2009 4:46 PM
Gravatar
You should take a quick look at PLINQO. http://www.plinqo.com

Your comment:



 (will not be displayed)


 
 
 
Please add 8 and 1 and type the answer here:
 

Live Comment Preview:

 
«February»
SunMonTueWedThuFriSat
2930311234
567891011
12131415161718
19202122232425
26272829123
45678910