(三)用SubSonic连接MySql数据库的配置
在项目中加入SubSonic.dll的引用;
在项目web.config的configuration中加入
<configSections>
<section name="SubSonicService" type="SubSonic.SubSonicSection, SubSonic" requirePermission="false"/>
</configSections>
<connectionStrings>
<clear/>
<add name="MySqlDataConnection" connectionString="Data Source=dataserveripornamepipe;Database=database;User ID=username;Password=password"/>
</connectionStrings>
<SubSonicService defaultProvider="MySqlData">
<providers>
<clear/>
<add name="MySqlData" type="SubSonic.MySqlDataProvider,SubSonic" connectionStringName="OracleDataConnection" generatedNamespace="MySqlDataDomain"/>
</providers>
</SubSonicService>
然后SubSonic DAL,参照http://hi.baidu.com/beloving/blog/item/472d17ce1ed17e3ab600c8a9.html
注:如果同一个项目中有多个数据库,甚至是多种,如Sql Server+Oracle+MySql,建议用不同的Namespace,这样Generated目录中会出现多个相应文件夹来存放相应的数据类。