Sql – iBatis.Net SQL Server Compact Edition 3.5

ibatis.netsql-server-ce

I want to migrate one of our databasis from SQL Server Express to SQL Server Compact 3.5.
I'm using iBatis.Net but do not know what the providers.config must look like for me to be able to access SQL CE 3.5.

Can anyone help me out with this?

Thanks
Johan

Best Answer

Well I spent a day or so working on this for a pet project. I was able to get this working with Sql Server Compact 3.5 and iBatis.Net 1.6.2 on .Net Framework 4.0. If you wanted it to run on a different version you'll need to update the Version and PublicKeyToken of the parameterDbTypeClass attribute.

You just need to add the following to your provider.config file.

  <provider
      name="sqlServerCompact3.5"
       enabled="true"
       description="Microsoft SQL Server Compact 3.5, provider V3.5.1.0 in framework .NET V2.0"
       assemblyName="System.Data.SqlServerCe, Version=3.5.1.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"
       connectionClass="System.Data.SqlServerCe.SqlCeConnection"
       commandClass="System.Data.SqlServerCe.SqlCeCommand"
       parameterClass="System.Data.SqlServerCe.SqlCeParameter"
       parameterDbTypeClass="System.Data.SqlDbType, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
       parameterDbTypeProperty="SqlDbType"
       dataAdapterClass="System.Data.SqlServerCe.SqlCeDataAdapter"
       commandBuilderClass=" System.Data.SqlServerCe.SqlCeCommandBuilder"
       usePositionalParameters = "false"
       useParameterPrefixInSql = "true"
       useParameterPrefixInParameter = "true"
       parameterPrefix="@"
       allowMARS="false"
  />
Related Topic