public string Convert(string commandText, IDataParameterCollection parameters)
        {
            var sqlParams = parameters.Cast<DataParameterMock>()
                .OrderByDescending(x => x.ParameterName.Length);

            var sql = commandText;
            foreach (var p in sqlParams)
                sql = Convert(sql, p);

            return sql;
        }
Exemple #2
0
        private void LogQuery(string queryText, IDataParameterCollection parameters)
        {
            // Console.WriteLine($"Executed Query: {queryText}");
            // Console.WriteLine($"Query Parameters:");
            List <IDbDataParameter> parameterList = parameters.Cast <IDbDataParameter>().ToList();

            foreach (IDbDataParameter parameter in parameterList)
            {
                // Console.WriteLine($"{parameter.ParameterName} : {parameter.Value.ToString()}");
            }
        }
        public string Convert(string commandText, IDataParameterCollection parameters)
        {
            var sqlParams = parameters.Cast <DataParameter>()
                            .OrderByDescending(x => x.ParameterName.Length);

            var sql = new StringBuilder(commandText);

            foreach (var p in sqlParams)
            {
                Convert(sql, p);
            }

            return(sql.ToString());
        }
Exemple #4
0
        public string Convert(string commandText, IDataParameterCollection parameters)
        {
            var sqlParams = parameters.Cast <DataParameterMock>()
                            .OrderByDescending(x => x.ParameterName.Length);

            var sql = commandText;

            foreach (var p in sqlParams)
            {
                sql = Convert(sql, p);
            }

            return(sql);
        }
Exemple #5
0
 private IDictionary <string, object> ConvertToDictionary(IDataParameterCollection parameters)
 {
     return(parameters.Cast <IDbDataParameter>().ToDictionary(parameter => parameter.ParameterName, parameter => parameter.Value));
 }