public sealed record CsvQueryOptions
Namespace
CsvHelper.Linq
Assembly
CsvHelper.Linq.dll
Inheritance
object CsvQueryOptions
Builds
net10.0 netstandard2.1 netstandard2.0 net47

Constructors

Properties

ForeignKeyBatchSize

Added in v34.0.0
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.

Property value

int

Exceptions

ArgumentOutOfRangeException
The value is not positive.

View source

MaxDegreeOfParallelism

Added in v34.0.0
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.

Property value

int

Exceptions

ArgumentOutOfRangeException
The value is 0 or less than -1.

View source

MaxForeignKeys

Added in v34.0.0
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.

Property value

int

Exceptions

ArgumentOutOfRangeException
The value is negative.

View source

OnExecute

Added in v34.0.0
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.

Property value

View source

PruneColumns

Added in v34.0.0
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.

Property value

bool

View source