/// <summary> /// Execute a set of expando object /// </summary> /// <param name="conn"></param> /// <param name="cmdText"></param> /// <param name="parameters"></param> /// <param name="commandType"></param> /// <param name="transaction"></param> /// <returns></returns> public static IEnumerable <dynamic> ExecuteExpandoObjects(this OracleConnection conn, string cmdText, OracleParameter[] parameters, CommandType commandType, OracleTransaction transaction) { using var cmd = DbConnectionExtensions.CreateCommand(conn, cmdText, commandType, transaction, parameters); using IDataReader reader = cmd.ExecuteReader(); return(reader.ToExpandoObjects()); }
/// <summary> /// Execute expando object /// </summary> /// <param name="conn"></param> /// <param name="commandFactory"></param> /// <returns></returns> public static dynamic ExecuteExpandoObject(this OracleConnection conn, Action <OracleCommand> commandFactory) { using var command = DbConnectionExtensions.CreateCommand(conn, (Action <DbCommand>)commandFactory); using IDataReader reader = ((DbCommand)command).ExecuteReader(); reader.Read(); return(reader.ToExpandoObject()); }
/// <summary> /// Execute a set of entity /// </summary> /// <param name="conn"></param> /// <param name="cmdText"></param> /// <param name="parameters"></param> /// <param name="commandType"></param> /// <param name="transaction"></param> /// <typeparam name="T"></typeparam> /// <returns></returns> public static async Task <IEnumerable <T> > ExecuteEntitiesAsync <T>(this OracleConnection conn, string cmdText, OracleParameter[] parameters, CommandType commandType, OracleTransaction transaction) where T : new() { using var command = DbConnectionExtensions.CreateCommand(conn, cmdText, commandType, transaction, parameters); using IDataReader reader = await command.ExecuteReaderAsync(); return(reader.ToEntities <T>()); }
/// <summary> /// Execute entity /// </summary> /// <param name="conn"></param> /// <param name="cmdText"></param> /// <param name="parameters"></param> /// <param name="commandType"></param> /// <param name="transaction"></param> /// <typeparam name="T"></typeparam> /// <returns></returns> public static T ExecuteEntity <T>(this OracleConnection conn, string cmdText, OracleParameter[] parameters, CommandType commandType, OracleTransaction transaction) where T : new() { using var command = DbConnectionExtensions.CreateCommand(conn, cmdText, commandType, transaction, parameters); using IDataReader reader = command.ExecuteReader(); reader.Read(); return(reader.ToEntity <T>()); }
/// <summary> /// Execute expando object /// </summary> /// <param name="conn"></param> /// <param name="cmdText"></param> /// <param name="parameters"></param> /// <param name="commandType"></param> /// <param name="transaction"></param> /// <returns></returns> public static async Task <dynamic> ExecuteExpandoObjectAsync(this OracleConnection conn, string cmdText, OracleParameter[] parameters, CommandType commandType, OracleTransaction transaction) { using var command = DbConnectionExtensions.CreateCommand(conn, cmdText, commandType, transaction, parameters); using IDataReader reader = await command.ExecuteReaderAsync(); reader.Read(); return(reader.ToExpandoObject()); }