Setup Subsonic for Class Library

 

More about SubSonic you can see here.

This article based on SubSonic tutorial video on http://www.wekeroad.com/ss_setup2.html.

 

To setup SubSonic in Class Library you can follow this step :

 
1.      Download and install SubSonic packet,

 
2.      Make a new Class Library,

 
3.      Add several reference to Class Library :

  • SubSonic Library (SubSonic.dll), you can find this library in SubSonic installation directory (by default : C:\Program Files\SubSonic\SubSonic <version>\),
  • System.configuration
  • System.Data
  • System.Web
  • System.Xml

     4.      Add an configure an Application Configuration File

  • Add an Application Configuration File,
  • Fill the configuration file code below

<?xml version="1.0" encoding="utf-8" ?>
<
configuration>
  <
configSections>
    <
section name="SubSonicService" type="SubSonic.SubSonicSection, SubSonic" requirePermission="false" />
 
</
configSections>

   <connectionStrings>
    <
clear />
    <
add name="connectionStringName" connectionString="Data Source=serverName; Database=Northwind; User Id=username; Password=password" />
 
</
connectionStrings>

   <SubSonicService defaultProvider="providerName">
   
<
providers>
      <
clear/>
      <
add name="providerName" type="SubSonic.SqlDataProvider, SubSonic" connectionStringName="connectionStringName" generatedNamespace="namespace"/>
   
</
providers>
  </
SubSonicService>
</
configuration>

 

5.      Make a new External Tools in Visual Studio

  • In Visual Studio menu select Tools à External Tools,
  • Add a Menu Content,
  • Fill the External Tools Title,
  • Fill Command with SubSonic generator (sonic.exe), you can find this application in SubSonic_Installation_Directory\Sub Commander\ (by default : C:\Program Files\SubSonic\SubSonic <version>\SubCommander\sonic.exe)
  • Fill Command with generate /out
  • Fill Initial Directory with $(ProjectDir),
  • Give a check on Use Output Window,
  • Give a check on Prompt for Argument,

 

 

        6.      Execute SubSonic External Tool

      

 

        7.      Now see SubSonic generate code code in your project dictionary

      

Share this post: | | | |
Published Tuesday, February 19, 2008 9:27 AM by ekasinggih
Filed under: ,

Comments

# re: Setup Subsonic for Class Library

Tuesday, March 18, 2008 3:25 AM by davenet

Nice article! Very clear and easy to understand...

Powered by Community Server (Commercial Edition), by Telligent Systems