Entity Framework Code - First, MySQL and Unicode support
I am using EF Code-First (EFCF) with MySQL to create my database using Migrations. I have a problem with character columns.
I'm not a MySQL expert, but from what I've read, in MySQL you can support Unicode in your tables in at least two ways:
-
The default for the entire table is:
CREATE TABLE mytable (...) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;
-
Making each specific column support Unicode:
CREATE TABLE myTable (col1 VARCHAR(10) CHARSET utf8, OtherColNotUnicode VARCHAR(5), ...);
(note that MySQL does not have NVARCHAR)
As it turns out, EFCF Migrations creates tables and columns with no Unicode support by default, and I couldn't find a way to override or annotate properties in my model, basically forcing either option 1 or 2.
? , , , , , , .
, EF 5.0, MySql.Data MySql.Data.Entity v 6.6.4.0.