I am using Oracle.ManagedDataAccess Nuget Package Version 12.1.022 in my C# (.NET 4.0) project. The package automatically creates entries in the app.config file. How can I r
You can make a separate class file returning the connectionstring like this -
public class OracleDbConnection
{
public static OracleConnection GetConnection()
{
const string connectionString = "Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521)) (CONNECT_DATA=(SERVICE_NAME=PROD))); User Id=userId;Password=password;";
var connection=new OracleConnection(connectionString);
return connection;
}
}
Then you can call it like this where you need to access oracle db-
var oracleConnection = OracleDbConnection.GetConnection();
oracleConnection.Open();