mysql - MySQL tinyint 和 Entity Framework 代码首先出现问题

标签 mysql entity-framework ef-code-first

当我想通过 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 中修复。

http://bugs.mysql.com/bug.php?id=62135

关于mysql - MySQL tinyint 和 Entity Framework 代码首先出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5718193/

相关文章:

mysql - vb sql查询不同类型的字段

php - 在 mysql php 搜索重音字符中也突出显示搜索词

c# - EF Core 使用 NUGET 包管理器控制台或 CMD

asp.net-mvc - ALTER TABLE DROP COLUMN 失败,因为表 'xxx' 中不存在列 'yyy'

.net - 如何在没有数据上下文的情况下更新对象

c# - Entity Framework 代码优先要求的外键

c# - 我如何处理 .FirstOrDefault 方法?

mysql - Voyager 管理面板中的多对多关系

entity-framework - EF Code First 多个实体到同一个表

php - 如何使用 codeigniter 从我的表字段中显示计数结果