成员映射错误、MVC 2 和 EF4
我创建了自己的实体来配合我编写的存储过程。所述 SP 和实体的映射似乎运行良好,现在我收到此错误(也出现了蓝色)
错误 7 错误 2019:成员映射 指定无效。类型 'Edm.Decimal[Nullable=True,DefaultValue=,精度=19,Scale=4]' 类型中的成员“ItemPrice” 'GodsCreationTaxidermyModel.StoreItem' 不兼容 'SqlServer.varchar[Nullable=True,DefaultValue=,MaxLength=15,Unicode=False,FixedLength=False]' 类型中的成员“ItemPrice” 'GodsCreationTaxidermyModel.Store.StoreItems'。 F:\Projects\GodsCreationTaxidermy\GodsCreationTaxidermy.Data\GCTModel.edmx 1071 17 GodsCreationTaxidermy.Data
有任何想法可能导致此情况吗?
I created my own entity to go with the stored procedure I wrote. The mappings for said SP and Entity seemed to go fine, now I'm getting this error (out pf the blue too)
Error 7 Error 2019: Member Mapping
specified is not valid. The type
'Edm.Decimal[Nullable=True,DefaultValue=,Precision=19,Scale=4]'
of member 'ItemPrice' in type
'GodsCreationTaxidermyModel.StoreItem'
is not compatible with
'SqlServer.varchar[Nullable=True,DefaultValue=,MaxLength=15,Unicode=False,FixedLength=False]'
of member 'ItemPrice' in type
'GodsCreationTaxidermyModel.Store.StoreItems'. F:\Projects\GodsCreationTaxidermy\GodsCreationTaxidermy.Data\GCTModel.edmx 1071 17 GodsCreationTaxidermy.Data
Got any ideas what could be causing this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
例外情况是,您的概念模型(实体)已将
ItemPrice
定义为decimal
,但您的存储模型(数据库描述或存储过程)将其返回为VARCHAR(15)
。 EDMX 由多个层组成,这些层与ItemPrice
不对应。您的映射中有问题。The exception says that your conceptual model (entity) has
ItemPrice
defined asdecimal
but your storage model (database description or stored procedure) returns it asVARCHAR(15)
. EDMX consists of several layers and these layers don't correspond in forItemPrice
. Something is wrong in your mapping.