ATL_DEV
ATL_DEV

Reputation: 9591

InvalidOperationException You must set this property to a non-null value of type string

The XX property on 'Table' could not be set to a 'Byte[]' value. You must set this property to a non-null value of type 'String'.

I didn't create the mapping myself, this was generated from a db first scenario. I am not inserting anything to a table, I'm just performing a select, this shouldn't happen at all? Why am I getting this error and how do I fix it?

Upvotes: 2

Views: 7624

Answers (1)

Lewis
Lewis

Reputation: 2443

I had a similar issue but for byte to bool

I edited my entity
public byte XX { get; set; } Then edited my Model to have public bool XX { get; set; }

used auto mapper to map them together and it fixed the issue i was having, try this with editing your Model to a string and map it accordingly.

i am using code first for my existing databases, but it may work for db first

Upvotes: 2

Related Questions