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; }
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()); }
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); }
private IDictionary <string, object> ConvertToDictionary(IDataParameterCollection parameters) { return(parameters.Cast <IDbDataParameter>().ToDictionary(parameter => parameter.ParameterName, parameter => parameter.Value)); }