static void Main(string[] args) { // This sample app shows how to connect with OracleCredential using the HR schema // Connection string without password // Add data source info to connect to string conString = "Data Source=<data source>;"; // Provide the password and make read-only // This sample assumes the password is 'hr' SecureString secPwd = new SecureString(); secPwd.AppendChar('h'); secPwd.AppendChar('r'); secPwd.MakeReadOnly(); // Create OracleCredential OracleCredential oc = new OracleCredential("hr", secPwd); using (OracleConnection con = new OracleConnection(conString, oc)) { con.Open(); Console.WriteLine("Successfully connected to database"); Console.ReadLine(); } }
public OracleSessionFactory(DbContextOptions contextOptions, string connectionString, OracleCredential credential) { if (contextOptions == null) { throw new ArgumentNullException(nameof(contextOptions)); } if (string.IsNullOrWhiteSpace(connectionString)) { throw new ArgumentNullException(nameof(connectionString)); } this.contextOptions = contextOptions; this.connectionString = connectionString; this.credential = credential; }
public OracleManagedDataAccessHelper(string connectionString, OracleCredential orclCredential) { _connection = new OracleConnection(connectionString, orclCredential); }
public static DbContextOptions UseOracle(this DbContextOptions options, string connectionString, OracleCredential credential) { if (string.IsNullOrWhiteSpace(connectionString)) { throw new ArgumentNullException(nameof(connectionString)); } options.SessionFactory = new OracleDbSessionFactory(options, connectionString, credential); return(options); }
public static DbContextOptionsBuilder UseOracle(this DbContextOptionsBuilder builder, string connectionString, OracleCredential connectionCredential) { if (string.IsNullOrWhiteSpace(connectionString)) { throw new ArgumentNullException(nameof(connectionString)); } builder.Options.Dialect = OracleDialect.Instance; builder.Options.SessionFactory = new OracleSessionFactory(builder.Options, connectionString, connectionCredential); return(builder); }