Net Framework version of the component reads connection strings from
new OracleDatabase ()
new OracleDatabase (string connectionString)
new OracleDatabase (byte connectionTryCount)
new OracleDatabase (string connectionString, byte connectionTryCount)
When
While trying to rapidly create lots of database components (e.g. load testing a REST) using XE versions of Oracle database, then opening the connection might
fail with
using (OracleDatabase database = new OracleDatabase ())
OracleCommand command = new OracleCommand ("select * from DUAL" );
OracleCommand command = database.NewSPCommand ("MY_PROCEDURE" );
command .Parameters.Add ("I_INTEGER" , 1);
command .Parameters.Add ("O_INTEGER" , null , ParameterDirection .Output);
command .Parameters.Add ("O_CURSOR" , OracleDbType .RefCursor, ParameterDirection .Output);
DataSet data = database .QuerySet (command );
DataTable data = database .QueryTable (command );
DataRow data = database .QueryRow (command );
int rowCount = database .NonQuery ("update MY_TABLE set A = 1" );
There are two short-hand methods:
If
If
If there is an error, returned data object will be
If there isn't an error, then
If
using (OracleDatabase database = new OracleDatabase ())
database .StartTransaction ();
database .Commit ();
database .Rollback ();
Active transaction is automatically added into queries. Only one active transaction is supported.
OracleDatabase .BulkSet (OracleCommand command, DataTable data, string [] columns = null )
OracleDatabase .BulkSet (OracleCommand command, List <T > data, string [] columns = null )
Inserts provided data from a DataTable or a list of classes into the command's parameters for bulk insert. Columns array can be used to limit which data is inserted.
From the list of classes readable public fields and properties are converted into column names using reversed CamelCase, where an underscore is added before every uppercase letter,
and finally the whole name is converted to uppercase: e.g. ColumnName → COLUMN_NAME. Parameter names will be added with
OracleDatabase .BulkFill (OracleCommand command, string parameterName, object parameterValue)
OracleDatabase .BulkFill (OracleCommand command, string parameterName, OracleDbType parameterType, object parameterValue)
OracleDatabase .BulkFill (OracleCommand command, string parameterName, OracleDbType parameterType, int parameterSize, object parameterValue)
Duplicates a single parameter value for bulk insert to match row count of a
NOTE:
T = OracleDatabase .ToClass <T >(DataRow dataRow)
Converts a DataRow into a class, where column names are mapped into class property names applying CamelCase to column names (e.g. COLUMN_NAME → ColumnName).
List<T > = OracleDatabase .ToList <T >(DataTable dataTable)
Converts a DataTable into a list of classes, where column names are mapped into class property names applying CamelCase to column names (e.g. COLUMN_NAME → ColumnName).
List <T > = OracleDatabase .ToList <T >(DataTable dataTable, int index)
List <T > = OracleDatabase .ToList <T >(DataTable dataTable, string column)
List <KeyValuePair <K , V >> = OracleDatabase .ToList <K , V >(DataTable dataTable, int keyIndex, int valueIndex)
List <KeyValuePair <K , V >> = OracleDatabase .ToList <K , V >(DataTable dataTable, string keyColumn, string valueColumn)
Converts a DataTable into a list specified data type.
Dictionary <K , V > = OracleDatabase .ToDictionary <K , V >(DataTable dataTable, int keyIndex)
Dictionary <K , V > = OracleDatabase .ToDictionary <K , V >(DataTable dataTable, string keyColumn)
Dictionary <K , V > = OracleDatabase .ToDictionary <K , V >(DataTable dataTable, int keyIndex, int valueIndex)
Dictionary <K , V > = OracleDatabase .ToDictionary <K , V >(DataTable dataTable, string keyColumn, string valueColumn)
Converts a DataTable into a dictionary where keys come from a single column and values are either a value from another column or rows converted into the specified class.