Sorry my lack of knowlegde on mysql connector source code... i'm just a user of the library.
I'm trying to map a property in .net whose type is Byte[]. I need to write files around 500k in size. Clearly a Blob doesn't do the job, so next step is mediumblob. But when I let Entity Framework do the table creation, it creates the field as BLOB. Googling around I found a piece of code that explain that bad behavior...
if (maxLength < CHAR_MAXLEN) typeName = "tinyblob";
else if (maxLength < MEDIUMBLOB_MAXLEN) typeName = "blob";
else if (maxLength < LONGTEXT_MAXLEN) typeName = "mediumblob";
else typeName = "longblob";
This code was found in this file:
mysql-connector-net/Source/MySql.Data.EntityFramework5/ProviderManifest.cs
As you can see logic is wrong... is maxLength is 500000 the 'if' conclude with 'blob'.
I think this is the correct logic...
if (maxLength > MEDIUMBLOB_MAXLEN) typeName = "longblob";
else if (maxLength > VARBINARY_MAXLEN) typeName = "mediumblob";
else if (maxLength > CHAR_MAXLEN) typeName = "blob";
else typeName = "tinyblob";
But I don't have the experience to get connector.net compiling in my machine.
Thanks!
I'm trying to map a property in .net whose type is Byte[]. I need to write files around 500k in size. Clearly a Blob doesn't do the job, so next step is mediumblob. But when I let Entity Framework do the table creation, it creates the field as BLOB. Googling around I found a piece of code that explain that bad behavior...
if (maxLength < CHAR_MAXLEN) typeName = "tinyblob";
else if (maxLength < MEDIUMBLOB_MAXLEN) typeName = "blob";
else if (maxLength < LONGTEXT_MAXLEN) typeName = "mediumblob";
else typeName = "longblob";
This code was found in this file:
mysql-connector-net/Source/MySql.Data.EntityFramework5/ProviderManifest.cs
As you can see logic is wrong... is maxLength is 500000 the 'if' conclude with 'blob'.
I think this is the correct logic...
if (maxLength > MEDIUMBLOB_MAXLEN) typeName = "longblob";
else if (maxLength > VARBINARY_MAXLEN) typeName = "mediumblob";
else if (maxLength > CHAR_MAXLEN) typeName = "blob";
else typeName = "tinyblob";
But I don't have the experience to get connector.net compiling in my machine.
Thanks!