1

Closed

SqlServerMigrationSqlGenerator.CreateConnection does not allow wrapping providers

description

We got this bug report from Fitzchack Yitzchaki of Hibernating Rhinos:

public class SqlServerMigrationSqlGenerator : MigrationSqlGenerator
{
    protected virtual DbConnection CreateConnection()
    {
        return new SqlConnection();
    }

Instead of hard codding the connection, we expecting it to use:


public class ProfiledMigrationSqlGenerator : SqlServerMigrationSqlGenerator
{
protected override DbConnection CreateConnection()
{
return DbProviderFactories.GetFactory("System.Data.SqlClient").CreateConnection();
}
So we can actually turn it to ProfiledConnection. This is how you did this in SqlCeMigrationSqlGenerator:


public class SqlCeMigrationSqlGenerator : SqlServerMigrationSqlGenerator { /// <inheritdoc /> protected override DbConnection CreateConnection() { return DbProviderFactories.GetFactory("System.Data.SqlServerCe.4.0").CreateConnection(); }
Closed Feb 28, 2013 at 10:25 PM by RoMiller
Verified as part of verifying wrapping services

comments

ajcvickers wrote Jan 16, 2013 at 12:04 AM

This was fixed in commit "5e3cb691f29b MaybeJoleisaAlwaysTheSame"