Skip to content

Instantly share code, notes, and snippets.

@imeanitworks
Created November 17, 2016 00:23
Show Gist options
  • Select an option

  • Save imeanitworks/59c134ff3bbd1e4c488463a7d730a6fb to your computer and use it in GitHub Desktop.

Select an option

Save imeanitworks/59c134ff3bbd1e4c488463a7d730a6fb to your computer and use it in GitHub Desktop.
Enterprise library class extension to use the oracle managed drivers
using Microsoft.Practices.EnterpriseLibrary.Data;
using Oracle.ManagedDataAccess.Client;
using System.Data;
namespace Helpers
{
public static class ManagedClassExtensions
{
public static OracleDataReader ExecuteReader(this Database database, OracleCommand cmd)
{
return cmd.ExecuteReader();
}
public static OracleCommand GetSqlStringCommandManaged(this Database database, string sqlCommand)
{
OracleCommand cmd = new OracleCommand(sqlCommand);
cmd.BindByName = true;
return cmd;
}
public static OracleCommand GetStoredProcCommandManaged(this Database database, string storedProcName)
{
OracleCommand cmd = new OracleCommand(storedProcName);
cmd.CommandType = CommandType.StoredProcedure;
cmd.BindByName = true;
return cmd;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment