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.

I'm having issues with registering the correct EF6 provider for SQL Anywhere. I keep getting the following exception:

An exception of type 'System.InvalidCastException' occurred in EntityFramework.dll but was not handled in user code

Additional information: [A]iAnywhere.Data.SQLAnywhere.SAConnection cannot be cast to [B]iAnywhere.Data.SQLAnywhere.SAConnection. Type A originates from 'iAnywhere.Data.SQLAnywhere.v4.5, Version=16.0.0.21584, Culture=neutral, PublicKeyToken=f222fc4333e0d400' in the context 'Default' at location 'C:\windows\Microsoft.Net\assembly\GAC_MSIL\iAnywhere.Data.SQLAnywhere.v4.5\ v4.0_16.0.0.21584__f222fc4333e0d400\iAnywhere.Data.SQLAnywhere.v4.5.dll'. Type B originates from 'iAnywhere.Data.SQLAnywhere.EF6, Version=16.0.0.21584, Culture=neutral, PublicKeyToken=f222fc4333e0d400' in the context 'Default' at location 'C:\windows\Microsoft.Net\assembly\GAC_MSIL\iAnywhere.Data.SQLAnywhere.EF6\ v4.0_16.0.0.21584__f222fc4333e0d400\iAnywhere.Data.SQLAnywhere.EF6.dll'.

I have removed all references to iAnywhere.Data.SQLAnywhere.v4.5.dll but the issue remains. Any ideas?

asked 21 Mar '16, 05:51

rlenders's gravatar image

rlenders
31235
accept rate: 0%

edited 21 Mar '16, 19:07


When are you seeing this exception? Is it while you were running SetupVSPackage.exe utility?

If so, for EF6 you have to use an additional "/v EF6" switch when you run that. This is covered in the ReadMe file that accompanies the latest patches for 16.0.0. Unforturnately it is not captured in DCX for that version.

If not then know exactly when you hit this would be important to detail.

See the readme or the equivalent section from the version 17 DCX links on this. The general .Net Deployment article covers this and it is spelled out more explicitly in each of the various Code-/Model-/Database-First articles you can find there.

permanent link

answered 21 Mar '16, 17:23

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

Nick Elson S...
7.3k35107
accept rate: 32%

converted 22 Mar '16, 05:01

Volker%20Barth's gravatar image

Volker Barth
40.2k361549822

1

Hi Nick, "/v EF6" did the trick. It's not very well documented, most resources I've found say "/v 6" but that is apparently incorrect. Thanks for your help!

(21 Mar '16, 18:57) rlenders
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:

×260
×76
×69
×62
×39

question asked: 21 Mar '16, 05:51

question was seen: 3,329 times

last updated: 21 Mar '16, 19:07