简体   繁体   中英

From SQL Server to Oracle using Entity Framework with code-first Migrations

I'm was told recently that in our current project we have to use Oracle instead of SQL Server.

I need some help to make it work. I've already installed Visual Studio ODTwithODAC but when I try to run the command update-database in the Package Manager Console, the following error is thrown:

A null was returned after calling the 'get_ProviderFactory' method on a store provider instance of type 'System.Data.OracleClient.OracleConnection'. The store provider might not be functioning correctly.

I know that the problem is not the access to DB because I could connect to it via Server Explorer and I took the connection string from it.

My connection string goes like this:

<add name="LpssContext" 
     connectionString="SERVER=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.0.1.106)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=ORCL)));uid=sys;pwd=sys;" 
     providerName="System.Data.OracleClient" />

Any ideas about what's wrong?

Does Oracle support code-first migrations?

Currently there's no support for CFM with Oracle connector. There's a paid connector that support it though, http://blog.devart.com/entity-framework-code-first-migrations-support-for-oracle-mysql-postgresql-and-sqlite.html

The other option is to change your db layer to DB First (with lots of work) manually, as I finally did

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM