MappingException Edm.String not compatible with SqlServer.varbinary

Schanckopotamus picture Schanckopotamus · Feb 5, 2013 · Viewed 18.7k times · Source

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.

Answer

Schanckopotamus picture Schanckopotamus · Feb 5, 2013

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.