Example #1
0
        public static List <T> SpToList <T>(string app, string storedProcedure, MySqlParameter[] parameters)
        {
            using MySqlConnection connection = new() { ConnectionString = BConnectionString.GetString(app, Dev) };
            connection.Open();
            using MySqlCommand command = new(storedProcedure, connection) { CommandType = CommandType.StoredProcedure };
            foreach (MySqlParameter parameter in parameters)
            {
                command.Parameters.Add(parameter).Value = parameter.Value;
            }
            return(BConvert.ReaderToList <T>(command.ExecuteReader()));
        }

        public List <T> SpToList <T>(string storedProcedure, MySqlParameter[] parameters, string setting = "app")
        {
            using MySqlConnection connection = new() { ConnectionString = conn.GetString(setting) };
            connection.Open();
            using MySqlCommand command = new(storedProcedure, connection)
                  {
                      CommandType = CommandType.StoredProcedure
                  };
            foreach (MySqlParameter parameter in parameters)
            {
                command.Parameters.Add(parameter).Value = parameter.Value;
            }
            return(BConvert.ReaderToList <T>(command.ExecuteReader()));
        }

        public static string SpToStringScalar(string app, string storedProcedure, MySqlParameter parameter)
Example #2
0
        public static List <T> SpToList <T>(string app, string storedProcedure, SqlParameter parameter)
        {
            using SqlConnection connection = new() { ConnectionString = BConnectionString.GetString(app, Dev) };
            connection.Open();
            using SqlCommand command = new(storedProcedure, connection) { CommandType = System.Data.CommandType.StoredProcedure };
            command.Parameters.Add(parameter).Value = parameter.Value;
            return(BConvert.ReaderToList <T>(command.ExecuteReader()));
        }

        public List <T> SpToList <T>(string storedProcedure, SqlParameter parameter, string setting = "app")
        {
            using SqlConnection connection = new() { ConnectionString = conn.GetString(setting) };
            connection.Open();
            using SqlCommand command = new(storedProcedure, connection) { CommandType = System.Data.CommandType.StoredProcedure };
            command.Parameters.Add(parameter).Value = parameter.Value;
            return(BConvert.ReaderToList <T>(command.ExecuteReader()));
        }

        public static List <T> SpToList <T>(string app, string storedProcedure, SqlParameter[] parameters)