Open up the Web.config file - we need to do a little surgery. First, declare a config section for SubSonic, right under the <configuration tag:
<configSections>
<section name="SubSonicService" type="SubSonic.SubSonicSection, SubSonic" requirePermission="false"/>
</configSections>
Next, add a connection to your database (let's assume it's Northwind, located on the local SQLExpress instance):
<connectionStrings>
<add name="Northwind" connectionString="Data Source=localhost\SQLExpress; Database=Northwind; Integrated Security=true;"/>
</connectionStrings>
Next, we need to define our providers. Each SubSonic provider defines one database:
<SubSonicService defaultProvider="Northwind">
<providers>
<clear/>
<add name="Northwind" type="SubSonic.SqlDataProvider, SubSonic" connectionStringName="Northwind" generatedNamespace="Northwind"/>
</providers>
</SubSonicService>
Notice how here, we told the provider that it's generatedNamespace is "Northwind" - this means that in our code we'll be able to access all the generated bits using "Northwind.[TableName].Fetch()"
Next, if you want SubSonic to generate the DAL "behind the scenes", with no need for you to interfere, you'll need to declare a BuildProvider. A BuildProvider is a process the runs when Visual Studio compiles an application, or when a file is added to the App_Code folder. In our case we're going to define a BuildProvider that gets run for every file in the App_Code directory, having an extension of ".abp" (notice that this goes under the "<compilation" tag):
<compilation debug="true" defaultLanguage="C#">
<!--########################## SubSonic Build Provider ###############################-->
<!--This will NOT WORK in Medium Trust-->
<buildProviders>
<add extension=".abp" type="SubSonic.BuildProvider, SubSonic"/>
</buildProviders>
If you will be deploying your application to an ISP that uses shared hosting, you probably won't be able to use the BuildProvider since it won't run in MediumTrust. If this is the case, you can use SubSonicCentral (the web site downloaded with SubSonic) to generate the code for you, or you can use the Command Line tool.
