Entity Framework column type for Base64 row

I am using the first Entity Framework code and four of my columns are a base64 image view and have a type string. I initially allowed EF to save them as standard nvarchar (max). Today I found out that nvarchar (max) is twice the size of the data in fact, when dealing with images, this difference is huge.

I tried using varchar, but it displays a maximum length of 8000, which is too small for a base64 image. I also tried the text, but this does not seem to be a valid type.

Any suggestions on what could be a good type that will support data length while maintaining a reasonable size?

+1
source share
2 answers

you can try text varchar(max)

+1
source

You should not store images like this. You should either store only the paths to physical locations on disk or use filestream, but check this question first How to add a filestream column in the first designer of Entity Framework 4.0?

0
source

All Articles