title: Connect to Oracle database in dotnet mvc application
body: <p>Oracle released a beta version <a href="http://www.oracle.com/technetwork/topics/dotnet/downloads/odpnetcorebeta-4077982.html" rel="noreferrer">driver ODP for dotnet core 2</a>(Finally!). But I can't make it work. Does anybody did it? If yes, please send me the code or help me fixing this one \o</p>
  
  <p><strong>Useful</strong>: I am using Visual Code, project "dotnet new mvc" (.net 2) and I installed <code>Oracle.ManagedDataAccess.Client</code> via Nuget Add Package facility (CTRL + P, ...)
  Here my code:</p>
  
  <pre><code>public static OracleConnection AbrirSigmaUser(AutenticacaoModel autenticacao)
          {
              try
              {
  
                  string _connectionString;
  
                  _connectionString = "Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.0.15)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=databaseName)));User Id=UserName;Password=***;";
  
  
                  OracleConnection conexao = new OracleConnection();
                  conexao.ConnectionString = _connectionString;
  
                  //right here the program exit
                  conexao.Open();             
  
  
  
  
                  return conexao;
              }
              catch (System.Exception ex)
              {               
  
                  throw new Exception("Não foi possível conectar ao banco de dados!" + "\nErro: " + ex.Message);
              }
          }
  </code></pre>
  
  <p>The compiler was throwing a lot of exceptions about missing dlls, so I installed them via Nuget Add Package facility:</p>
  
  <pre><code>//required for connection
  using Oracle.ManagedDataAccess.Client;
  using System.Configuration;
  using System.Security.Permissions;
  using System.Security.Principal;
  </code></pre>
  
  <p>After adding all dlls asked, the program goes to conexao.Open() and never comes back, throwing an unhandled exception:</p>
  
  <pre><code>Unhandled Exception: System.TypeLoadException: Could not load type 'System.Security.Principal.WindowsImpersonationContext' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
     at OracleInternal.ConnectionPool.PoolManager`3.CreateNewPRThreadFunc(Object state)
     at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
     at System.Threading.ThreadPoolWorkQueue.Dispatch()
  The program '[8860] Sensatta-Analytcs.dll' has exited with code 0 (0x0).
  </code></pre>
  
  <p>Is all of it really needed to make a simple connection?</p>
  
  <p>If there's something missing(e.g code samples) in order to figure out my issue, just tell me!</p>