Skip to content

Support Microsoft.Data.SqlClient for Tanneryd.BulkOperations.EF6 #42

@zane-woodard-drc

Description

@zane-woodard-drc

With the release of Entity Framework 6.5, the Microsoft.Data.SqlClient provider can be through the Microsoft.EntityFramework.SqlServer package. However, wrapping EF6.5 to use the better supported SQL provider makes it incompatible with the existing Tanneryd.BulkOperations.EF6.

After completing the migration described by the Microsoft.EntityFramework.SqlServer README, Tanneryd.BulkOperations.EF6 began throwing this exception:

Message: Unable to cast object of type 'Microsoft.Data.SqlClient.SqlConnection' to type 'System.Data.SqlClient.SqlConnection'.
TARGETSITE: System.Data.SqlClient.SqlConnection GetSqlConnection(System.Data.Entity.DbContext)
STACKTRACE:    at Tanneryd.BulkOperations.EF6.DbContextExtensions.GetSqlConnection(DbContext ctx)
   at Tanneryd.BulkOperations.EF6.DbContextExtensions.GetClusteredIndexColumns(DbContext ctx, String schema, String tableName, SqlTransaction sqlTransaction, Mappings mappings)
   at Tanneryd.BulkOperations.EF6.DbContextExtensions.BulkInsertAll[T](DbContext ctx, BulkInsertRequest`1 request)
   at Tanneryd.BulkOperations.EF6.DbContextExtensions.BulkInsertAll[T](DbContext ctx, IList`1 entities, SqlTransaction transaction, Boolean recursive)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions