MappingException Edm.String is incompatible with SqlServer.varbinary

It's hard for me to solve the stupid matching problem. Basically what happens is that I have a field in the sql db table, which is varbinary for security purposes (encryption and decryption). All this is good and good, but it seems that edmx sees the field in this table as a row, which, as I thought, should see that the data is only 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 such a problem? Maybe I don’t notice something? Maybe I can point me in the right direction? I had a problem finding information to solve the problem, and I find it difficult.

+5
source share
4 answers

, , - , , edmx. , , . .

+13

, , # . . , , /. , . .

+4

EF ( - ) (?) edmx Model Entity Edm.String[Nullable=True,DefaultValue=,MaxLength=256,Unicode=,FixedLength=False] varinary. ,

, ...

, edmx →

  • Model Browser, , .
  • ModelEntity Types, , Properties
  • Type .

enter image description here

DateTime, String, .

+2

, , , , string

during encoding, you define this object as Property Int Price {get:set:}, NOW THIS IS A PROBLEM. your data type in SQL TABLE and Code should be the same different as this problem. This is the same problem that I ran into and I fixed it so far, hope you get this

also change these types in EDMX Xml files by searching if you use EF

as

<Property Name="Price" Type="money" />

<Property Type="Decimal" Name="Price" Precision="19" Scale="4" />

Hope this helps someone

+1
source

All Articles