Hi, I developed some applications already using Entity Framework 4.4 with the SQL Anywhere data provider for that EF version. Now that EF6 is supported by SQLA I'm evaluating how I can use it in new applications/ upgrade existing ones.
Since upgrading existing applications will take a while it would be nice if I could run EF4 and EF6 applications in parallel on the same machine. I think this should be possible without any problem, but I can't really find clear information how to deploy the corresponding SQLA data providers to the target system.
From another question (http://sqlanywhere-forum.sap.com/questions/22161/entity-framework-6-provider?page=1&focusedAnswerId=23023#23023) I understand, that I should run SetupVSPackage with the /v 6 option. This works fine, but it replaces the EF4.x version of the data provider, which stops my older applications from working.
I'm using SQLA 126.96.36.19931 at the moment.
Any clarification on this matter would be highly appreciated.
Edit (in response to Jeff's answer):
I'm using visual studio 2012. Also I'm not using any EFTools (at least I think so, because I never consciously installed it). EFTools is mainly for things like model designer and generating models from existing databases, isn't it?
I get the following error message (I removed some of the app-specific paths and names):
This is the error I get using a Code-First app. Starting an app that uses EDMX model the error is slightly different (if that's of any interest):
Unfortunately, the SQL Anywhere ADO.NET Provider is currently limited to only having one version registered as a DDEX Provider or DbProviderFactory underneath the invariant "iAnywhere.Data.SQLAnywhere". This means that you can't run parallel EF4/5 and EF6 installations with a single provider, and you also can't run multiple major versions of the SQL Anywhere ADO.NET provider for the same version of Entity Framework. Running
You can only register one SQL Anywhere ADO.NET provider for a major version, with either the EntityFramework 6 support enabled or not. If you need to change your configuration, you would need to re-run the
We explored changing this behaviour in CR #767720 to allow multiple major version configurations, but unfortunately there isn't an easy solution to allow this type of configuration with the released versions of the providers.
Can you perhaps post what the specific problem you're seeing is once you install the EF6 provider? We may be able to suggest a workaround, depending upon the error.
Which version of EFTools / Visual Studio are you using?
answered 14 Jul '15, 13:25
Actually, you might be able to get EF6 to co-exist with older versions on the same PC. I've managed to run an EF6 app on a PC that had an older version of the SQL Anywhere client installed (The highest version file was iAnywhere.Data.SQLAnywhere.v4.0.dll, which I believe is for EF4). The key is the SQL Anywhere <DbProviderFactories> registration in the machine.config, which is one the things that is configured when you run SetupVSPackage.
Assuming the machine.config has the SA EF4 provider registered, copy the EF6 provider config setting into the app.config. This overrides the SA EF provider in the machine.config with the provider declared in your app.config:
<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=188.8.131.52314, Culture=neutral, PublicKeyToken=f222fc4333e0d400"/> </dbproviderfactories> </system.data>
Take care that the version number matches the version number of your iAnywhere.Data.SQLAnywhere DLL
I can now deploy my app (with iAnywhere.Data.SQLAnywhere.EF6.dll in the same folder) and it works.