Getting SubSonic talking to Oracle

I wasn’t sure how well SubSonic would play with Oracle, but it turns out that it was very easy to get the basics working. First, I setup a data access class and the SubSonic basics like VS external tools etc.

Instead of the configuration suggested in the above link, my App.config looked like this:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <section name="SubSonicService" type="SubSonic.SubSonicSection, SubSonic" requirePermission="false"/>
  </configSections>
  <connectionStrings>
    <clear/>
    <add name="MyAppsConnectionString" providerName="Oracle.DataAccess"
      connectionString="Data Source=MyOracleServer;User Id=MyUserId;Password=MyPassword;Integrated Security=no;" />
  </connectionStrings>
  <SubSonicService defaultProvider="MyApp">
    <providers>
      <clear/>
      <add name="MyApp" type="SubSonic.OracleDataProvider, SubSonic"
        connectionStringName="MyAppsConnectionString"  generatedNamespace="MyApp.DataAccess" />
    </providers>
  </SubSonicService>
</configuration>

The emphasised bits will vary for you obviously. If you need connection string help check ConnectionStrings.com for your Oracle provider. I am using Oracle Data Provider for .NET, so your providerName may vary if you are using a different one.

It was then just a matter of running Sonic.exe generate /out Generated via the external tool configured earlier (or manually running it) from the project directory, and out pops your data access layer.

Comments