Only Entity framework 5 is able to connect to Oracle, I'm using Oracle 12c so must use the ODAC 12.10.1.2 for coding.
When running in local, it's working fine.
However when deploying to the server, I encountered this error:
ORA-12504: TNS:listener was not given the SERVICE_NAME in CONNECT_DATA
Reinstalling ODAC doesn't work.
All TNS was updated in tnsnames.ora.
However it seems EF can't locate the TNS in tnsnames.ora.
Changing the connection string to be same like the one in tnsnames.ora doesn't work.
So my entity framework connection string is now like below:
metadata=res://*/Entities.csdl|res://*/Entities.ssdl|res://*/Entities.msl;provider=Oracle.ManagedDataAccess.Client;provider connection string='Data Source=(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = MYDBSERVER)(PORT = 1111))(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = MYDB)));USER ID=XXX;PASSWORD=YYY;'
Reference : http://nullablecode.com/2013/10/ef-oracle-db-connection-problem-ora-12504/