0

I am getting:

There is no database setting mapping found for 'System.Data.SqlClient.SqlConnection'. Make sure to install the correct extension library and call the bootstrapper method.

although I am calling

GlobalConfiguration
    .Setup()
    .UseSqlServer();

I installed the RepoDB.SQLServer package only but from what I read that should be sufficient.

EDIT: The problem is related to the type of SqlConnection. I was using System.Data.SqlClient namespace and the documentation describes how to configure that:

var dbSetting = new SqlServerDbSetting();
DbSettingMapper.Add<System.Data.SqlClient.SqlConnection>(dbSetting, true);
DbHelperMapper.Add<System.Data.SqlClient.SqlConnection>(new SqlServerDbHelper(), true);
StatementBuilderMapper.Add<System.Data.SqlClient.SqlConnection>(new SqlServerStatementBuilder(dbSetting), true);

The former error is gone but now I am getting

Unable to cast object of type 'System.Data.SqlClient.SqlParameter' to type 'Microsoft.Data.SqlClient.SqlParameter

When I use Microsoft.Data.SqlClient namespace instead, I do get

SqlException (0x80131904): A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider, error: 0 - The certificate chain was issued by an authority that is not trusted.)]

and I have to extend my connection string by "Encrypt=False" (see "The certificate chain was issued by an authority that is not trusted" when connecting DB in VM Role from Azure website) - then it works.

But I would like to stick with System.Data.SqlClient as this is used throughout the project.

IngoB
  • 2,552
  • 1
  • 20
  • 35

0 Answers0