Skip to content

How to have binary data in your POCO? #24

@gustavjon

Description

@gustavjon

I could use some help inserting binary data.

The database I'm using is sql server 2014. The column i'm trying to insert som bytes into looks like this:

[BinaryData]varbinary NULL,

In my code the property looks like this:

public byte?[] BinaryData { get; set; }

I'm simply inserting this using

dbAdapter.Insert("MyTable", entity);

but when It's inserted I get this exception "Implicit conversion from data type nvarchar to varbinary(max) is not allowed".

If I comment out the binary property everything works just fine.

I've tried adding the Column annotation like this on the property in my code but that didnt help.

[Column(“BinaryData", TypeName="varbinary")]

Some help would be much appreciated.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions