dotConnect for Google BigQuery supports Entity Framework Core 3, 8, 9, 10, and 11.
The following table shows the type mappings used when you generate a model from an existing dataset by running Scaffold-DbContext in Package Manager Console or dotnet ef dbcontext scaffold in the .NET CLI.
BigQuery Data Type | Store Type in the Model | .NET |
|---|---|---|
| INT64 (INT, SMALLINT, INTEGER, BIGINT, TINYINT, BYTEINT) | INT64 | System.Int64 |
| FLOAT64 | FLOAT64 | System.Double |
| NUMERIC (DECIMAL) | NUMERIC, NUMERIC(p, s) | System.Decimal |
| BIGNUMERIC (BIGDECIMAL) | BIGNUMERIC, BIGNUMERIC(p, s) | System.Decimal |
| BOOL | BOOL | System.Boolean |
| STRING | STRING, STRING(n) | System.String |
| BYTES | BYTES, BYTES(n) | System.Byte[] |
| DATE | DATE | System.DateTime |
| TIME | TIME | System.TimeSpan |
| DATETIME | DATETIME | System.DateTime |
| TIMESTAMP | TIMESTAMP | System.DateTimeOffset |
| JSON | JSON | System.String |
| GEOGRAPHY | GEOGRAPHY | System.String |
| INTERVAL | INTERVAL | System.String |
| RANGE<DATE | DATETIME | TIMESTAMP> | RANGE<DATE>, RANGE<DATETIME>, RANGE<TIMESTAMP> | System.String |
The following table shows the type mappings used when you create a database from a model through Code First, migrations, or EnsureCreated, and when you use parameters and literals in queries.
.NET | BigQuery Data Type |
|---|---|
| System.Int64, System.Int32, System.Int16, System.Byte, System.SByte | INT64 |
| System.Double, System.Single | FLOAT64 |
| System.Decimal | NUMERIC; NUMERIC(p, s) if precision and scale are specified |
| System.Boolean | BOOL |
| System.String | STRING; STRING(n) if the maximum length is specified |
| System.Byte[] | BYTES |
| System.Guid | STRING (the value is stored as text) |
| System.DateTime | DATETIME |
| System.DateTimeOffset | TIMESTAMP |
| System.TimeSpan | TIME |
| System.DateOnly1 | DATE |
| System.TimeOnly1 | TIME |
1 Entity Framework Core 8 and later.