I have an application with .NET 4.0 and EF6 this is working ok with SQL Server, and now, I need use an Oracle BD In the same way. I have a model in this proyect with 5 tables and when I connect this proyect with this DB migrations add this news tables in it.
Now, I put all reference to Oracle.
Oracle.DataAccess.dll
Oracle.DataAccess.EntityFramework
Oracle.ManagedDataAccess.EntityFramework
And Put this in web.config
<section name="Oracle.ManagedDataAccess.Client" type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess, Version=4.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342"/>
I was using this conn string
<add name="ChatContext" connectionString="Data Source=serversql; Initial Catalog=database;uid=user;password=pass;" providerName="System.Data.SqlClient"/>
Now I'm trying with
<add name="ChatContext" connectionString="Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oracleserver)(PORT=1521))(CONNECT_DATA=SERVICE_NAME=oracledb)));User Id=user;Password=pass;" providerName = "Oracle.ManagedDataAccess.Client"/>
I had a "ChatContext" DB in my documents and delete it to Migrations generate a new Context file.
When i try to ejecute my code in have this error:
An error occurred accessing the database. This usually means that the connection to the database failed. Check that the connection string is correct and that the appropriate DbContext constructor is being used to specify it or find it in the application's config file.
I Generate a new MVC proyect to check if the conn string was ok, and could connect to db, and it is.
<add name="Entities" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=Oracle.ManagedDataAccess.Client;provider connection string="data source=oracledb;password=pass;persist security info=True;user id=user"" providerName="System.Data.EntityClient" /></connectionStrings>