This project has moved. For the latest updates, please go here.

PersistentDictionary and byte array

May 3, 2011 at 12:47 PM
Edited May 3, 2011 at 2:41 PM

Hello,
I have a need for simple read-only dictionary of string to byte array, PersistentDictionary<string, byte[]>.
Not able to do this is a real disappointment with the PersistentDictionary class, any easy way to fix this?

Also, how about allowing the constructor to accept user-defined IPersistentDictionaryConfig?

Anyway, to compact the database created in the PersistentDictionary or in the Esent in general?

Best regards,
Paul. 

May 4, 2011 at 5:47 PM

The only reason that PersistentDictionary<string,byte[]> doesn't work is that it is explicitly prevented. This was done because the semantics would differ from a normal dictionary -- changing the byte[] after adding it to the PersistentDictionary won't change the serialized copy.

If you want to make the change then you can go to ColumnConverter.IsSerializable and remove the IsValueType check from this line:

 if (!(type.IsValueType && type.IsSerializable))

May 5, 2011 at 1:31 AM

Hello Laurion,

Thanks so much for the support.

Reading through the archives, I have found that you have left Microsoft, but I hope you can still
join this open source project and continue to contribute to this great work, which, if I am not mistaken,
you started and contributed so much in codes and supports.

Again, thanks so much for the information and the support.

Best regards,
Paul.