コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CsvStringMaterializer{TCommand, TParameter}" /> class.
        /// </summary>
        /// <param name="commandBuilder">The associated operation.</param>
        /// <param name="csvSerializer">The CSV serializer.</param>
        /// <param name="includeHeaders">if set to <c>true</c> [include headers].</param>
        /// <param name="desiredColumns">The desired columns.</param>
        /// <exception cref="System.ArgumentNullException">
        /// </exception>
        public CsvStringMaterializer(DbCommandBuilder <TCommand, TParameter> commandBuilder, CsvSerializer csvSerializer, bool includeHeaders, IReadOnlyList <string> desiredColumns)
            : base(commandBuilder)
        {
            if (commandBuilder == null)
            {
                throw new ArgumentNullException(nameof(commandBuilder), $"{nameof(commandBuilder)} is null.");
            }
            if (csvSerializer == null)
            {
                throw new ArgumentNullException(nameof(csvSerializer), $"{nameof(csvSerializer)} is null.");
            }

            m_CsvSerializer  = csvSerializer;
            m_IncludeHeaders = includeHeaders;
            m_DesiredColumns = desiredColumns ?? AllColumns;
        }