c# - property type of 'System.Data.Linq.Binary' which cannot be mapped to a primitive type -


i converting mvc 3 linq-to-sql application mvc 5 entity framework 6.1. using model first import tables. save binary images in ms sql server: used following:

public emptyresult uploadvisionimage (ienumerable<httppostedfilebase> image, string desc)         {               var httppostedfilebases = image httppostedfilebase[] ?? image.toarray();         if (image == null || !httppostedfilebases.any())             return new emptyresult();         httppostedfilebase file = httppostedfilebases.first();         if (file.contentlength > 0)             {             var vi = new visionimage();             vi.description = desc;             vi.filename = file.filename.split('\\').last();             vi.contenttype = file.contenttype;             // save full size image.             var tempimage = new byte[file.contentlength].toarray();              file.inputstream.read(tempimage, 0, file.contentlength);             vi.imagedata = new binary(tempimage);             // create , save thumbnail image.             file.inputstream.seek(0, seekorigin.begin);             int thumbnailsize = config.current.thumbnailsize;             vi.thumbnailimagedata = new binary(thumbnail.createthumbnail(file.inputstream, thumbnailsize, thumbnailsize));             // commit changes.             selectedvisit.visionimage.add(vi);             _visitrepository.save();             }         return new emptyresult();         } 

i error:

cannot convert system.data.linq.binary target type byte[] 

i checked model in old application both imagedata , thunbnailimagedata binary, in ef model byte[]; when changed them manually binary, above error. both stored in database "image", tried varbinary, still model shows them byte[]. appreciate suggestions.


Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -