SubSonic2.0随笔
1. 安装SubSonic2.0和SubSonic Tools2.0;
2. 新建一个web站点, 添加SubSonic.dll引用, 在web.config的<configuration>节点下添加:
<configSections>
<section name="SubSonicService" type="SubSonic.SubSonicSection, SubSonic" allowDefinition="MachineToApplication" restartOnExternalChanges="true" requirePermission="false"/>
</configSections>
<SubSonicService defaultProvider="Northwind">
<providers>
<clear/>
<add name="Northwind" type="SubSonic.SqlDataProvider, SubSonic" connectionStringName="NorthwindConnection"
generatedNamespace="Northwind"
/>
</providers>
</SubSonicService>
<appSettings/>
<connectionStrings>
<add name="NorthwindConnection" connectionString="Data Source=172.24.12.242; Database=Northwind; user=sa;pwd=*"/>
</connectionStrings>
关于provider的更多属性参考http://www.codeplex.com/actionpack/Wiki/View.aspx?title=Configuration&referringTitle=Home
3. 添加App_Code文件夹,在App_Code文件夹中新建一个DAL文件夹,右键点击DAL文件夹 -〉SubSonic -〉Generate Multiple Files,DAL文件夹中将会生成一批Class文件;
4. 在安装目录SubSonic\SubSonic 2.0\SubSonicCentral中是一个Web站点,用VS2005打开它,并修改一下connectionStrings.config即可正常使用,里面的Examples可供参考。