实体框架将SQL Server tinyint映射到Int16 [英] Entity Framework Mapping SQL Server tinyint to Int16

查看:104
本文介绍了实体框架将SQL Server tinyint映射到Int16的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的实体数据模型给我这个错误:

My Entity Data Model is giving me this error:


错误2019:指定的成员映射
无效。 ...的类型
'Edm.Int16 [Nullable = True,DefaultValue =]'

不兼容'SqlServer.tinyint [Nullable = True,DefaultValue =]'
of ...

Error 2019: Member Mapping specified is not valid. The type 'Edm.Int16[Nullable=True,DefaultValue=]' of ... is not compatible with 'SqlServer.tinyint[Nullable=True,DefaultValue=]' of ...

我尝试删除并重新创建该属性。我不知道我做错了什么。

I've tried deleting and recreating the property. I don't know what I've done wrong.

推荐答案

A tinyint 应该映射到.NET byte ; Int16 应该是SQL中 smallint 的相应类型。

A tinyint should get mapped to a .NET byte; Int16 should be the corresponding type for a smallint in SQL.

这篇关于实体框架将SQL Server tinyint映射到Int16的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆