The local database generates a byte of byte truncation for a length of 8000 exceptions

I am trying to take a snapshot from a Map control as a WritableBitmap, convert it to an array of bytes and store it in a local database. It works fine (I can convert the byte array back to an image) until I send the changes to the database. At this point, it throws an exception, "Byte array truncation up to 8000 in length." I did not find any documentation about limiting a byte array. Does anyone know how to increase the limit of 8000? My byte array is a member of my model:

private byte[] _locationImage; [Column] public byte[] LocationImage { get { return _locationImage; } set { if (_locationImage != value) { NotifyPropertyChanging("LocationImage"); _locationImage = value; NotifyPropertyChanged("LocationImage"); } } } 
+8
database windows-phone-7 sql-server-ce linq-to-sql
source share
1 answer

If you look at SQL Compact documents , you will see that a binary or varbinary field can contain no more than 8000 bytes, so I am informed that byte[] maps to varbinary. To get more data to store data, you need to force the engine to use the image field type. It can be as simple as updating a Column attribute like this (unchecked):

 [Column(DbType="image")] public byte[] LocationImage { ... } 
+11
source share

All Articles