Re: EntityFramework(Code First) and MySql
Posted by: Fernando Gonzalez
Date: April 16, 2012 12:06PM

Hi Bin Xiang,

This has been fixed in http://bugs.mysql.com/bug.php?id=64216

The fix has not yet made it to any release of Connector/NET, will be available in 6.4.5 & 6.5.5.


The following is the code for the fix (at file /source/MySql.Data.Entity/ProviderManifest.cs, method
public override TypeUsage GetStoreType(TypeUsage edmType) ):

Locate this code:

if (isFixedLength)
{
if (maxLength < CHAR_MAXLEN) typeName = "tinyblob";
else if (maxLength < MEDIUMBLOB_MAXLEN) typeName = "blob";
else if (maxLength < LONGTEXT_MAXLEN) typeName = "mediumblob";
else typeName = "longblob";
}
else
{
typeName = isMaxLength || maxLength > BINARY_MAXLEN ? "varbinary" : "binary";
maxLength = isMaxLength ? VARBINARY_MAXLEN : maxLength;
}


And replace it with:


// now this applies for both isFixedLength and !isFixedLength
if (maxLength < CHAR_MAXLEN) typeName = "tinyblob";
else if (maxLength < MEDIUMBLOB_MAXLEN) typeName = "blob";
else if (maxLength < LONGTEXT_MAXLEN) typeName = "mediumblob";
else typeName = "longblob";



The fix uses now mysql's blob which is also fully compatible with 'varbinary' in MSSQL.


Let me know if that helps.

Thanks.

Options: ReplyQuote


Subject
Written By
Posted
Re: EntityFramework(Code First) and MySql
April 16, 2012 12:06PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.