Entity Framework Column Type for Base64 String

[亡魂溺海] 提交于 2019-12-13 18:18:43

问题


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?


回答1:


you could try text of varchar(max)



来源:https://stackoverflow.com/questions/10112397/entity-framework-column-type-for-base64-string

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!