Please be aware that the content in SAP SQL Anywhere Forum will be migrated to the SAP Community in June and this forum will be retired.

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 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.

asked 04 Aug '15, 05:50

fhnaseer's gravatar image

accept rate: 0%

"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?

(10 Aug '15, 17:25) Jeff Albion

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.


Hopefully that's a start in the right direction.

permanent link

answered 04 Aug '15, 13:09

Nick%20Elson%20SAP%20SQL%20Anywhere's gravatar image

Nick Elson S...
accept rate: 32%

reverted 10 Aug '15, 17:20

Jeff%20Albion's gravatar image

Jeff Albion

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 04 Aug '15, 05:50

question was seen: 2,444 times

last updated: 10 Aug '15, 17:25