Skip to main content

EF - Backend vs .NET Datatypes

Here's a list of what datatypes that Entity Framework uses to store .NET datatypes in a couple different database engines.

.NET Datatype SQL Server PostgreSQL SQLite Comments
int (32-bit) int integer INTEGER
long (64-bit) bigint bigint INTEGER
short smallint smallint INTEGER
byte tinyint

smallint

(Postgres lack tinyint)

INTEGER
bool bit boolean INTEGER
decimal decimal(18,2)

numeric(18,2)

Adjustable for domain

REAL
double float double precision REAL
float real real REAL
DateTime datetime2 timestamp without time zone TEXT
DateTimeOffset datetimeoffset timestamp with time zone TEXT
TimeSpan time interval TEXT
Guid uniqueidentifier uuid TEXT
string nvarchar(max) text TEXT
byte[] varbinary(max) bytea BLOB
char[] nvarchar(max) Not supported Not supported

JsonDocument /

Dictionary<string, object>

nvarchar(max)

SQL Server has no native JSON type; EF stores as text.

jsonb

Native JSON support

TEXT
object

sql_variant

Only if configured manually

Not supported Not supported
IPAddress / PhysicalAddress Not supported inet / macaddr Not supported
List<T> / array

Not supported

type[]

native array support

Not supported