0

I succeeded in code first approach for SQL in mvc4 application. But when I want to apply code first approach for Oracle then i am getting below message:

No Entity Framework provider found for the ADO.NET provider with invariant name
'Oracle.DataAccess.Client'. Make sure the provider is registered in the
'entityFramework' section of the application config file

Right now I am using Entity framework 6. Please let me know what is the simple step to create database using code first approach for ORACLE. Which "ddl" is required? What is web config setting?

Emmanuel
  • 13,935
  • 12
  • 50
  • 72
user3310138
  • 137
  • 5
  • 20

2 Answers2

0

You need to specify a provider for your Oracle DB, and there is no native provider,you need a third party one.

Here you have an "official" list of all the entity framework providers for different databases. Note that there is one from Oracle, that can also be installed as a Nuget package.

NOTE from Oracle docs:

Entity Framework 6 is not supported at this time. Some Visual Studio versions may default to Entity Framework 6. If so, set your .NET project to use an earlier version of Entity Framework.

DevArt dot connect supports all versions of EF.

So, to use the ODP you need to downgrade to EF5, or purchase dotConnect.

The details for configuring your web.config, or app.config can be found here: Deploying and Configuring ODP.NET to work without installation with Entity Framework

Community
  • 1
  • 1
JotaBe
  • 38,030
  • 8
  • 98
  • 117
  • Thanks for reply,i have installed "oracle DataProvider for .net(ODP.Net)" from nugent.but still i am getting same above issue.please suggest me we need to add provider for oracle inside ?what is config file will be? – user3310138 Jun 04 '14 at 10:23
  • thanks a lot.i have seen the step but it is very confusing.please suggest if we go with Oracle.ManagedDataAccess.Client then what is the proper step need to follow – user3310138 Jun 04 '14 at 11:39
  • use EF5, instead of EF6, and do the configuration as explained – JotaBe Jun 04 '14 at 11:52
  • i have followed but still its not working.and also i am using EF5.pls help – user3310138 Jun 04 '14 at 12:28
  • hi joteBe,could you pleas help .now i am getting below error message No MigrationSqlGenerator found for provider 'Oracle.ManagedDataAccess.Client'. Use the SetSqlGenerator method in the target migrations configuration class to register additional SQL generators. – user3310138 Jun 05 '14 at 11:16
  • Perhaps migrations are not supported with ODP. If you want all the EF functionality, including migrations, use devArt dotConnect: http://www.devart.com/dotconnect/entityframework.html. You0ll have to pay for it. – JotaBe Jun 05 '14 at 13:33
  • Did you try using ODP? It's not so expensive, and it can solve all your problems. – JotaBe Jun 14 '14 at 00:39
0

Starting with Oracle Data Access Components (ODAC) 12c Release 3 (12.1.0.2.1), ODP.NET supports Code First and Code First Migrations from Entity Framework 6. ODP.NET provides the data access to store the EF model inside the Oracle Database and evolve it.

http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/dotnet/CodeFirst/index.html#section1

  • 1
    Welcome to Stack Overflow! While this may answer the question, [it would be preferable](http://meta.stackoverflow.com/q/8259) to include the essential parts of the answer here, and provide the link for reference. – IKavanagh Oct 29 '15 at 09:13