Enum DuckDbTypeMappingFlags
Selects conventions for mapping certain types from DuckDB to .NET.
Namespace: Mallard
Assembly: Mallard.dll
Syntax
[Flags]
public enum DuckDbTypeMappingFlags
Remarks
In Mallard's API, generally speaking, type mapping is driven by a explicitly-given generic type parameter like in DuckDbVectorReader<T>. However, ambiguities can arise in some situations:
- When the type parameter is object (which indicates the actual type should be casted/boxed)
- When consuming the type via an object/interface implementing a non-Mallard API which assumes the type is known upfront without any explicit input (such as ADO.NET's GetFieldType(int)).
In these cases, Mallard must assume a "default" .NET type to map a DuckDB type to. These rules may depend on the context or application. For instance, under DuckDbDataReader, columns of type DATE in DuckDB are mapped to DateTime — for compatibility with existing ADO.NET-using code, and other databases — even though DateOnly would be the better, modern choice.
This enumeration allows choosing conventions for various types when there is more than one reasonable choice.
Note that the conventions specified here do not apply when there is already an explicit specification of the target type (like in the aforementioned DuckDbVectorReader<T>).
Fields
Name | Description |
---|---|
DatesAsDateTime | Map a DATE type coming from the database as DateTime, for ADO.NET compatibility. |
Default | Take the default conventions, which has none of the other flags in this enumeration set. |