Skip to main content

MySQL Data Types Mapping

XPO creates these column types when updating the MySQL database schema and expects them in existing databases.

.NET Type Database Column Type
Boolean bit
Byte tinyint unsigned
SByte tinyint
Char char
Decimal decimal(28,8)
Double double
Single real
Int16 smallint
UInt16 smallint unsigned
Int32 int
UInt32 int unsigned
Int64 bigint
UInt64 bigint unsigned
Guid char(38)
String varchar(N), TEXT, MEDIUMTEXT
DateTime in MySQL prior to 8.0, datetime; otherwise datetime(6)
TimeSpan double
Byte[] TINYBLOB, BLOB, MEDIUMBLOB, LONGBLOB
Unlimited size string LONGTEXT

Mapping Properties To Database Column Types Not Supported By Default

If a column type is not listed in the above table but can be converted to any of the listed type by the database, it can be read and modified by XPO. To create a column of a specific type in the database when updating the schema, decorate the property with DbTypeAttribute. If a column type cannot be converted to a supported type, it is possible to support such columns by creating a custom connection provider.

See Also