CsvQueryOptions()
public CsvQueryOptions()Initializes a new instance of CsvQueryOptions.
Record in CsvHelper.Linq
How a CSV query reads its source, and how much of the work it pushes into the reader and to other providers.
public sealed record CsvQueryOptionsCsvHelper.LinqCsvHelper.Linq.dllpublic CsvQueryOptions()Initializes a new instance of CsvQueryOptions.
public static CsvQueryOptions Default { get; }The defaults: the record type's own options, column pruning, one thread.
public int ForeignKeyBatchSize { get; init; }How many keys a query sends to another provider at once when it joins with one of its queries, such as a table of Entity Framework Core: it asks for the rows whose keys the CSV has (Where(row => keys.Contains(row.Key))) in batches of this many keys, instead of reading the whole table. 2000 by default, which stays below the parameter limits of databases.
public int MaxDegreeOfParallelism { get; init; }The number of threads that read and filter records, with CsvReader.ParallelEnumerate<T>(Func<CsvReader, T>, int): 1 (the default) for the calling thread only, -1 for one per processor. The records come out in the order of the file either way. Only the filters (Where) that the reader runs itself and the mapping of the records run in parallel, so their lambdas must be safe to call from several threads.
public int MaxForeignKeys { get; init; }The most distinct keys that a join with another provider's query sends to it (100,000 by default); with more, the query reads the other provider's whole query instead, once. 0 never sends keys.
public Action<CsvQueryPlan>? OnExecute { get; init; }Called with the plan of each query before it runs: which members of the records it reads, which operators the reader runs, and what it asks other providers for. null (the default) for none.
public bool PruneColumns { get; init; }Whether a query reads only the members of the records that it uses (true, the default), so that the other columns are neither looked up nor parsed: their values are never checked, they may be missing from the header, and a record that fails only in them is not reported to CsvReaderOptions.OnRecordError. false reads every member of every record that the query reads, as CsvReader.GetRecords does.
public CsvReaderOptions? ReaderOptions { get; init; }The options of the reader, or null (the default) for those of the record type's CsvOptionsAttribute (CsvReaderOptions.For), which are the defaults when it has none.
public CsvWriterOptions? WriterOptions { get; init; }The options of the writer that adds, changes and removes records of a CsvTable<T>, or null (the default) for those of the record type's CsvOptionsAttribute (CsvWriterOptions.For), with the separator of the file.