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 126.96.36.199314 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):
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 v188.8.131.52314 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 v184.108.40.206314 of various iAnywhere.VSIntegration & iAnywhere.VSPackage assemblies. The test PC has the VS assemblies but they are v220.127.116.11522 and 18.104.22.16842 (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.
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.
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?
answered 05 Aug '15, 19:48
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=22.214.171.124314, Culture=neutral, PublicKeyToken=f222fc4333e0d400"/> </dbproviderfactories> </system.data>
I tried it out on another PC that had v126.96.36.199523 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.