dotConnect for MySQLsupport@devart.com

Entity Framework Data Type Mapping

MySQL to .NET type mapping

Type mapping rules from this table are used when generating a model from a database with Entity Data Model Wizard in Visual Studio 2008 - 2015 and Create Model Wizard in Entity Developer.

MySQL data types

SSDL1

CSDL1

.NET

bool, boolean, bit(1)booleanBooleanSystem.Boolean
tinyintsbyteSByteSystem.SByte
tinyint unsignedtinyintByteSystem.Byte
smallint, yearsmallintInt16System.Int16
int, integer, smallint unsigned, mediumintintInt32System.Int32
bigint, int unsigned, integer unsigned, bitbigintInt64System.Int64
floatfloatSingleSystem.Single
double, realdoubleDoubleSystem.Double
decimal, numeric, dec, fixed, bigint unsigned, float unsigned, double unsigned, serialdecimalDecimalSystem.Decimal
date, timestamp, datetimedate, timestamp, datetimeDateTimeSystem.DateTime
datetimeoffsetdatetimeoffsetDateTimeOffsetSystem.DateTimeOffset
timetimeTimeSystem.TimeSpan
char, varchar, tinytext, text, mediumtext, longtext, set, enum, nchar, national char, nvarchar, national varchar, character varyingchar, varchar, tinytext, text, mediumtext, longtext, set, enumStringSystem.String
binary, varbinary, tinyblob, blob, mediumblob, longblob, char bytebinary, varbinary, tinyblob, blob, mediumblob, longblobBinarySystem.Byte[]
geometry2spatial_geometryGeometry, GeometryCollection, GeometryLineString, GeometryMultiLineString, GeometryMultiPoint, GeometryMultiPolygon, GeometryPoint, GeometryPolygonSystem.Data.Spatial.DbGeometry
geometry2spatial_geographyGeography, GeographyCollection, GeographyLineString, GeographyMultiLineString, GeographyMultiPoint, GeographyMultiPolygon, GeographyPoint, GeographyPolygonSystem.Data.Spatial.DbGeography

1 Applicable only to Entity Framework v1 - v6. Not applicable to Entity Framework Core, because Entity Framework Core does not support XML mapping.

2 Supported in Entity Framework v5 and v6.

.NET to MySQL default type mapping

.NET

CSDL1

SSDL1

MySQL data types

System.BooleanBooleanbooleanboolean, bit(1)
System.ByteBytetinyinttinyint unsigned
System.Byte[]Binarybinary, varbinary, blob, longblobbinary, varbinary, blob, longblob
System.Data.Spatial.DbGeometry2Geometryspatial_geometrygeometry
System.Data.Spatial.DbGeography2Geographyspatial_geographygeometry
System.DateTimeDateTimedatetimedatetime
System.DateTimeOffsetDateTimeOffsetdatetimeoffsetdatetimeoffset
System.DecimalDecimaldecimaldecimal
System.DoubleDoubledoubledouble
System.GuidGuidguidchar(36)
System.Int16Int16smallintsmallint
System.Int32Int32intint
System.Int64Int64bigintbigint
System.SByteSBytesbytetinyint
System.SingleSinglefloatfloat
System.StringStringchar, varchar, text, longtextchar, varchar, text, longtext
System.TimeSpanTimetimetime

1 Applicable only to Entity Framework v1 - v6. Not applicable to Entity Framework Core, because Entity Framework Core does not support XML mapping.

2 Supported in Entity Framework v5 and v6.

DateTimeOffset type is not supported.

 

 


© 2002 - 2016 Devart. All rights reserved.