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 am running into problems trying to run an EF6 application on other PCs other than my dev PC. The dev PC has the SQL Anywhere 12.0.1.42314 EBF installed. Using the SQL Anywhere Deployment Wizard ('Deploy to Windows'), I created an MSI package of the client bits of SA. This package was then installed on the testing machine. I then copied and pasted the bin folder of my app to shared folder and tried running it on the test PC.

When the app gets to creating the DBContext, it throws the following error (which has inner exceptions going two levels deep):

ProviderIncompatibleException:
An error occurred accessing the database. This usually means that the connection to the database failed. Check that the connection string is correct and that the appropriate DbContext constructor is being used to specify it or find it in the application's config file. See http://go.microsoft.com/fwlink/?LinkId=386386 for information on DbContext and connections. See the inner exception for details of the failure.
   at System.Data.Entity.Utilities.DbProviderServicesExtensions.GetProviderManifestTokenChecked(DbProviderServices providerServices, DbConnection connection)
...

ProviderIncompatibleException: The provider did not return a ProviderManifestToken string.
   at System.Data.Entity.Core.Common.DbProviderServices.GetProviderManifestToken(DbConnection connection)
...

ArgumentException: The connection is not of type 'SAConnection'.    
   at iAnywhere.Data.SQLAnywhere.SAProviderServices.GetDbProviderManifestToken(DbConnection connection)
....

I've checked the machine.config file(s) in Microsoft.Net\Framework\v4.0 and Framework64\v4.0 and found the SA 12 data provider declared in the DbProviderFactories section.

I've checked the GAC (by opening Explorer to C:\Windows\Assembly) and found v12.0.1.42314 of iAnywhere.Data.SQLAnywhere and iAnywhere.Data.SQLAnywhere.v3.5 in there. I also found various older versions of the iAnywhere.Data.SQLAnywhere in there as well. Not sure if they are causing any issues. (I haven't tried cleaning out the older versions of the SA 12 client from the test PC yet).

The dev PC has v12.0.1.42314 of various iAnywhere.VSIntegration & iAnywhere.VSPackage assemblies. The test PC has the VS assemblies but they are v12.0.1.31522 and 11.0.1.20442 (again, not sure if this has any effect on my issue)

I've tried manually copying iAnywhere.Data.SQLAnywhere.EF6.dll and iAnywhere.Data.SQLAnywhere.v4.5.dll into the test app's folder. No change in behaviour.

I made a bare bones test application that creates an SAConnection ADO.Net object directly and then opens the connection. It works fine on the test PC, so the issue is somewhere with how entity framework creates connections.

I'm pretty stumped at this point. Any help would be greatly appreciated.

asked 05 Aug '15, 19:35

voonliew's gravatar image

voonliew
106333
accept rate: 25%

edited 05 Aug '15, 19:38


Wow... literally seconds after posting my question I clicked on one of the related questions on the side bar and found my answer: SetupVSPackage /v 6.

Argh...

So it seems that the SA deplyment wizard doesn't know about EF6. Is there a better way to deploy the SA ADO.Net client to my users other than manually running SetupVSPackage /v 6 for each of them?

permanent link

answered 05 Aug '15, 19:48

voonliew's gravatar image

voonliew
106333
accept rate: 25%

1

Do your customers/client need to do Visual Studio development? If they do you will need to add the extra steps to your own custom/customized installer. Much will depend on the previously installed VS and EF software/support.

If it helps any, the V17 documentation article .NET client deployment has more complete info. on the EF6 integration; than the V16 or V12 will.

(06 Aug '15, 13:10) Nick Elson S...

Thanks for the link to the newest docs. The v12 documentation still mentions .Net 4 and Windows Mobile deployment. sheesh :)

(06 Aug '15, 13:34) voonliew

For me "/v 6" didn't work, I had to use "/v EF6". I'm using SA 16.0.0.2158.

(21 Mar '16, 19:01) rlenders

I've also found that I can add the following to my app's config file to get EF6 to work:

<system.data>
  <dbproviderfactories>
    <clear/>
    <add name="SQL Anywhere 12 Data Provider" invariant="iAnywhere.Data.SQLAnywhere" description=".Net Framework Data Provider for SQL Anywhere 12" type="iAnywhere.Data.SQLAnywhere.SAFactory, iAnywhere.Data.SQLAnywhere.EF6, Version=12.0.1.42314, Culture=neutral, PublicKeyToken=f222fc4333e0d400"/>
  </dbproviderfactories>
</system.data>

I tried it out on another PC that had v12.0.1.31523 of the SQL Anywhere client installed, which is much older and not EF6 compatible and it worked.

Now I can just deploy my EF6 app with iAnywhere.Data.SQLAnywhere.EF6.dll and don't have to run SetupVSPackage /v 6 or even have to install the newest SQL Anywhere ADO.Net drivers.

permanent link

answered 06 Aug '15, 13:21

voonliew's gravatar image

voonliew
106333
accept rate: 25%

edited 06 Aug '15, 13:43

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:

×69
×63

question asked: 05 Aug '15, 19:35

question was seen: 4,744 times

last updated: 21 Mar '16, 19:01