问题
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