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 DatatypeSQL ServerPostgreSQLSQLiteComments
int (32-bit)intintegerINTEGER
long (64-bit)bigintbigintINTEGER
shortsmallintsmallintINTEGER
bytetinyint

smallint

(Postgres lack tinyint)

INTEGER
boolbitbooleanINTEGER
decimaldecimal(18,2)

numeric(18,2)

Adjustable for domain

REAL
doublefloatdouble precisionREAL
floatrealrealREAL
DateTimedatetime2timestamp without time zoneTEXT
DateTimeOffsetdatetimeoffsettimestamp with time zoneTEXT
TimeSpantimeintervalTEXT
GuiduniqueidentifieruuidTEXT
stringnvarchar(max)textTEXT
byte[]varbinary(max)byteaBLOB
char[]nvarchar(max)Not supportedNot 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 supportedNot supported
IPAddress / PhysicalAddressNot supportedinet / macaddrNot supported
List<T> / array

Not supported

type[]

native array support

Not supported