简体   繁体   中英

Entity Framework Column Type for Base64 String

I am using code first Entity Framework and four of my columns are a base64 representation of an image and are of type string. Initially, I was allowing EF to store these as the default nvarchar(max). I learned today that nvarchar(max) is twice the size of what the data actually is, when dealing with images this difference is tremendous.

I've tried to use varchar, but it appears the max length on that is 8000 which is too small for a base64 image. I've also tried text, but that does not appear to be a valid type.

Any suggestions for what may be a good type that will support the length of the data while maintaining a reasonable size?

您可以尝试varchar(max) text

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM