Esempio n. 1
0
        public IEnumerable <Tout> ExecuteQueryProcedure <Tout>(
            MySqlProcedure procedure,
            object parameters,
            CancellationToken cancellationToken)
        {
            var connectionString = this.ConnectionString(this.configuration);

            using (var dbConnection = new MySqlConnection(connectionString))
            {
                dbConnection.Open();
                using (var dbCommand = new MySqlCommand())
                {
                    dbCommand.CommandText = procedure.Name;
                    dbCommand.CommandType = System.Data.CommandType.StoredProcedure;
                    dbCommand.Connection  = dbConnection;
                    if (parameters != null)
                    {
                        MapObjectToParameters(procedure.Name, parameters, dbCommand.Parameters);
                    }

                    using (var dataReader = dbCommand.ExecuteReader())
                    {
                        var result = dataReader.CastAll <Tout>(cancellationToken);

                        return(result);
                    }
                }
            }
        }
Esempio n. 2
0
 public void ExecuteQueryProcedure(
     MySqlProcedure procedure,
     object parameters,
     CancellationToken cancellationToken)
 {
     this.ExecuteQueryProcedure <object>(procedure, parameters, cancellationToken);
 }
Esempio n. 3
0
 public IEnumerable <Tout> ExecuteQueryProcedure <Tout>(
     MySqlProcedure procedure,
     CancellationToken cancellationToken)
 {
     return(this.ExecuteQueryProcedure <Tout>(procedure, null, cancellationToken));
 }