Пример #1
0
    /// <summary>
    ///
    /// </summary>
    /// <returns></returns>
    public new TextDataCommand CreateCommand()
    {
        var command = new TextDataCommand {
            Connection = this
        };

        return(command);
    }
    public static TextDataCommand GetSelectCommand(IList <TextDataColumn> columns, IList <ITextDataConverter> converters,
                                                   IConverter <TextDataCommand, TextReader> getTextReader)
    {
        var command    = new TextDataCommand();
        var parameters = command.Parameters;

        parameters.Add(new TextDataParameter("columns", columns));
        parameters.Add(new TextDataParameter("converters", converters));
        parameters.Add(new TextDataParameter("getTextReader", getTextReader));
        return(command);
    }
    public static TextDataCommand GetInsertCommand(IList <TextDataColumn> columns, IList <ITextDataConverter> converters, IEnumerable <object[]> rows,
                                                   IConverter <TextDataCommand, TextWriter> getTextWriter)
    {
        var command    = new TextDataCommand();
        var parameters = command.Parameters;

        parameters.Add(new TextDataParameter("columns", columns));
        parameters.Add(new TextDataParameter("converters", converters));
        parameters.Add(new TextDataParameter("rows", rows));
        parameters.Add(new TextDataParameter("getTextWriter", getTextWriter));
        return(command);
    }
Пример #4
0
    internal TextDataReader(TextDataCommand command, CommandBehavior behavior)
    {
        Assert.IsNotNull(command);

        _command  = command;
        _behavior = behavior;
        var parameters = command.Parameters;

        Assert.IsTrue(parameters != null);

        _columns = parameters.GetParameterValue <TextDataColumnCollection>("columns");
        var converters    = parameters.GetParameterValue <IList <ITextDataConverter> >("converters");
        var getTextReader = parameters.GetParameterValue <IConverter <TextDataCommand, TextReader> >("getTextReader");

        _textReader           = getTextReader.Convert(command);
        _textDataStreamReader = new TextDataStreamReader(_textReader, _columns, converters);
    }