I'm migrating code that uses ADO.NET/ODP.NET to Enterprise Library 6.0. I'm using the EntLibContrib project that adds support for ODP.NET. There are some optimizations made in the ADO.NET code and I'm trying to determine how to call those properties with EL.
The ADO.NET looks like this:
using (OracleConnection conn = new OracleConnection(_connectionString))
{
using (OracleCommand cmd = new OracleCommand(command, conn))
{
cmd.CommandType = CommandType.Text;
cmd.InitialLOBFetchSize = -1;
cmd.Connection.Open();
OracleDataReader reader = cmd.ExecuteReader();
reader.FetchSize = reader.RowSize * 1000;
reader.Read();
[...]
}
}
EL code looks like:
var database = new DatabaseProviderFactory().CreateDefault();
using (var reader = database.ExecuteReader(CommandType.Text, command))
{
[...]
}
I'm also updating Stored Procedures as well here are the examples.
ADO.NET:
using (OracleConnection conn = new OracleConnection(_connectionString))
{
using (OracleCommand cmd = new OracleCommand(command, conn))
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("pID", OracleDbType.Int32).Value = eID;
OracleParameter pResults = cmd.Parameters.Add("pResults", OracleDbType.RefCursor, ParameterDirection.Output);
cmd.Connection.Open();
cmd.ExecuteNonQuery();
using (OracleRefCursor cursor = pResults.Value as OracleRefCursor)
{
using (OracleDataReader reader = cursor.GetDataReader())
{
reader.FetchSize = reader.RowSize * 1000;
while (reader.Read())
{
[...]
}
To EL:
var database = new DatabaseProviderFactory().CreateDefault();
using (var reader = database.ExecuteReader("SS.SP_GET_TASKDATA_BY_PRAC", practiceID, firstRow, lastRow))
{
while (reader.Read())
{
[...]
}
How do I set the FetchSize and InitialLOBFetchSize properties with my EL code?