Page 1 of 1
Connection String / Database Provider for EF 6 Code-First
Posted: Wed 01 Oct 2014 14:26
by Richard Parker
Hi,
I'm using Entity Framework 6 with Code-First approach in an MVC5 application. I already have a model and a DbContext that works with SQL Server. I'm trying to change my connection string to connect to an Oracle DB using dotConnect for Oracle. Where can I find the information I need to create a connection string and register the Database Provider?
Thanks,
Richard
Re: Connection String / Database Provider for EF 6 Code-First
Posted: Wed 01 Oct 2014 14:59
by Shalex
Re: Connection String / Database Provider for EF 6 Code-First
Posted: Wed 01 Oct 2014 15:25
by Richard Parker
Hi Shalex,
I already followed the advise in the first article. I registered the provider in the Web.config like this:
Code: Select all
<entityFramework>
<providers>
<provider invariantName="Devart.Data.Oracle" type="Devart.Data.Oracle.Entity.OracleEntityProviderServices, Devart.Data.Oracle.Entity, Version=8.4.244.0, Culture=neutral, PublicKeyToken=09af7300eec23701" />
</providers>
</entityFramework>
The error I get says: 'Devart.Data.Oracle.Entity.OracleEntityProviderServices, Devart.Data.Oracle.Entity, Version=8.4.244.0, Culture=neutral, PublicKeyToken=09af7300eec23701' does not return an object that inherits from 'System.Data.Entity.Core.Common.DbProviderServices'. Perhaps it does not support Entity Framework 6 or higher. More information is available at
http://go.microsoft.com/fwlink/?LinkId=260882
(It's not the original error, but a translation from the German error message I got)
Another issue that is not covered in the articles is how does the connection string look like?
Richard
Edit: I forgot to mention that the EF6 package is already installed because it's a default MVC 5 web application.
Re: Connection String / Database Provider for EF 6 Code-First
Posted: Wed 01 Oct 2014 15:58
by Richard Parker
I guess I figured it out. You need to use the revision number 6 instead of 0 in the <providers> section but you need to use 0 in the <DbProviderFactories> section. So for me it's 8.4.244.0 and 8.4.244.6
Richard
Re: Connection String / Database Provider for EF 6 Code-First
Posted: Wed 01 Oct 2014 16:12
by Shalex
Richard Parker wrote:You need to use the revision number 6 instead of 0 in the <providers> section but you need to use 0 in the <DbProviderFactories> section. So for me it's 8.4.244.0 and 8.4.244.6
That is correct.