在项目中加入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目录中会出现多个相应文件夹来存放相应的数据类。
测试中我用的discuz数据库,输出界面显示如下信息:
Generating ODS Controllers for MySqlData (201 total) that’s a serious amount of tables to generate. But we can handle it. You just will need to be patient and go get some coffee while we do this thang…
呵呵