当我想通过 Entity Framework (代码优先)连接到 MySQL 时,出现此错误:
(22,12) : error 2019: Member Mapping specified is not valid. The type 'Edm.Byte[Nullable=False,DefaultValue=]' of member 'Permission' in type 'News.Models.Author' is not compatible with 'MySql.tinyint[Nullable=False,DefaultValue=]' of member 'Permission' in type 'CodeFirstDatabaseSchema.Author'.
The name of colum in db is Permission with tinyint datatype. and the below is my class.
public class Author
{
...
public byte Permission { get; set; }
...
}
最佳答案
它已在尚未发布的 Connector/Net 6.4.5 中修复。
关于mysql - MySQL tinyint 和 Entity Framework 代码首先出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5718193/