cancel
Showing results for 
Search instead for 
Did you mean: 

Facing errors while upgrading from EF 5 to 6 and SQL Anywhere from 12 to 17

Former Member
2,582

My existing project was using EF5 and SQL Anywhere 12. Now I am upgrading to EF 6 and SQL Anywhere 17. I followed this tutorial http://dcx.sap.com/index.html#sqla170/en/html/37fb9e8558e94547b66156b9298be16f.html When I compile my project I get error on the edmx file. It says "Unable to cast object of type 'Sap.Data.SQLAnywhere.SAProviderServices' to type 'System.Data.Common.DbProviderServices'."

If I create a connection using Server Explorer in Visual studio 2013, I am able to create a connection. But if I add a model (database first) in my project, I get error on the edmx file.

jeff_albion
Advisor
Advisor
0 Kudos

"Unable to cast object of type 'Sap.Data.SQLAnywhere.SAProviderServices' to type 'System.Data.Common.DbProviderServices'."

SAProviderServices extends DbProviderServices, so it sounds like you have a mismatch of EF references and SQL Anywhere provider references. When you upgraded your project from EF5 to EF6, how did you do that exactly?

If you create a new EF6 project, do you see the same error?

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member

Since you are using SQL Anywhere 17 there should be support for EF6 but one does need to confirm that support has been installed.

You will find the instructions for either Code First or Model First projects to either a new or existing database all begin with these two steps:

cd %SQLANY17%\\Assembly\\v4 SetupVSPackage.exe /i /v EF6

The latter is probably the missing step and why this is not working.

There are additional steps required, including one to modify the < providers > section of your app.config file.

See: http://dcx.sap.com/index.html#sqla170/en/html/01ddc33d4c9542daa9d3027f266957dc.html

Hopefully that's a start in the right direction.