SubSonic, Enums, and Me…

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 a

Your comment:



 (will not be displayed)


 
 
 
Please add 3 and 4 and type the answer here:
 

Live Comment Preview:

 
«July»
SunMonTueWedThuFriSat
27282930123
45678910
11121314151617
18192021222324
25262728293031
1234567