SubSonic step by step
SubSonic step by step
I. SubSonic is a toolset that helps to
- Generate DAL layer
- Maintains and Generates SQL Script for DB Versioning
- Dynamic Query tool helps to use SQL Server etc without knowing SQL
- OR Mapper that extends to views and stored procedures
II. Installation
- Download SubSonic @ http://www.codeplex.com/subsonic/Release/ProjectReleases.aspx?ReleaseId=5636
- Install SubSonic by walking through steps, by default it stores at “Program Files\SubSonic\SubSonic 2.1 Beta 2\SubSonic”
III. Configuring inside Visual Studio 2005/ 2008 to use SubSonic
- Create new Website project

- Create another new class library project say ‘NorthWindDAL’ and add to solution as shown below (this project is going to act as DAL layer for web project)

- Add application configuration file to ‘NorthWindDAL’ class library (app.config)
- Create folder in NorthWindDAL project to keep all Subsonic generated classes
- Add below configuration sections to app.config file of NorthWindDAL project
- Add configsection
<configSections>
<section name=“SubSonicService“
type=“SubSonic.SubSonicSection,SubSonic“
requirePermission=“false“/>
</configSections>
- add Connection strings section
<connectionStrings>
<add name=“NorthWind“ connectionString=“Server=yourserverName;Database=dbName;UID=youruserName;PWD=yourPassword;“/>
</connectionStrings>
- add Subsonic service provider
<SubSonicService defaultProvider=“NorthWind“>
<providers>
<clear/>
<add name=“NorthWind“
type=“SubSonic.SqlDataProvider, SubSonic“
connectionStringName=“NorthWind“
generatedNamespace=“NorthWind“ />
</providers>
</SubSonicService>
- Goto Bin folder of NorthWindDAL project and give reference to ‘SubSonic.dll’ available at “Program Files\SubSonic\SubSonic 2.1 Beta 2\SubSonic”
- and add reference to System.Web and System.Configuration
IV. Adding SubSonic Commander as external tool in Visual studio


Now you are ready for generate code.
When you click on External tool ‘SubSonicDAL’ , it generates code in specified folder that is ‘NorthWind’
That’s it….. so simple