MySQL
Requirements
MySQL support relies on the DevArt MySqlConnect .NET provider v5.x or higher. The Express edition is enough. To be able to create a model from an existing MySQL schema, you have to have access to a MySQL instance v4.1 or higher.
Supported features
Feature | Supported |
---|---|
Minimal database version | v4.1 |
Database types | All built-in types |
User defined types | No |
Foreign key constraints | Yes (Not on v4.x) |
Primary key constraints | Yes |
Unique constraints | Yes |
Check constraints | No |
Default values | Yes |
Unique indexes | No |
Tables | Yes |
Views | Yes |
Stored Procedures | Yes (Not on v4.x) |
Table Valued Functions | No |
(System versioned) Temporal tables | No |
Synonyms | No |
Cascade delete rules | No |
Cascade update rules | No |
Identity fields | Yes |
System sequences | Yes |
Schema based sequences | No |
Multiple catalogs per project | Yes |
Multiple schemas per catalog | No |
Linked servers | No |
SQL Server 2016+: History tables of a temporal table pair are filtered out and are not included in schema data.
Type mappings
Below you'll find the two type mapping tables used by the MySQL driver of LLBLGen Pro. One is used for Database First development, the other is used for Model First development. In case of Model First development, you can add your own type shortcuts to define a different target database type, in case the default mappings aren't what you need in a particular case.
Global model-first type overruling
For Model first, there are often multiple database types defined per .NET Type and a given filter. To prefer one over the other on a global level, please look at the following settings in the Relational model data element construction section of the Project Settings:
- Prefer natural character types
- Prefer decimal over currency types
- Prefer variable length types
Database first type mappings
You can control the .NET type during reverse engineering in database first development by defining Type Conversions in the Project Settings, which are based on Type Converters.
Database type | .NET Type |
---|---|
BigIntUnsigned | System.Decimal |
BigInt | System.Int64 |
Binary | System.Byte[] |
Blob | System.Byte[] |
Char | System.String |
DateTime | System.DateTime |
Date | System.DateTime |
Decimal | System.Decimal |
DecimalUnsigned | System.Decimal |
Double | System.Double |
DoubleUnsigned | System.Double |
Float | System.Single |
FloatUnsigned | System.Single |
IntegerUnsigned | System.Int64 |
Integer | System.Int32 |
LongBlob | System.Byte[] |
LongText | System.String |
Long Varchar | System.String |
MediumBlob | System.Byte[] |
MediumText | System.String |
Numeric | System.Decimal |
SmallIntUnsigned | System.Int32 |
SmallInt | System.Int16 |
Text | System.String |
Timestamp | System.DateTime |
Time | System.TimeSpan |
TinyBlob | System.Byte[] |
TinyIntUnsigned | System.Byte |
TinyInt | System.Int16 |
TinyText | System.String |
VarBinary | System.Byte[] |
VarChar | System.String |
Year | System.Int16 |
Model first type mappings
If specified, the filter is combined with the .NET type to determine the database type. The elements length, precision and scale
are the max. length, precision and scale of an entity field with the particular .NET Type. For instance a field with type System.String
, max. length set to 50, will with all defaults enabled, a database type of NVarChar(50)
.
If a controlling setting is specified, that setting has to be set to the specified value (in the Relational model data element construction section of the Project Settings) to make the designer select that database type.
.NET Type | Filter | Database type | Controlling setting and value |
---|---|---|---|
System.Byte | TinyIntUnsigned | ||
System.Byte[] | length==0 or length >= 16777216 | LongBlob | |
System.Byte[] | 65536 <= length < 16777216 | MediumBlob | |
System.Byte[] | 256 < length < 65536 | Binary(length) | Prefer variable length types set to false |
System.Byte[] | 256 < length < 65536 | VarBinary(length) | Prefer variable length types set to True |
System.Byte[] | 0 < length < 256 | TinyBlob | |
System.DateTime | DateTime | ||
System.Decimal | precision > 0 and scale == 0 | BigIntUnsigned | |
System.Decimal | Decimal(precision, scale) | ||
System.Double | Double | ||
System.Int16 | SmallInt | ||
System.Int32 | Integer | ||
System.Int64 | BigInt | ||
System.Single | Float | ||
System.String | length==0 or length >= 16777216 | LongText | |
System.String | 65536 <= length < 16777216 | MediumText | |
System.String | 256 <= length < 65536 | VarChar(length) | Prefer variable length types set to true |
System.String | 256 <= length < 65536 | Char(length) | Prefer variable length types set to false |
System.String | 0 < length < 256 | TinyText | |
System.TimeSpan | Time |
Supported target frameworks
The following target frameworks are supported with MySQL:
- LLBLGen Pro Runtime Framework
- Entity Framework v1-v6
- NHibernate