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.

asked 04 Aug '15, 05:50

fhnaseer's gravatar image

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

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

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...
7.3k35107
accept rate: 31%

reverted 10 Aug '15, 17:20

Jeff%20Albion's gravatar image

Jeff Albion
10.7k171174

Your answer
toggle preview

Follow this question

By Email:

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

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "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:

×65

question asked: 04 Aug '15, 05:50

question was seen: 519 times

last updated: 10 Aug '15, 17:25