MappingException Edm.String与SqlServer.varbinary不兼容 [英] MappingException Edm.String not compatible with SqlServer.varbinary

查看:219
本文介绍了MappingException Edm.String与SqlServer.varbinary不兼容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很难解决一个愚蠢的映射问题.基本上发生了什么事,我在sql db表中有一个字段,该字段是出于安全性(加密和解密)目的而使用的varbinary.所有这些东西都很好,但是edmx似乎将表中的字段视为字符串,鉴于数据只是二进制字符串,我认为应该将其视为字符串.这是我收到的错误消息.

I am having a difficult time resolving a silly mapping problem. Basically what is going on is that I have a field in a sql db table that is a varbinary for the purposes of security (encryption and decryption). All that stuff is all well and good but it seems as though the edmx sees the field in that table as a string which I thought it should see it as given that the data is just a binary string. This is the error message I get.

Schema specified is not valid. Errors:

ReadModel.Model.msl(836,12): error 2019: Member Mapping specified is not valid. The type 
'Edm.String [Nullable=True,DefaultValue=,MaxLength=256,Unicode=,FixedLength=False]' of 
member 'field-in-question' in type 'Lib.ReadModel.TableName' is not compatable with
'SqlServer.varbinary' [Nullable=True,DefaultValue=,MaxLength=256,FixedLength=False]'
of member 'field-in-question' in type 'Model.Store.TableName'.

有人有这样的问题吗?也许我忽略了某些东西?也许可以为我指明正确的方向?我在寻找解决问题的信息方面遇到问题,无所适从.

Has anyone had an issue like this? Maybe there is something I am overlooking? Maybe be able to point me in the right direction? I am having an issue on finding information to resolve the issue and am at a loss.

推荐答案

好吧,对于那些曾经遇到过此类问题的人来说,似乎最好的解决方法是在edmx中再次删除并重新添加实体.在我看来,这是一件愚蠢的事情,但确实有效.呸.

Ok, for those that ever have an issue like this it turns out that it seems to be best solved by deleting and re-adding the entity again in the edmx. It's a silly thing in my opinion, but it works. Bah.

这篇关于MappingException Edm.String与SqlServer.varbinary不兼容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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