今天用EF+MySQL进行开发时报错:处理请求时发生未处理的异常。
处理请求时发生未处理的异常。
InvalidOperationException:为实体类型'e_down'上的外键{'classid'}指定的属性类型与实体类型'e_category'上的主键{'classid'}中指定的属性类型不匹配。
对应英文报错
An unhandled exception occurred while processing the request.
InvalidOperationException: The types of the properties specified for the foreign key {'classid'} on entity type 'e_down' do not match the types of the properties in the principal key {'classid'} on entity type 'e_category'.
提示已经很明显了,就是实体A中的外键类型与外键所在的实体类型对应不上.
怎么解决,也很简单了.就是修改e_down实体上的外键classid类型与e_category实体中的主键classid类型一样.即两个都是int类型.
以上就是【EF+MySQL 报错:处理请求时发生未处理的异常。】的全部内容了,欢迎留言评论进行交流!